Cheatsheet
← All cheat sheets

Terminal commands

Commands that work in the Linux and macOS terminal (bash and zsh). Click a command to copy it.

Moving around

Show the current folder
List everything here, with details and hidden files
Go into a folder
Go up one folder
Go to your home folder
Go back to the previous folder

Files and folders

Make folders, including the ones in between
Create an empty file
Copy a file
Copy a folder
Rename or move
Delete a file (there is no trash)
Delete a folder and everything in it
Make a shortcut (symbolic link)

Viewing files

Print a file
Read a long file page by page (q to quit)
First 20 lines
Last 20 lines
Follow a file as it grows
Count lines

Searching

Find text in files here, with line numbers
Find text, ignoring upper/lower case
Find files by name
Find files bigger than 100 MB
Where a command lives
Search your earlier commands

Permissions

Allow a file to run
Owner can edit, everyone can read
Owner can edit, everyone can open
Run a command as administrator
Change who owns a file

Processes and system

Live list of running programs (q to quit)
Find a running program
Stop a program by its process ID
Force-stop a program
Free disk space
Size of each file and folder here
What is using port 3000

Network

Check a site answers (Ctrl+C to stop)
Show the response headers of a page
Download a file
Log in to another computer
Copy a file to another computer

Archives

Pack and compress a folder
Unpack a .tar.gz
Make a zip file
Unpack a zip file

Combining commands

Save the output to a file (overwrites)
Add the output to the end of a file
Send one command’s output into another
Run the second only if the first worked
Stop the running command
Search earlier commands as you type
Clear the screen (or Ctrl+L)

rm deletes for good. Double-check the path before pressing Enter.

Something not working?

Send feedback

What is it?

The page you’re on, your browser and your screen size are sent along to help us fix it. Never your files or what you typed into the tool.