Mac Terminal Commands Cheat Sheet

Mac Terminal is a wonderful tool to learn and use. If you’re new to using the command line, it can take some time to get familiar with the commands, and there are so many that even if you’re a long-time user, you may often forget some of them.

Sometimes I even need a reference sheet to remember some of them. Because of this, I have created a cheat sheet with some of the most used commands. We may not need this all the time, but it can help to have it handy whenever you get stuck trying to remember a command and how to use it.

I am Eric, and I have been a Software Engineer for over 25 years. Command line interfaces such as Mac Terminal are nothing new to me, and most of the time, I can remember the commands I need to use, but there are times when I need to look them up.

Whether you have the same problem as me or are new to using Mac Terminal, keep this page handy, and you can use it as a quick reference anytime you need help with some of the most common commands.


The cheat sheet below is meant to give you a quick overview of some of the most popular Mac Terminal commands. In most cases, I am not listing parameters or examples since this is meant to be used as a reference to get you to where you want to go. 

In some of the few cases where I do list a command with parameters, they are commands along with very commonly used parameters where it may be helpful to have the entire command.

When you need more information on a specific command just use the man command (shown below) to see the parameters you need to supply and get examples. It’s easy and convenient to use. From your Mac Terminal command line, just type man, the command name, and hit return.

man <command name>

It’s that easy! If that doesn’t work for you, I have also linked almost all of the commands to online man pages where you can get the same information.


To get started, I wanted to first show the man command. This is one of the most valuable commands because it can provide information on using any Mac Terminal commands on the fly. It often goes unused because we forget it is there. Get into the habit of using it and you will always have the information you need at your fingertips.

manCommand manual. Get information on what the command does, what parameters it has available, and examples of how to use it.


These are commands used to navigate or move around the system. Some, such as ls and pwd provide information on your location or path so that you can see where you are and where you want to go to.

cdChange directory, move to another path or directory location.
lsList or show the contents of the current directory.
ls -laList the contents of the directory in long form showing date, time, attributes, etc, and show all files, even hidden files.
ls -ltraList the contents of the directory in long form showing date, time, attributes, etc, and show all files, even hidden files. Sort the order of the files by date/time showing the most recent files at the end of the list.
pwd Print the current working directory. Show the current location or path.

File/Directory Manipulation

These commands are used to perform actions such as copying, creating, changing permissions, etc., on files and directories.

chmodChange the read/write/execute permissions of files or directories.
chownChange the ownership of files or directories.
cpCopy files or directories.
mkdir Create a directory.
mv Move or rename files or directories
rmRemove files or directories
rmdir Remove empty directories
touchCreate an empty file
vivimnanoEdit a file


These commands and operators (denoted as operators below) help you to output information and data to your screen from files or other commands.

> (operator)Direct the output of a command to a file. If the file already exists, overwrite that file with a new file.
>> (operator)Append the output of a command to an existing file. If the file does not already exist, create the file.
| (operator)Pipe or send the output of one command to the input of another command.
cat Display the contents of a file on the screen.
echoDisplay a message or the content of a variable on the screen.
headDisplay the first 10 lines of a file or files
lessDisplays the contents of a file on your screen one screen full screen at a time. It allows you to scroll up and down through the file.
moreDisplays the contents of a file on your screen one screen full at a time. It only allows you to scroll down through the file.
tailDisplay the last 10 lines of a file.


Everyone needs to search for a file or text within a file at some point. The commands below are very powerful and can be used for many things when it comes to searching and performing actions from the command line

findFind or search for a file or directory.
grepSearch for a string of text or pattern in a file or group of files.


These commands either display system information, set or modify it.

dfDisplay the amount of space available on a file system.
duEstimate the file space usage of a file system or group of files.
exportSet the export attribute of a variable, making it available in the environment.
killTerminate a process.
psDisplay the current processes running on the system.
topDisplay a real-time view of the running processes.


These commands provide information about your system’s network or transfer files or system information from one system to another.

curlTransfer data to or from a server.
ifconfigDisplay the status of network interfaces.
pingSend an echo request to a network host. A response will tell you that the host is up and running.
scpCopy files between hosts on a network.
sshLog into a remote machine or execute commands on a remote machine.
whoShow who is logged into the system


The commands below are related to your command line history. You can use them to run commands more efficiently, especially when there are commands that you repeat over and over again. The sudo command lets you run commands as a superuser or another user to avoid permission-denied errors.

historyDisplay a list of previous commands that have been executed from your command line.
arrow upDisplay the last command you have run on your command line. Pressing it multiple times will move back through the command history.
arrow downMove forward through the command history on your command line.
sudoExecute a command as a superuser or another user.
whoamiShow the current username you are using or working under.

Fun Commands

Here are just a few fun commands you should try when you are bored. 

sayConvert text to audible speech.
bannerCreate a banner.
slDisplay a train moving across your Terminal screen. For this, you will first need to install it with the command brew install sl.
ruby -e ‘C=`stty size`.scan(/\d+/)[1].to_i;S=[“2743”.to_i(16)].pack(“U*”);a={};puts “\033[2J”;loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print “\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H”};$stdout.flush;sleep 0.1}’Make it snow on your Terminal screen.


Below are a few common questions that about commands that you run from the Mac Terminal command line.

How do I know what parameters to supply to the commands?

This is a great question because most of the commands have multiple parameters that can be passed to them. Some are required, and others are optional. You can use the man command followed by the command you wish to learn about to get the details about them.

man <command name>

What is the most used command?

That is hard to say. It depends on the user and what kind of work they normally do. For me, I would say that the cd command is probably the one I use the most. Navigating around the file system requires that I type that one a lot as I find myself exploring the directories.

What if I don’t see the command I am looking for in the cheat sheet?

Mac Terminal’s command line interface is based on the UNIX/LINUX operating system, and there are hundreds of commands that you can use. I haven’t come close to listing all of them here, just some of the most used commands. If you are looking for more commands, you can do a Google search for UNIX or LINUX commands or check out this reference page for a good list.


Mac Terminal has many commands, and I cannot list all of them here, but above, I have listed some of the most important and most frequently used commands. I hope this list can help you as a reference to using the command line with Mac Terminal.

What commands do you use frequently? Are there any that I missed above that should go on this list? I would love to have your feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *