Skip to content

Terminal

ohrite edited this page Jan 4, 2013 · 6 revisions

Using Terminal.app

The fastest way to open applications in OSX is using Cmd+Space, which will open Spotlight. You might have installed another program like it, like Alfred or Quicksilver.

Type "term".

If you don't see it, just keep typing the rest of

Now hit Enter and a Terminal.app window will open.

Terminal Basics

Let's see what we have in our home directory with ls. Without any arguments, the ls command prints the contents of the current directory.

ls # this is short for

You might notice that this is the same as what Finder shows in our home directory.

Unix calls this "~", which is a single-character nickname for your home directory. If you ran ls ~, you would see the same output.

Showing the Current Directory

A lot of Unix commands rely on your being in the correct directory. Unix has a command called pwd to show what directory we're in. Let's use that now.

pwd # short for

Making a Directory

Let's make a workspace for our Rails projects using mkdir workspace.

mkdir workspace # short for

It didn't print anything out. If we run mkdir workspace again, it informs us that we've made the directory already.

mkdir workspace # the second one complains

Changing Directories

Changing directories is done with a command called cd. Let's go into our newly-created workspace directory using cd workspace. This won't print anything out, so do a pwd to see where we are.

cd workspace;pwd