Random Access   chris, kp & rob
Tech Take-Apart
Mac OS X - Learning the Terminal
by kp

The Mac OS X Terminal gives you access to the core UNIX shell to perform a myriad of tasks from creating new directories to checking system statistics. These commands are fairly simple to learn and execute by following a few rules. The first rule to know is that these commands are case-sensitive, so it is important to check your commands to achieve the right output. The second rule is that each command is followed by a single return. In the following examples, the command output is shown below the command syntax.

To start,  open the Terminal program that can be found under Applications -> Utilities -> Terminal. By default, the Terminal displays the current log-in date and the computer and user name. After the prompt, commands are entered followed by the return key. Let's start by getting familiar with the Mac's directory. In the Terminal, type:
ls -F
This command will list all of your Mac's current directories.

To get more information, try a variation of the ls command using:
ls -l

Here the Terminal displays your Mac's directories along with stats. Permissions designated for each user are defined by the letters r, w, x. They stand for read (r), write (w), or execute (x). In reference to permissions, you can even launch the Disk Utility program from the Terminal to repair permissions by entering:
sudo diskutil repairPermissions /

For information on your system, enter the following command:
This displays free disk space on your Mac's hard drive.

Other commands include:
netstat - displays networking information on your system
top - to show current processes running on your system.

For information on the system's users, several commands return similar results. Here is an example of the finger command that requests information on a specific user:
finger username

Or, you can also use who or just w to get user details.

Need to find a file? The find command is a little tricky, because you can customize your search using a specific variable or a wildcard character such as *. In this example, I am searching for files that start with any name, but must end in a  ".doc" extension.
find ~ -name "*.doc"
The tilde is included with the command between find and -name.

By this point, your Terminal window may be getting cluttered. To clear the window, enter clear to start over.

Here are a few more commands that are may be helpful:
This displays the days of the current month. For the current date and time, try entering date.

To look up a command function, type in whatis commandname.
whatis df

Another option is to access the manual pages, known as the man pages, by using the following format to search via keyword:
man -k keyword

To end your session, type exit after the prompt. For a more tips and tricks on using UNIX commands in OS X, check out Visual QuickPro Guide to UNIX for Mac OS X.

Apple Mac OS X Unix
Unix for Mac OS X 10.4 Visual QuickPro Guide Second Edition

Get Random Access

Understanding Tech

Print this article

Shop Online


Your Name:

Your Email:

Your Friend's Name:

Your Friend's Email:

 © Micro Center