Unix shell commands are useful for working on remotely on servers and locally on Mac OS X. This manual uses the (mostly interchangeable) bash / zsh shells.

You’ll need an app to run shell commands. Macs come with Terminal, but I use iTerm with zsh (for nicer highlighting + git integration).

The shell can be a scary place. Start by introducing yourself.

# Identify the user


Hit (up arrow) to cycle through your prior commands.

Type !! to paste the last command:

# Pretend this command failed due to permissions
something something

# This will inject your last line and reset the prompt
sudo !!

# Now the prompt combines the former two lines, hit enter to run it
sudo something something