locate command
Search files quickly using a prebuilt database.
Linux · Lesson
Linux · Lesson
components/linux/linuxLessons.js.Linux provides multiple commands for searching files and directories across the filesystem.
The locate command performs very fast searches using a prebuilt database, while the find command performs real-time searches directly on the filesystem.
These commands are extremely useful for system administration, troubleshooting, file management and automation tasks.
Search files quickly using a prebuilt database.
Perform real-time searches with advanced filtering options.
Search using names, permissions, size, ownership and timestamps.
Faster searches using a database, but may show outdated results if the database is not updated.
Slower but more powerful because it performs live filesystem searches with advanced filters.
The following examples demonstrate different ways to search files and directories using locate and find commands.
The locate command quickly searches files and directories using a prebuilt database.
Use the -i option to perform a case-insensitive search.
Use updatedb when newly created files are not found by locate.
Search files and directories by name using find.
Search files using inode numbers.
Search files based on type such as regular files, directories or symbolic links.
Search files using file size or empty status.
Search files based on permissions, user ownership or group ownership.
Run commands on files found using the -exec option.
Search files based on access, modification or change time.
locate.locate -i.updatedb.find.find -exec to copy or manage files.-atime, -mtime and -ctime.In upcoming lessons, you will continue learning Linux filesystem management, permissions and shell automation concepts.