Finding files with find
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Searching the whole tree
lsshows one folder.findsearches a folder and everything inside it, however deep:
find .
.means "start in the current folder".findlists every file and folder it can reach.
Find by name
- Usually you want files matching a pattern. Use
-name:
find . -name "*.txt"
- This finds every
.txtfile in the tree — even ones buried three folders down. - Quote the pattern (
"*.txt") so the shell passes it tofinduntouched.
Why it is handy
- "Where did I put that file?" —
findanswers it in one line. - Combined with pipes, you can act on the results — for example count them with
wc -l.
Find every .txt file, even deep inside subfolders, with find . -name "*.txt". (. means "start from here".)
Click Run to see the output here.