click below
click below
Normal Size Small Size show me how
find locate commands
Searching for Files
Question | Answer |
---|---|
Search through all files by name, file size, time created, time accesses etc | find |
find Options: Find all plain text files in /user/home directory | find /user/home -name ‘.txt’ |
find Options: files owned by a specified user | -user |
find Options: find files modified before or after a specified number of days | find /user/home –mtime -5 |
find Options: Specifies whether files or directories [fd] | find / -type d ‘*paper*’ |
find Options: Specifies how many levels down to search | find –maxdepth 3 –name ‘*.txt’ |
find Options: Find specified files, including filenames with spaces | -print0 |
find Options: Specifies the or parameter when searching multiple criteria | -o |
find Options: Specifies when file was last accessed | -atime |
Searches an index file for specific parameters (is faster than find) | locate |
Index file for locate | /var/log/locatedb |
Command to update the index /var/log/locatedb | updatedb |
Configuration file for updatadb | /etc/updatedb.conf |
locate Options: Count number of entries rather than list | locate -c |
locate Options: List files only after verifying that they exist | locate -e |
locate Options: Ignore case | locate -i |
locate Options: Limit the number of files listed | locate -l |
locate Options: Searches for a string in only file or directory base names | locate -b |
Display path to a command | which |
Displays the path to the binary file, the manual pages, and the source code | whereis |
whereis Options: List path to the binary file (similar to which) | whereis -b |
whereis Options: Lists path to the man pages | whereis -m |
whereis Options:List location of source code | whereis -s |
whereis Options: List entries that do not have source code, binary file, and man page locations | -u |
whereis no options | Shows all available options |
find Options: Find files by size - c for bytes – k for kilobytes – M for magabytes | find /user/home –size +300K |