Using the OS X Terminal

Inspired by and following on from a useful article on iMore, here are a few more tips on how to use the Terminal — if you ever need to:

– Press Tab to autocomplete a path.
– Use Option-left and right arrows to move the cursor by word (this didn’t use to work but does now).
– Use up and down arrows to go back through your previous commands (all the way back to previous sessions).
– “sudo su” if you’re going to do a few things as the superuser.
– Dragging in files from the Finder to type their path is very handy.
– You need to escape spaces in filenames with , as in “My File”.
– It’s written in the article already, but recommended to always use “ls -la” to show all permissions and hidden files.
– “top” is the Terminal equivalent of Activity Monitor, handy for discovering process IDs.
– “kill -9” if something just won’t die.
– When navigating, ~ means your home directory, and / means root.
– Whatever you do, DO NOT type “rm -r /*” because it wipes everything — at least, the files you have permission to.
– The “more” app is a good way to read longer text files.
– “chmod” for changing permissions.
– “dig” or “nslookup” for checking out websites.
– “vi” is a basic, powerful text editor, and knowing its basic commands can get you out of some sticky situations — but it’s weird.