Skip to main content

Mac Shortcuts

·2661 words·13 mins·
Mac Utils
Table of Contents

In this article I will consolidate several useful shortcuts for Mac

Intro
#

In this article I will consolidate several useful shortcuts for Mac

Mac Shortcuts
#

Startup
#

ActionShortcut
Boot without automatic loginLeft shift (Press and hold when macOS progress indicator appears)
Boot in Safe Mode (Intel)Shift (Press and hold)
Boot in Safe Mode (Apple Silicon)Power (Press and hold), then select a volume, then hold Shift while clicking Continue in Safe Mode
Boot in Single User Mode (Intel, unavailable in macOS Mojave and later)Cmd + S
Boot in Verbose Mode (Intel)Cmd + V
Boot in Target Disk Mode (Intel)T
Boot from a NetBoot network serverN
Boot to Startup Manager (Intel)Option
Boot to Startup Manager (Apple Silicon)Power
Load macOS Recovery (Intel)Cmd + R
Load macOS Recovery over the internet (Intel)Option + Cmd + R
Load macOS Recovery (Apple Silicon)Power, then select Options, then click Continue
Enter Apple Diagnostics (Intel)D
Enter Apple Diagnostics (Apple Silicon)Cmd + D
Load Apple Diagnostics over the internetOption + D
Reset NVRAM or PRAM (Intel, unnecessary on Apple Silicon Macs)Option + Cmd + P + R
Eject removable mediaF12

Finder
#

ActionShortcut
Rename selected file or folderEnter
Duplicate selected file or folderCmd + D
Create a new folderShift + Cmd + N
Create a new Smart FolderOption + Cmd + N
Create a new folder from selected file(s)Control + Cmd + N
Make an alias for the itemControl + Cmd + A
Move selected item(s) to the TrashCmd + Delete
Delete selected item(s) immediatelyOption + Cmd + Delete
Empty the TrashCmd + Shift + Delete
Empty the Trash immediatelyOption + Cmd + Shift + Delete
Preview selected file(s) with Quick Look in a windowSpace
Preview selected file(s) with Quick Look in fullscreen modeOption + Space
Start a slideshow using selected item(s)Control + Space
Go to folderCmd + Shift + G
Connect to serverCmd + K
Move up one folderCmd + Up arrow
Move down one folderCmd + Down arrow
Eject selected volumeCmd + E
Get infoCmd + I
Show Attributes InspectorOption + Cmd + I
Open a new Finder windowCmd + N
Close active Finder windowShift + Cmd + N
Cycle through windowsCmd + <
Open a new Finder tabCmd + T
Close active Finder tabCmd + W
View optionsCmd + J
Icon viewCmd + 1
List viewCmd + 2
Column viewCmd + 3
Gallery viewCmd + 4
Hide all Finder windowsCmd + H
Hide all other windows except FinderOption + Cmd + H
SearchCmd + F
Open a Computer windowCmd + Shift + C
Open the Recents folderCmd + Shift + F
Open the Documents folderCmd + Shift + O
Open the Desktop folderCmd + Shift + D
Open the Downloads folderOption + Cmd + L
Open your account’s home folderCmd + Shift + H
Open an AirDrop windowCmd + Shift + R
Open the network browserCmd + Shift + K
Open your iCloud DriveCmd + Shift + I
Open your public shared folderCmd + Shift + S
Open the Applications folderCmd + Shift + A
Open the Utilities folderCmd + Shift + U
Show/hide the Finder sidebarCmd + Control + S
Show/hide the Path BarOption + Cmd + P
Show/hide the Status BarOption + Cmd + / (Slash)

Document
#

ActionShortcut
Bold textCmd + B
Italicize textCmd + I
Underline textCmd + U
Scroll one page upFn + Up arrow
Scroll one page downFn + Down arrow
Jump to the beginning of the documentFn + Left arrow
Jump to the end of the documentFn + Right arrow

General
#

