Skip to content

Essential Commands

CommandWhat It DoesExample
pwdPrint current directorypwd/Users/fabiocorrea
lsList files in current directoryls
ls -laList all files with details (including hidden)ls -la
cdChange directorycd Documents
cd ..Go up one directorycd ..
cd ~Go to home directorycd ~
cd -Go to previous directorycd -

Files and Folders

CommandWhat It DoesExample
mkdirCreate a directorymkdir my-project
touchCreate an empty filetouch notes.txt
cpCopy a filecp notes.txt backup.txt
cp -rCopy a directorycp -r project project-backup
mvMove or renamemv old.txt new.txt
rmDelete a filerm unwanted.txt
rm -rDelete a directoryrm -r old-folder
catDisplay file contentscat notes.txt
openOpen file with default appopen photo.jpg
open .Open current folder in Finderopen .

Warning: rm deletes permanently: files don't go to the Trash. Be careful with rm -r.

Searching

CommandWhat It DoesExample
findFind files by namefind ~/Documents -name "*.pdf"
grepSearch inside filesgrep "password" config.txt

System

CommandWhat It DoesExample
whoamiShow current usernamewhoami
dateShow current date/timedate
uptimeHow long Mac has been runninguptime
df -hShow disk spacedf -h
topLive system monitor (press q to quit)top
clearClear the terminal screenclear