How do you find files and directories in Linux?

Beginner

Answer

Multiple commands are available for finding files:
find command (most powerful):

# Find by name
find /path -name "filename"
find . -name "*.txt"
# Find by type
find /home -type f        # Files only
find /home -type d        # Directories only
# Find by size
find /var -size +100M     # Files larger than 100MB
find . -size -1k          # Files smaller than 1KB
# Find by permissions
find . -perm 755
find . -perm -u+x         # Files executable by owner
# Find and execute action
find /tmp -name "*.tmp" -delete
find . -name "*.log" -exec rm {} \;

locate command (faster, uses database):

locate filename
updatedb              # Update locate database

which/whereis commands:

which python           # Find executable in PATH
whereis python         # Find binary, source, manual