Laughing at Linux: Command Line Basics (Part 3 of 5)

Okay, let’s be honest here.  What’s the first thing you do when you you see a recondite error in Windows?

No, no, no… I mean after you’ve uttered every curse word listed in

You Google it right?

I’m here to tell you that Linux is better than Windows when it comes to getting help.

One of the nicest things about Linux is that there are so many built-in ways to get help.  You don’t have to Google anything.  Linux ships with its very own library of tools to console your aching heart.

Today you’re going to learn the following Linux options and commands:

  1. –help
  2. man
  3. info
  4. apropos
  5. whatis
  6. whereis
  7. less

Let me –help you do this man!  I’ve got a bunch of apropos info that will make you less frustrated.  You’ll even learn whatis the purpose of these commands and whereis the best place to find them!

Check it out!

In my previous tutorial on using Linux, we touched on variables and filters but today we’re going to take a step back to show you how to get help on demand.  And the best part?  You don’t even need the internet to do it.

The easiest way to get help in Linux is to simply add a little --help suffix after a command.

–help me Vonnie!

Let’s start with ls.

ls --help

Getting help on ls in Linux

I know what you’re thinking:

What the heck is all this stuff on the screen mean?

Just hold on one second.  I think most people have a propensity to ignore large volumes of text.  When you see a screenfull of text in Linux your first thought isn’t “yes! let me read this like a good book”

Yes, your contention has some merit but stay with me here.

If you look at the --help option you can see it gives you a concise explanation that should mollify your curiosity.   There are even a boatload of options you can use.

Notice the first one says:

-a, --all  do not ignore entries starting with .

That dot isn’t a typo.  This means if you typed ls -a or ls --all it would list all files including those that start with a . (period)  This is significant because files starting with periods are “hidden” be default.  In Windows, you can give any fileinvisibility powers by simply right clicking it, going to Properties and choosing the Hidden attribute.  In Linux it’s a little different.

If I had two files in the same directory:




and I typed ls, only the first file would show up.  I wouldn’t see the second one until I add the -a qualifier.

Here’s the –help option on another command cat.

Despite what it looks like, typing cat --help has nothing to do with getting the latest veterinary tips for you favorite feline.

Linux cat help

You can see that cat is the abridged form of concatenate which means you can use it to link bits of text together so you can read them.  It’s the de-facto method of reading text files in Linux.

help me man!

man oh man.  man is one of the best linux commands to hit up when you’re bored on a friday night, with a box of cold pizza, a few mountain dews.  Hahaha.  No, I’m kidding.  If I ever catch you reading the Linux man pages for fun I’ll grab a slice of that cheap pizza and slap you over the head with it.

man is short for manual.  Linux actually ships with an integrated manual which lets you get the 411 on almost any command.  man is like the Wikipedia for Linux help; the Encyclopedia Britannica for getting everything you need about a command.MAN cat

Mash the spacebar to breeze through voluminous data about the command you search for or just press the up and down arrows to inch around one line at a time.

Without man Linux would be impossible to use.

I know that sounds sexist but when you  really get to know Linux you can start sprouting geeky jokes like that one.

Wait, let me just try this one thing:

man woman

Linux man woman

Ooops, it looks like Linux can’t help you get the secret formula for figuring out the female mind.

A lesser known command with similar functionality to man is the modest info command.  Linux linguists will tell you that no one uses the info command.  Info sminfo… you now know it exists so don’t be afraid to give it a shot.

Try it out on ls, cat, and history for starters.

cat info in linux

info is just another window Linux gives you into its language of love.

How do you pronounce apropos?

Pronounced “app – proh – poh”, if you ever here someone say:

Wow, I said crash and the first thought that entered your mind was Windows Vista; how apropos!

In Linux land apropos is a command that lets you search all man pages for a specific keyword.   It returns the Linux command that contains the word after apropos somewhere in the man page.

So let’s say you wanted to find a command that lets you hide stuff.  Where can you start?

Start with apropos.

apropos hide

apropos in linux

whatis vs whereis

What is whatis Trebek?

When you don’t have time to read a million page man or info page whatis has got your back.

Just type whatis and your command and you’ll get a one liner explanation on what the command does.

Whatis in Linux

Short and sweet.

Whereis is whatis’s little sister.  It will show you where the command binary lives on the Linux filesystem.  So in Windows you might click the Start button and type cmd.exe.  If you right click it you can choose “Open file location” you can see where the file lives.

Windows 8.1 open file location

whereis is the same thing for Linux.

Check this out:

whereis ls

whereis ls

This means the ls binary (executable in Window speak) lives in /bin as a file named ls. (Linux files don’t need extensions)

less is more than more

This is an old Linux joke that made me laugh a little the first time I understood it.

Here’s the story: once upon a time, Linux had two commands: more and less.  The more command came first and was an easy way to scroll through large sets of text.  But then a few years later the less command was introduced which included additional functionality.  For example, less allowed users to scroll back up the screen (rather than from just top to bottom)

Let’s say you ran the cat command but the screen simply had too much output.  If you slapped on a “| less” modifier you could slow things down one screen at a time.  That little “|” thing usually lives next to your backspace and enter keys.

For example:

cat /etc/passwd | less

Prints the contents of a file called passwd and lets you use the up and down arrow keys to go up and down the file.

The Bottom Line

Linux is replete with built in help commands so there’s no reason to despair.

  • Need to find a command to perform a quick task?  Just use apropos.
  • Need quickly figure out what a command does?  whatis is all you need.
  • Trying to dig in a little deeper on the all your options? man and info are a great pair to get you going.
  • Too much text? Use less.
  • And as always don’t forget about the –help suffix.

Connect with Vonnie on Twitter

Posted in Linux Tagged with: