Alex Kaloostian

Apple Certified Master Trainer | Systems Integrator | Video Editor | Motion Graphics Artist

Command Line Basics – lesson 3 – man pages

2 Comments

Okay, in earlier lessons, I showed you how to use the uptime command, and the ls command, with and without options. But how did I know what those options were? -l, -a, -G, what the what? The answer, my friend is, RTFM!

Every command line command has an instruction manual included FREE, at NO EXTRA CHARGE! its easy, just type man, a space, and the command you want to know about. Like this:

man uptime

And press return. You will see something like this:

UPTIME(1) BSD General Commands Manual UPTIME(1)
NAME
 uptime -- show how long system has been running
SYNOPSIS
 uptime
DESCRIPTION
 The uptime utility displays the current time, the length of time the system has been up, the number of users, and the load average of the system over the last 1, 5,
 and 15 minutes.

And a bit more, but I’ve cut it for space. You get the idea. Exciting, right? That right there is the hottest writing since Twilight. Ahem. This is a basic one- some man pages are hundreds and hundreds of lines long.

Now, you probably have noticed something new. You don’t see the usual prompt, waiting for you to type a new command. And if you DO try a new command, things are going to get wonky. The commands we tried earlier were one-time commands: you run them, they run, and they’re done, nice and easy. A one-night stand, so to speak. But the man command sticks around. It stays open until you’re don’t with it.

How can you quit the man command and get back to the normal prompt? press q. (no period, just the letter q). If you’re ever stuck in some command, the q key will usually get you out. If not the q key, than control-c will do it. Thats a break command. q quits gracefully, control-c is more of a panic switch. And if you ever get REALLY stuck, just close the Terminal window and open a new one.

Lets try another man command, this one a bit longer.

man ls

A-hah! That’s how I learned all those options, like -a and -l. This is the man page for the ls command. See all those commands? And notice that they are case-sensitive? There’s -a and -A, -b and -B, -c and -C… you get the idea. Also, it’s a tad longer than the man page for uptime. In fact, it probably doesn’t nearly fit on your screen. Try scrolling.

Oops! Your mouse doesn’t work. It’s the command line, remember? This is old-skool unix, my friend. Back to the 60’s. Free love, and avocado colored kitchen appliances. Those brave men that went to the moon didn’t need a mouse, or fancy graphics. The command line was good enough for them, and it’s good enough for you!

Ahem. Sorry, got a little carried away there. Anyway, the mouse doesn’t work in the command line. To scroll down, use the down arrow key on your keyboard. To scroll up, yup, the up arrow. And when you’ve read enough, you can press q to quit.

So there you go, all the documentation you need. True, some man pages are, let’s say, dry. But they’re informative once you get used to reading them. And EVERY command has a man page… even the man command itself!

man man

That’s too funny. Till next time, l33t haxors!


							
Advertisements

Author: alexkaloostian

I'm a video editor, motion graphics designer and Mac IT consultant in the Boston area.

2 thoughts on “Command Line Basics – lesson 3 – man pages

  1. Pingback: Command Line Basics 4 – targets « Alex Kaloostian

  2. Pingback: Command Line Basics 7 – review time | Alex Kaloostian

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s