ActionShortcut
Display the macOS screenshotting toolsCmd + 5
Take a screenshot of the entire screenShift + Cmd + 3
Take a screenshot of a portion of the screenShift + Cmd + 4 (then hold Space to drag the selection, if needed)
Take a screenshot of a specific window or menuCmd + Shift + 4, then Space
Select allCmd + A
Select multiple non-contiguous item(s)Cmd + Left click
Select multiple adjacent item(s)Shift + Left click
Hide current windowCmd + H
Hide all other windowsOption + Cmd + H
Minimize the current windowCmd + M
Minimize all windowsOption + Cmd + M
Close current windowCmd + W
Close all windowsOption + Cmd + W
OpenCmd + O
SaveCmd + S
PrintCmd + P
FindCmd + F
Find and replaceOption + Cmd + F
CopyCmd + C
PasteCmd + V
Paste and delete original itemsOption + Cmd + V
Paste and match styleShift + Option + Cmd + V
UndoCmd + Z
RedoShift + Cmd + Z
Zoom inCmd + + (Plus)
Zoom outCmd + - (Minus)
Access in-app helpCmd + ?
Open preferences for the current appCmd + , (Comma)
Open Spotlight searchCmd + Space
Hide/show the DockOption + Cmd + D
Show the Character ViewerControl + Cmd + Space
Show the emoji pickerFn
Show desktop icons as stacksCmd + Control + 0
Switch the current app to fullscreen modeControl + Cmd + F
Switch to the next open appCmd + Tab
Switch to the previous open appShift + Cmd + Tab
Quit the selected app in the app switcherCmd + Shift, then Q
Force quit appsOption + Cmd + Esc
Switch to the next window in the current appCmd + ~ (Tilde)
Lock the screenCmd + Control + Q
Log outShift + Cmd + Q
Log out without confirmationOption + Shift + Cmd + Q
Put display(s) to sleepShift + Control + Eject
Put your computer to sleepOption + Cmd + Eject
Quit all apps and restartControl + Cmd + Eject
Quit all apps and shut downControl + Option + Cmd + Power
Choose from Sleep, Restart, and Shutdown optionsControl + Eject

The Mac Terminal Cheat Sheet
#

Keyboard Shortcuts
#

COMMANDACTION
TabAuto-complete file and folder names
Cmd+ FFind instances of specific text in the Terminal
Ctrl + AGo to the beginning of the line you’re currently typing on
Cmd + ASelect everything in the Terminal
Cmd + PPrint Terminal inputs and outputs
Ctrl + EGo to the end of the line you’re currently typing on
Ctrl + UClear the line before the cursor
Ctrl + KClear the line after the cursor
Ctrl + WDelete the word before the cursor
Ctrl + TSwap the last two characters before the cursor
Esc + TSwap the last two words before the cursor
Ctrl + LClear the screen
Ctrl + CKill whatever you’re running
Ctrl + DExit the current shell
Option + →Move the cursor one word forward
Option + ←Move the cursor one word backward
Ctrl + FMove the cursor one character forward
Ctrl + BMove the cursor one character backward
Ctrl + YPaste whatever was cut by the last command
Ctrl + ZPuts whatever you’re running into a suspended background process
Ctrl + _Undo the last command
Option + Shift + Cmd + CCopy plain text
Shift + Cmd + VPaste the selection
exitEnd a shell session

Basics
#

COMMANDACTION
/ (Forward Slash)Top-level directory
. (Single Period)Current directory
.. (Double Period)Parent directory
~ (Tilde)Home directory
sudo [command]Run command with the security privileges of the super user
nano [file]Opens the Terminal editor
open [file]Opens a file
[command] -hGet help about a command
man [command]Show the help manual of the command

Change Directory
#

COMMANDACTION
cdHome directory
cd [folder]Change directory, e.g. cd Documents
cd ~Home directory
cd /Root of the drive
cd -Previous directory or folder you last browsed
pwdShow your working directory
cd..Move up to the parent directory
cd../..Move up two levels

List Directory Contents
#

COMMANDACTION
lsDisplay the name of files and subdirectories in the directory
ls -CForce multi-column output of the listing
ls -aList all entries including those with .(period) and ..(double period)
ls -1Output the list of files in one entry per line format
ls -FDisplay a / (slash) immediately after each path that is a directory, * (asterisk) after executable programs or scripts, and @ after a symbolic link
ls -SSort files or entries by size
ls -lList in a long format. Includes file mode, owner and group name, date and time file was modified, pathname, and more
ls -l /List of the file system from root with symbolic links
ls -ltList the files sorted by time modified (most recent first)
ls -lhLong listing with human readable file sizes in KB, MB, or GB
ls -loList the file names with size, owner, and flags
ls -laList detailed directory contents, including hidden files

File Size and Disk Space
#

COMMANDACTION
duList usage for each subdirectory and its contents
du -sh [folder]Human readable output of all files in a directory
du -sDisplay an entry for each specified file
df -hCalculate your system’s free disk space
df -HCalculate free disk space in powers of 1,000 (as opposed to 1,024)

File and Directory Management
#

