Navigate, manage files, search, and inspect your system — the terminal commands worth knowing. Tap to copy.
pwdPrint the current working directoryls -laList all files with details and hidden onescd <dir>Change into a directorycd ..Go up one directorycd ~Go to your home directorytouch <file>Create an empty file or update its timestampmkdir <dir>Create a new directorycp <src> <dst>Copy a file or foldermv <src> <dst>Move or rename a file or folderrm <file>Delete a filerm -rf <dir>Delete a folder and everything in itcat <file>Print a file's contentsgrep "text" <file>Search for text inside a filegrep -r "text" .Search recursively through a folderfind . -name "*.js"Find files matching a patternhead -n 20 <file>Show the first 20 lines of a filetail -f <file>Follow a file as new lines are addedwc -l <file>Count the lines in a filechmod +x <file>Make a file executablesudo <command>Run a command as the superuserps auxList running processeskill <pid>Stop a process by its IDdf -hShow disk space in human-readable formdu -sh <dir>Show the total size of a folderman <command>Open the manual page for a commandThese commands work in bash and zsh on Linux and macOS (and WSL on Windows). The essentials — ls, cd, cp, mv, rm — get you around, while grep and find are the search workhorses. Be careful with rm -rf: it deletes permanently with no recycle bin.