From the course: CompTIA Linux+ (XK0-005) Cert Prep

Unlock the full course today

Join today to access over 24,300 courses taught by industry experts.

Find files using Locate

Find files using Locate

- [Speaker 1] The Linux directory structure is deep and has many files. Knowing how to find files is important. Let's start finding files by using the locate command. The locate command uses a database created by the updatedb command. Being database-driven it is very fast but only finds files that are listed in the database. By default in most Linux systems the locate database is updated once per day by a system service. Let's search for the file named bzip2 using the locate command. In a terminal type in locate bzip2 and hit enter. This will search the database and find files that include the name bzip2. Locate, by default, uses a fairly loose search. We can count the number of files by adding the -c option. Bring your line back and insert -c between locate and bzip2 and hit enter. You can see that I got 15 results. If you want to search for more than one item just add it to the line. Type in locate bzip2 man and hit…

Contents