Intro

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.

Identity

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

# Identify the user
whoami

Say what?

The shell can talk back too:

# Identify the user
say Welcome to the jungle

Re-using commands

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