- Amazon is selling the M4 Mac Mini at an all-time low price (and I don't expect it to last)
- How new Facebook policies incentivize spreading misinformation
- Is your live TV streaming service still worth it? I review the options for every budget
- 見逃せない!パブリッククラウドの思わぬ落とし穴
- What to expect at Amazon's event this week: Alexa 2.0, new Echos, and Fire TV upgrades
The first 5 MacOS commands every user should learn

Because I’ve been using Linux for such a long time, the command line is second nature to me. I know which commands I need in order to do certain things — and they never fail. That’s one of the reasons why I decided using the command line in MacOS made sense too. After all, the MacOS and Linux CLI (command-line interface) are quite similar.
Also: How to format USB drives on Linux, MacOS, and Windows
But if you’re new to the practice of running commands, you probably have no idea where to start. That’s where I come in. Allow me to introduce you to five commands that not only will serve you well but aren’t even remotely hard to use.
And with that, let’s dive into the commands.
1. Available free space
When you want to find out how much space is left on your hard drive (or multiple drives, if you have them attached), you could always go to System Settings, search for Storage, and then allow the GUI to calculate the available free space. Or, you could open the terminal app and issue a single command that will display how much free space is available on all attached drives. The command in question is df, which displays free disk space. You can view the free space on all of your drives by issuing the command like this:
My favorite way of using df is in human-readable format. When you use df without options, it will display the results in blocks, which can be very confusing. Instead, use the command:
This will present the output in GB, which is much easier to understand.
2. Killing a rogue app
It might be a rare occasion, but sometimes an app goes rogue and refuses to close. Sure, you could always use the Force Quit tool (from the Apple menu in the top bar). Or, you could use the kill command. I’ve had one instance where the MacOS GUI refused to respond. Instead of doing a hard restart, I used SSH to log into the machine, locate the problematic app, kill it from the command line, and my GUI came back to me.
Also: This app makes using Ollama local AI on MacOS devices so easy
Before you can kill the app, however, you must first locate its PID (process ID). To do that, issue the command:
Where NAME is the name of the app (such as Safari).
Once you have the PID, you can kill the rogue app with the command:
Where PID is the PID of the app in question.
3. Open a file
Did you know you can open a file from the command line? Not only can you open a file, but using this command will open the file in the correct application. For example, if you have a document that you want to open in Pages, this command will do it. When you use this command, it’s as if you’re double-clicking the file in Finder.
Also: 5 Linux commands you need to know to troubleshoot problems
How do you do it? You first have to navigate into the folder housing the file. Say your file (we’ll call it zdnet.docx) is in Documents. Open the terminal app and issue the command cd ~/Documents. Once there, you can open that file with the command:
Whatever default application you have set to open docx files will launch and you’re ready to work. If you want to open a file with a non-default application, you can do so using the -a option. For example, you might have both Apple Pages and LibreOffice Writer installed and you want to open the document with Writer. For that, you could issue the command:
open -a LibreOffice.app zdnet.docx
4. Restart your machine
Have you ever found your iMac or MacBook refusing to restart? I have, and it can be frustrating. Fortunately, there’s a simple command you can use to force a restart. One thing to keep in mind, however, is that this command requires the elevated privileges that come with sudo (which stands for superuser do). When you use sudo, you will be prompted to type your user password. Only after successfully typing your user password will the command in question run.
Also: How I changed my default apps in MacOS – and you can too, in seconds
The command to force a reboot is:
After typing your user password, the machine will reboot.
5. Learn about a command
Finally, this little doozy of a command will come in very handy as you navigate the CLI. The man command allows you to read the manual pages for each command. For instance, say you want to learn more about the reboot command. For that, you could issue the command:
Also: 6 features I wish MacOS would copy from Linux
The manual page will open and you can scroll through it, learning all there is to know about the command. Nearly every command on your MacOS machine will have a manual page. You can even read the manual page for the man command, which would be:
And there you have it, my friends: the first five commands I believe every MacOS user should learn. That doesn’t mean you have to learn them. But if you want to get the most out of the operating system, this is a great place to start.
First off, Spotlight Search does not allow you to run commands (although you can search for information about a specific command). While both can help you find files, directories, or commands on your Mac, Spotlight Search uses a more advanced algorithm to search for matches. For command-line-specific searches, use Ctrl + K in Terminal.
You can open the Terminal app by navigating to Applications > Utilities and selecting Terminal.app from the list. Alternatively, you can press Command + Space, type “Terminal,” and select it from the Spotlight search results.
The tilde (~) symbol refers to your home directory (such as /users/olivia). For example, ~/Documents/ refers to the Documents folder inside your home directory.
Run chsh -s /bin/bash (or any other desired shell) to switch to a new shell. Note that you’ll need administrative privileges or use an existing admin account to make this change.
Yes, but be cautious when doing so! Use rm -i FILE (where FILE is the name of the file to be deleted) for interactive confirmation of file deletion. Without the -i option, the file will simply be deleted without asking.
These files contain configuration settings necessary for your shell. The most common shell used on MacOS, Bash (not zsh), loads ~/.bashrc at login time by default.
Yes! This command navigates directly into the contents of your home folder. You can also simply use the command cd, which will take you to your home. You can also use that notion to move into a child folder found in home. For example, if you want to move to your Documents folder, you could type cd ~/Documents.
Use commands like mkdir -m 755 NAME (where NAME is the name of the file or directory) or chmod +x /usr/bin/NAME. For more advanced permission settings, consult the MacOS file system documentation.
Yes, here are four:
- Pressing Tab in a terminal prompt can complete common directory paths.
- The -R flag with many commands (like rm, find) will recursively apply those actions to all subfolders.
- To see a list of files and directories, use the command ls -a.
- Use your keyboard’s up or down arrows to navigate through your command history.