Mac Terminal Commands Cheat Sheet (Updated – 2024)

Discover the true power of your Mac with this comprehensive Mac Terminal Commands Cheat Sheet. Learn all the essential commands and find what you need quickly.

Key takeaway: Mastering essential Mac terminal commands can significantly enhance productivity by providing quick access to macOS settings, file management, and system controls. Familiarizing yourself with useful shortcuts and commands can offer more power and efficiency when navigating your Mac computer.

Mac computer includes a user-friendly interface, so you don’t need more time to excel your way through it. Unlike other devices, Mac computer has a command line prompt line interface called Terminal application. It is handy as it lets you quickly go inside macOS settings. Besides this, there are other reasons as well. In addition, you can use Terminal app for searching and managing files, folders, and more. Altogether, it offers more power and control to your Mac.

There are multiple commands that help get commands to your Mac, however, remembering all of them is an arduous task. Therefore, In this article, we covered all the essential Mac terminal commands to help you enhance your productivity.

A Guide to Use Terminal Commands on Mac

Before proceeding ahead, first learn how to access the terminal on your Mac computer.

Steps to open Terminal on your Mac

Follow the steps to Open Terminal on Mac in Easy ways.

    1. Open Spotlight search (Command + Space) on your Mac > Type Terminal and Open Other use an alternate way to open the terminal on Mac.
        • On your Mac computer, head to the Finder.
        • Select Go from the Finder menu bar.
        • Click on the Go To Folder…
        • Search for Utilities and click on it to open.
        • Next, select Terminal from there.
      • That’s it.
TabAuto-complete folders and files
Ctrl + AMove to the beginning of the line you’re currently typing
Ctrl + ENavigate to the end of the line you’re currently typing.
Ctrl + UVanish the line before the cursor
Ctrl + KVanish the line after the cursor
Ctrl + WClear the word before the cursor
Ctrl + TSwitch the last two characters the cursor
Esc + TSwitch the last two words before the cursor
Ctrl + LClear the screen
Ctrl + CExit whatever you’re using
Ctrl + DKill the current shell
Option + →Move the cursor one word forward
Option + ←Move the cursor one word backward
Ctrl + FMove cursor one character forward
Ctrl + BMove cursor one character backward
Ctrl + YPaste whatever you cut from the previous command
Ctrl + ZPlace whatever you’re running into a dangling background procedure
Ctrl + _Undo the previous command
Option + Shift + Cmd + CCopy plain text
Shift + Cmd + VPaste Selection
ExitExit a shell session
/ (forward shell)Top-level directory
. (Single Period)Current directory
.. (Double Period)Parent directory
~ (Tide)Home directory
Sudo [command]Execute command along with security privileges of the superuser
Nano [file]Access the Terminal editor
Open [file]Access the files
[Command] – hReceive help about a command
man [command]Show the help manual of the command
Change directory 
cdHome directory
Cd [folder]Change directory
cd~Home directory
cd/Room of the drive
cd-Previous directory or folder you last browsed
pwdShow your working directory
cd..Head up to the parent directory
cd../..Navigate up two levels
List directory contents 
IsHighlight the name of the sub-directories in the directory
Is -CForce multi-column output of the listing
Is -aWill show list of all entries including those with .(perid) and ..(double period)
Is -1Results the list of files in one entry per line format
Is -FHighlights a / immediately after each path that is directory, * right after executable scripts or program, and @ next to the symbolic link
Is -SSort entries & files by size
Is -lList of long format
Is -l /List of file system from root with symbolic link
Is -ItList of files sorted by time modified
Is -lhLong listing with human redeable files size in KB, MB, or GB
Is -loList the file names with owner, size and flags
Is -laList detailed directory contents, including hidden files
File Size and Disk Space 
duList usage for all directories and it’s content
du -sh[folder]Human redeable output of all files in directory
du -sHightlight entry of all specified file
du -sk* | sort -nrShows the list of folders and files, totaling the size including the subfolder
df -hCalculate total free disk space
df -HEasily calculate free disk space in powers of 1000
Files and Directory Management 
mkdir <dir>Create a new folder tagged as <dir>
mkdir -p <dir>/<dir>Allows to create nested folders
mkdir <dir1> <dir2> <dir3>Create multiple folders at once
mkdir “<dir>”Create a folder with a space right in the filename
rmdir <dir>Clear the folder
rm -R <dir>Clear the folder and it’s content
touch <file>Create a fresh file without any extension
cp <file><dir>Copy file to a folder
cp <file><newfile>Copy the file to a current folder
cp <file>~/<dir>/<newfile>Copy a file to a folder and rename the copied file
cp -R<dir><”new dir”>Copy a folder to a fresh folder with spaces in the filename
cp -i <file><dir>Prompts you before copying a file with spaces in the filename
cp <file1><file2><file3>/User/<dir>Copying several files to a folder at once
ditto -V[folder path][new folder]Copy-pasting the contents of a folder to new folder.
rm <file>Delete a file
rm -i<file>Clear out the file only when giving confirmation
rm -f<file>Remove the file without confirmation
rm<file1><file2><file3>Vanish out multiple files at once
mv <file><newfilename>Rename/move
mv <file><dir>Let you move a file to folder
mv -i <file><dir>Optional -i flag to warm you before overwriting the file
mv *.png ~/<dir>Move all PNG file from present folder to a different folder
Command History 
Ctrl + RGo through previously used command
history nTo see previously typed command
i[value]executes lastly run command typed that begin with a value
!!Runs last command typed
Is -ldShows the default permission for a home directory
Is -ld/<dir>Shows the read, write, and access permission for a particular folder
chmod 755<file>Modify the permission of a file to 755
chmod -R 600 <dir>Modify the permission of a folder to 600
chown <user>:<group><file>Modify the ownership of a file to a users group. Add -R to include folders content
ps -axOutput currently running processes
ps -auxHighlight all processes with %cpu, %mem, page in, PID, and command
topHighlights live information about currently running processes
top -ocpu -s 5Shows processes sorted by updating every 5 seconds, CPU usage
top -o rsizeSort by memory usage
kill PIDExit processes with ID<PID>
ps -ax | grep <appname>Find processes by PID and name
Ping <host>Ping host and display status
whois <domain>Output whois info for a domain
curl -O <url/to/file>Download file using http, https, or ftp
ssh <username>@<host>Create SSH connection to <host> with a <username>
scp <file><user>@<host>:/remote?pathCopy <file> to remote <host>
arp -aShows the list of devices on your local network.
iConfig en0Shows your device IP and Mac addresses
traceroute [hostname]Analyze the path along with hops traversed by the packets from your device to a destination address
brew doctorVerify brew for potential errors
brew helpList of useful homebrew cask and formula commands
brew install <formula>|cask>Install a cask or formula
brew uninstall <formula>|cask>Uninstall a formula or cask
brew list –caskShow only installed cask
brew list –formulaShows only installed formula
brew deps <formula>|<cask>Shows all dependencies of a formula or cask
brew search text|/regex/Search cask or formula via regex
brew upgrade <formula>|<cask>Upgrade cask or formula
brew outdated <formula>|<cask>Search for outdated cask or formula
brew outdated –caskSearch for outdated cask
insbrew pin [installed _formula]Pin a formula from getting upgraded
brew unpin [installed_formula]Unpin to upgrade a package
brew cleanupClear stale lock file and outdated packages for all formula and casks
Environment Variable or Path 
printenvHighlights a list of currently set environment variables. Also shows which shells you are using.
$echoCommands Terminal to print something and shows it to you
echo $PathVerify the value of the Path Variable which stores a list of directories along with executable files
echo $Path >path.txtExport the path directory to a text files
export PATH=$PATH:absolute/path to/program/Runs the program via terminal only in present session. If you use a program frequently, add the path to shell configuration file.
find <dir> -name <”file”>Search for all files named <file> inside <dir>. Use a wildcard (*) to inspect for parts of filenames.
grep “<text>” <file>Output all occurrences of <text> inside <file>
grep -rl “<text>” <dir>Look for files containing <text> inside <dir>
cat <file>Output the content of <file>
less <file>Output the content of <file> using the less command that supports pagination and more
head <file>Output the first 10 lines of <file>
<cmd>><file>Appends the output of <cmd> to <file>
<cmd>><file>Direct the output of <cmd> into <file>
<cmd1> | <cmd2>Direct output of <cmd1> to <cmd2>
Chaining Commands 
[command-a]; [command-b]Run command A then B, regardless of success of A
[command-a] && [command-b]Run command B if A is succeeded
[command-a] || [command-b]Run command B if A is failed
[command-a] &Run command A in background
PIPING Commands 
[command-a] | [command-b]Run command A and pass command to B
File Management 
touch [file]Create a new file
pwdFull path to working directory
pbpaste > [file]Paste clipboard content into file, pbpaste > paste-test.txt
pbpastPaste clipboard contents
pbcopy < [file]Copies file content to clipboards
mv [file] [new filename]Move/Rename
cp [file] [dir]Copy file to directory
cp [file] [newfile]Copy file to file

Final Thought!

So, this is the Mac terminal cheat sheet, which consumes some of the most useful commands on your Mac Terminal. There is massive number of Terminal commands, which is tough to remember—but fuss not; you need to remember some of them per your preferences.

Photo of author

Karly Wood

Karly Wood is a journalist based in Ohio who specializes in covering Apple and technology trends. With a varied experience in reporting on public safety, government, and education, her insights bridge multiple disciplines, providing readers with a well-rounded perspective on today's technological advancements. If you need to contact me, you can reach me at or through (Facebook)

Leave a Comment