How to find a file
locate command helps you find files by name.
#syntax locate filename locate x11
If you installed new files or created a new file, locate will not find the files.
touch newfile #create newfile locate newfile #search for the file but no results
You need to update the mlocate.db database by using:
now you can find the file
If you want to count only the times the search exists in the database then add -c parameter:
locate -c newfile
If you do not want all the result but some for example 10, then add -n 10
locate x11 -n 10
More information here
- Ubuntu 18.04 – shell commands copy, move and delete items (files/directories)
- Ubuntu 18.04 – Change file ownership
- Ubuntu 18.04 – Change file permissions