Tucked away inside your Utilities folder, which lives inside the Applications folder on your Mac, is OS X's terminal window. If you grew up using DOS machines, you'll find it somewhat familiar - there's a black and white screen, some arcane text telling you that it's your machine, and a tiny blinking cursor.
That's where the similarity ends. The OS X terminal isn't DOS and, although some of the commands are similar, they generally won't work. Instead, the terminal is a window into the UNIX nuts and bolts that underpin OS X. The average OS X user shouldn't ever need to venture anywhere near the command line interface, but since you're not the average OS X user, it's probably time to have a rummage.
Finding your way around
First, there's no way around it: you're going to have to learn some basic UNIX commands. Fire up the terminal and you'll be greeted with 'Welcome to Darwin!' followed by the name of your computer (you entered this when you were setting up OS X) and then your short username followed by a $. This is your parent directory. Everything owned by you is splayed out underneath this directory in a series of branches. The easiest way to think about this is imagining your username as the trunk, and then each folder (or directory) as a major branch. All OS X users have the same initial branches, including desktop, music and documents.
You want to have a look at these branches using the terminal (and, yes, we all know you can do this much more easily through the Finder!). At the prompt, type in cd documents. You'll now see that your username has been replaced by the 'documents'. To have a look at what's inside that Documents folder just type ls, which stands for 'list' and will bring up a complete list of everything that's inside your documents folder.
From here, it's possible to modify and move anything within the folders that your username has rights to access. To return to the top of the tree, just type cd .. and you'll be back at your user directory.
When you're finished with jumping in and out of directories and generally moving around, it's time for something more interesting.
Disk repair
OS X has a pretty good disk repair utility that lives in the same directory as the terminal. This utility uses a command line tool called fsck-hfs to do its maintenance work on your hard drive. It also runs during automatic reboots, checking that the integrity of your hard drive hasn't been compromised.
To take a quick look at this command line utility, simply type fsck_hfs at the command line. This will provide a list of terms you can use to modify the way that the repair tool operates. This is where things start getting tricky, and we don't recommend that you spend too much time (at the moment) trying to run disk repair from the command line. It is, however, worth knowing that it's there, and understanding that behind OS X's pretty interface, tools like fsck-hfs are how things get done.
Uptime
Crashing was a fact of life under OS 9. Simply having a Classic machine that actually ran all day was a feat. OS X is the model of stability, and some people report that they've only shut down their machine when it's come time to update software. There isn't a pretty way to find out how long your machine's been up and running, but it's a snap from the command line. Simply enter the term uptime and you'll get a measure of how long your computer's been up. (The screen shot) shows that mine was up for only three hours, due to a software update session), as well as the number of users and a snapshot of how hard your computer's been working as a percentage of CPU load.
If that's not enough information for you, and you want to look super geeky in front of your Mac-mates, try using the top -u command, which continually updates the number of processes your machine is running. These could be user programs like iTunes, or machine processes like the Finder or the Aqua user interface. It will also show the percentage of the CPU that these processes are using, the amount of memory being accessed, and the amount of virtual memory being used.
Getting access to all this information, which is also available through an appli-cation called Process Viewer in the Utilities folder, is as easy as entering top -u at the command line. For the complete geek-in-charge look, drag the terminal window over to one side of your screen and let it update while you work.












18%
9%




















Comments
Post new comment