Linux Tip: Find a File by Name from the Terminal

You know the file is on the PC somewhere — you just don’t remember which folder you saved it in. Instead of clicking through folders one by one, let the terminal search for you. One command does it in seconds.

Find a file by its exact name

  1. Open a terminal.
  2. Type find ~ -name "report.txt" and press Enter. Replace report.txt with the name you’re looking for.
  3. Linux prints the full path to every match — something like /home/you/Documents/report.txt.

The ~ tells find to start in your home folder, which is where most of your own files live. To search somewhere else, swap it out — for example, find /home -name "report.txt".

When you only remember part of the name

  • Use a wildcard: find ~ -name "*.pdf" finds every PDF, and find ~ -name "invoice*" finds anything starting with “invoice”.
  • Ignore capital letters: use -iname instead of -name, so Report.TXT and report.txt both count as a match.

Two handy extras

  • Hide the permission warnings: searching outside your home folder can fill the screen with “Permission denied” lines. Add 2>/dev/null to the end of the command to hide them and see only the results.
  • Start closer to save time: if you know the file is in Documents, start there — find ~/Documents -name "report.txt" is much faster than searching the whole drive.

Learn just this one command, and “where did I save that?” stops being a folder-by-folder hunt.

Filed under: Computer Tips