Software & Apps Linux updatedb: Linux Command and Unix Command Update the database of your system files to make finding them easier by Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated on March 23, 2020 Linux Switching from Windows Tweet Share Email The updatedb command is used in conjunction with locate commands, like locate, mlocate, and slocate, to generate a searchable database of the files currently on a Linux system. vgajic / Getty Images Install updatedb With mlocate This guide focuses on the mlocate package, but an alternative, if available, will work just as well. To install updatedb on Debian, Ubuntu, and Mint: sudo apt install mlocate To install updatedb on Fedora: sudo dnf install mlocate To install updatedb on CentOS and RHEL: sudo yum install mlocate To install updatedb on OpenSUSE: sudo zypper install mlocate To install updatedb on Arch Linux and Manjaro: sudo pacman -S mlocate Use the updatedb Command The updatedb command comes with mlocate, and you need to use it to create a database before you can search. Since updatedb logs everything on your system by default, run it with root permissions using sudo. If you only want to use it as a regular user, you can with a few options. First, create a general system-wide database with root permissions: sudo updatedb It takes a few minutes to complete, depending on how many many files are on your system. From there, find a file with mlocate. For example: mlocate gnome Notice the amount of junk that comes up? You can, if you choose to exclude certain directories with the -e flag. sudo updatedb -e /usr/share, /var/lib If you want to see which files are added to the database, use the -v flag. sudo updatedb -v Now, to run updatedb as a regular user, use the -l flag with a value of 0 to exclude everything that your user doesn't have access to. Then, specify a local output in your home directory with the -o flag. updatedb -l 0 -o ~/.mlocate.db To search that user-specific database, instead of the system one, use the -d flag to specify the user one. mlocate -d ~/.mlocate.db These are the most common ways to work with updatedb. For a more complete breakdown, refer to the complete technical manual below. Updatedb Technical Manual Below is the full technical breakdown of what the updatedb command can do. NAME updatedb: Update the slocate database. SYNOPSIS updatedb [-u] [-u path] [-e path1,path2,...] [-f fstype1,...] [-l  ] [-q] [-v,--verbose] [-V, --version] [-h, --help] pattern... DESCRIPTION This manual page documents slocate, a security-enhanced version of locate. updatedb is simply a link to slocate that implies the -u option. OPTIONS -u Create a slocate database starting at the root directory. This is the default behavior when called as updatedb. -U path Create a slocate database starting at path path. -e dirs Exclude directories in the comma-separated list dirs from the slocate database. -f fstypes Exclude file systems in the comma-separated list dirs from the slocate database. -l <num> Security level. -l 0 turns security checks off, which will make searches faster. -l 1 turns security checks on. This is the default. -q Quiet mode; error messages are suppressed. -v Verbose mode; display files indexed when creating a database. --help Print a summary of the options to slocate and exit. --version Print the version number of slocate and exit. Use the man command (% man) to see how a command is used on your computer.