Top 10 Mac Terminal Commands/Shortcuts You May Want to Know

Last updated: Nov 22, 2023
Summary: This post offers a list of the top 10 Mac Terminal commands and top 10 Mac Terminal shortcuts you may want to know and use.

macOS includes a free command-line tool named Terminal. You can execute commands in Terminal to open/uninstall apps, open/copy/move/delete files, etc. on your Mac. Below is a list of the top 10 Mac Terminal commands you may want to know. Some useful Mac Terminal shortcuts are also listed.

Mac Terminal commands

Top 10 Useful Mac Terminal Commands

To run Terminal commands on Mac, you need to open the Terminal app first. You can open it via Spotlight Search or go to Finder > Applications > Utilities > Terminal. Then you can run the popular Terminal commands listed below to perform various tasks.

ls command

You can type this command line in Terminal and press Enter. It will list the contents of the current directory. It will display the names of files and subdirectories in the directory.

cd command

Type the cd [directory path] command to change the directory path. For instance, cd /Applications, to change the current directory to Documents.

open [file]

Type the open [file name] command to open a file or app. For instance, open, open test.txt.

mkdir command, rmdir command

Type the mkdir [folder name] command to create a new folder. Type rmdir [folder name] if you want to delete an empty directory. Replace “folder name” in the command with the real name of the folder.

rm command, rm -r command

Type the rm [file name or folder name] command to delete a file or folder with Terminal.

Type rm -r [folder name] command to remove the entire directory that may contain subdirectories or files.

cp command

Type this command to copy a file from one location to another or create a copy of the file. For instance, cp test.txt ~/Documents/test.txt.

mv command

If you want to cut a file and move it to another location, you can use this command. For instance, mv ~/Desktop/test.txt ~/Documents/test.txt.

sudo command

Use the sudo command in Terminal to run commands with the administrator privileges. For instance, sudo rm -r [folder name].

diskutil command

You can run various diskutil commands in Terminal to manage your disks or partitions on your Mac.

clear command

Type the clear command in Mac Terminal and press Enter. It will remove all previous command lines and give you a clean Terminal screen. Optionally you can also press the Command + K shortcut to do the same operation.

If you want to view the detailed information of a Mac Terminal command, you can type man [command] and it will display a manual for the command. Replace "command" with the exact name of the command. Still, please note that running Terminal commands cannot be undone, and wrong commands may cause permanent data loss. If you are not familiar with Terminal commands, it’s not advised you use them.

Top 10 Useful Mac Terminal Shortcuts

Below we also list some useful keyboard shortcuts for Mac Terminal you may want to know.

  • Ctrl + A: Go to the beginning of the line you are typing.
  • Ctrl + E: Go to the end of the line you are typing.
  • Ctrl + W: Delete the word before the cursor.
  • Ctrl + K: Clear the line after the cursor.
  • Ctrl + U: Clear the line before the cursor.
  • Ctrl + L: Clear the screen.
  • Ctrl + C: Kill the current running process.
  • Ctrl + _: Undo the last command.
  • Ctrl + Y: Paste whatever was cut by the last command.
  • Ctrl + R: Search through previously used commands.

Use a Mac Cleaner Program to Keep Your Mac Clean

If you are a Mac user, you may install a Mac cleaner application to periodically scan and clean your Mac to keep your Mac running at the best performance.

BuhoCleaner is a professional Mac cleaner app that helps you boost your Mac’s performance from various aspects. You can use this tool to scan and remove junk data on your Mac in a flash. You can also use it to uninstall apps, delete files, shred files, manage startup items, analyze disk space, free up RAM, flush DNS, monitor system status, and more.

DownloadFor macOS 10.10 and above
100,000+ Satisfied Users Worldwide
Clean Up Mac with BuhoCleaner


This post lists some useful Mac Terminal commands and keyboard shortcuts for your reference. If you want, you can run Mac command lines to perform various tasks. Remember to use the commands with caution, especially commands like “rm” that can permanently delete files. Double-check before executing commands to avoid unexpected consequences.


Cassie has been writing about technology for her entire career life - over 10 years. She enjoys diving into how Apple products work and then breaking it down in a way that anyone can understand.