Sysadmin Lookups
locate is an essential tool for rapid system investigation.
Locating Binaries
While which only searches your PATH, locate finds every instance:
# Find all versions of python3
locate -b "\python3" | grep "/bin/"
# Find all ffmpeg executables
locate -b "\ffmpeg" | grep "/bin/"
Finding Shared Libraries
# Find where libssl is located
locate libssl.so
Finding Documentation and Man Pages
# Find all man pages for grep
locate "man/man1/grep.1"
# Find documentation for a specific package
locate "doc/nginx"
Quick Inventory
# Count how many log files are on the system
locate -c "*.log"
# Count how many .sh files are in /usr/local/bin
locate "/usr/local/bin" | grep "\.sh$" | wc -l