COMMANDACTION
mkdir dirCreate a new folder named dir
mkdir -p dir/dirCreate nested folders
mkdir dir1 dir2 dir3Create several folders at once
mkdir “dir”Create a folder with a space in the filename
rmdir dirDelete a folder (only works on empty folders)
rm -R dirDelete a folder and its contents
touch fileCreate a new file without any extension
cp file dirCopy a file to the folder
cp file newfileCopy a file to the current folder
cp file~/dir/newfileCopy a file to the folder and rename the copied file
cp -R dir <“new dir”>Copy a folder to a new folder with spaces in the filename
cp -i file dirPrompts you before copying a file with a warning overwrite message
cp file1 file2 file3/Users/dirCopy multiple files to a folder
ditto -V [folder path][new folder]Copy the contents of a folder to a new folder. Here “-V” prints a line of status for every file copied
rm fileDelete a file (This deletes the file permanently; use it with caution.)
rm -i fileDelete a file only when you give confirmation
rm -f fileForce removal without confirmation
rm file1 file2 file3Delete multiple files without any confirmation
mv file newfilenameMove/rename
mv file dirMove a file to the folder, possibly by overwriting an existing file
mv -i file dirOptional -i flag to warn you before overwriting the file
mv *.png ~/dirMove all PNG files from the current folder to a different folder

Command History
#

COMMANDACTION
Ctrl + RSearch through previously used commands
history nShows the previous commands you’ve typed. Add a number to limit to the last n items
![value]Execute the last command typed that starts with a value
!!Execute the last command typed

Permissions
#

COMMANDACTION
ls -ldDisplay the default permission for a home directory
ls -ld/dirDisplay the read, write, and access permission of a particular folder
chmod 755 fileChange the permission of a file to 755
chmod -R 600 dirChange the permission of a folder (and its contents) to 600
chown user:group fileChange the ownership of a file to user and group. Add -R to include folder contents

Processes
#

COMMANDACTION
ps -axOutput currently running processes. Here, a shows processes from all users and x shows processes that are not connected with Terminal
ps -auxShows all the processes with %cpu, %mem, page in, PID, and command
topDisplay live information about currently running processes
top -ocpu -s 5Display processes sorted by CPU usage, updating every 5 seconds
top -o rsizeSort top by memory usage
kill PIDQuit process with ID PID. You’ll see PID as a column in the Activity Monitor

Network
#

COMMANDACTION
ping hostPing the host and display the status
whois domainOutput whois info for a domain
curl -O url/to/fileDownload a file via HTTP, HTTPS, or FTP
ssh username@hostEstablish SSH connection to host with user username
scp fileuser@host:/remote/pathCopy file to a remote host
arp -aView a list of all devices on your local network. It will show you the IP and MAC address of all the devices
ifconfig en0View your device IP and MAC address
traceroute [hostname]Identify the path and the hops traversed by the packets from your device to the destination address

Homebrew
#

COMMANDACTION
brew doctorCheck brew for potential problems
brew helpList of useful homebrew formula and cask commands
brew install formulaInstall a formula or cask
brew uninstall formulaUninstall a formula or cask
brew list –formulaList only installed formulas
brew list –caskList only installed cask
brew deps formulaList all the dependencies of a formula or cask
brew search textSearch formula or cask through regex
brew upgrade formulaUpgrade the formula or cask
brew outdated formulaSearch for outdated formula or cask
brew outdated –formulaSearch for outdated formula
brew outdated –caskSearch for outdated cask
brew pin [installed_formula]Pin a formula from getting upgraded
brew unpin [installed_formula]Unpin to upgrade a package
brew cleanupRemove stale lock files and outdated packages for all formulas and casks

Environment
#

COMMANDACTION
printenvDisplay a list of currently set environment variables. Also tells you which shell you’re using
$echoAsk Terminal to print something and show it to you
echo $PATHCheck the value of the PATH variable, which stores a list of directories with executable files
echo $PATH >path.txtExport the path directory to a text file
export PATH=$PATH:absolute/path to/program/Execute a program via Terminal only in your current session. If you use a program regularly, add the path to the shell configuration file.

Search#

COMMANDACTION
find dir -name “file”Find all files named file inside dir. Use wildcards (*) to search for parts of filenames
find dir -size +sizeFind all files larger than size in dir
find dir -size -sizeFind all files less than size in dir
grep “text” fileOutput all occurrences of text inside file (add -i for case insensitivity)
grep -rl “text” dirSearch for all files containing text inside dir

Output
#

COMMANDACTION
cat fileOutput the content of file
less fileOutput the contents of file using the less command that supports pagination and more
head fileOutput the first 10 lines of file
cmd < fileUse file contents as input to cmd
cmd > > fileAppends the output of cmd to file
cmd > fileDirect the output of cmd into file

Terminal Windows
#

COMMANDACTION
Cmd + NOpen a new Terminal window
Cmd + TOpen a new Terminal tab
Cmd + DSplit the Terminal window into two panes
Cmd + tab numberSwitch from one Terminal tab to another
Cmd + Page UpScroll one page up the Terminal window
Cmd + Page DownScroll one page down the Terminal window
Cmd + WClose a Terminal tab
Option + Shift + Cmd + WClose all Terminal tabs

Mac Commands
#

The following page provides information on available Mac commands:

Reference
#