SEARCH

How-To Geek

How to Get Help With a Command from the Linux Terminal: 8 Tricks for Beginners & Pros Alike

linux terminal help header

Whether you’re an inexperienced terminal user or a grizzled veteran, you won’t always know the right thing to type into the Linux terminal. There are quite a few tools built into the terminal to help you along.

These tricks will help you find the command to use, figure out how to install it, learn how to use it, and view detailed information about it. None of these tricks require an Internet connection.

-h or –help

If you’re not sure how to use a specific command, run the command with the -h or –help switches. You’ll see usage information and a list of options you can use with the command. For example, if you want to know how to use the wget command, type wget –help or wget -h.

help option

This will often print a lot of information to the terminal, which can be inconvenient to scroll through. To read the output more easily, you can pipe it through the less command, which allows you to scroll through it with the arrow keys on your keyboard. For example, use the following command to pipe wget’s help output through less:

wget –help | less

help less

Press q to close the less utility when you’re done.

To find a specific option, you can pipe the output through the grep command. For example, use the following command to search for options that contain the word “proxy”:

wget –help | grep proxy

help grep

Tab Completion

If you’re not sure about a specific command’s name, an option, or a file name, you can use tab completion to help. Let’s say we want to run a command that we know starts with gnome-session, but we don’t know its exact name. We can type gnome-session into the terminal and press Tab twice to view commands that match the name.

tab completion

Once we see the command, option, or file name we want, we can type a few more letters and press the Tab key again. If only one match is available, the Bash shell will fill it in for you. Tab completion is also a great way to save on keystrokes, even if you know what you want to type.

Command Not Found

If you know the command you want to use, but don’t know the package that contains it, you can type the command into the terminal anyway. Ubuntu will tell you the package that contains the command and show you the command you can use to install it.

Let’s say we wanted to use the rotate command to rotate an image. We could just type rotate into the terminal and Ubuntu would tell us that we have to install the jigl package to get this command.

command not found

This feature was introduced by Ubuntu, and may have made its way into other Linux distributions. Traditionally, the shell displayed an unhelpful “command not found” message without any additional information.

help

The help command shows a short list of the commands built into the Bash shell itself.

help

man

The man command shows detailed manuals for each command. These are referred to as “man pages.” For example, if you wanted to view the man page for the wget command, you’d type man wget. Man pages generally contain much more detailed information than you’ll get with the -h or –help options

man

Type man intro to see a detailed introduction to using the shell on Linux.

man intro

To search a man page, type a /, followed by your query, and press Enter. For example, to search a man page for the word shell, type /shell while reading the man page and press Enter.

man page search

info

Some programs don’t have man pages – or have very incomplete man pages – and store their documentation as info documents.

man vs info

To view these, you’ll have to use the info command instead of the man command. That’s info tar instead of man tar.

info

apropos

The apropos command searches for man pages that contain a phrase, so it’s a quick way of finding a command that can do something. It’s the same thing as running the man -k command.

apropos

whatis

The whatis command shows a one-line summary of a command, taken from its man page. It’s a quick way of seeing what a command actually does.

whatis


With these tricks under your belt, it’s possible to start using a Linux shell and learn new commands without Googling anything at all. Of course, if you’re at a terminal with an Internet connection, you can use w3m or another text-mode browser to search Google from the terminal.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 03/20/12

Comments (6)

  1. gyffes

    When I started out with Linux (though I’m hardly out of my n00b pants, even now), I found FISH (the Friendly Interactive SHell) to be quite useful: commands change color when they’re ‘complete’, among other nifty features.

    sudo [apt-get/yum/whatnot] install fish and away you go.

    The Wikipedia article offers a pretty succinct description of its features (better, actually, than the FISH site).

  2. Scott Lewin

    Thank you for all the Linux command line suggestions. I have been trying to take more advantage of the CLI recently.

  3. mimzy7378

    LOL:) this is great it’s about time not everything is ment for everyone to read . I wonder isn’t pissing on yourself alittle out of the ordinary LOL. revert to the galaxy image the robot and the apple well like the computer manuals vise versa you know the rules! this is to a very smart and intelligent interface who would say you know one a day might keep the comment’s away ! WELL YOU NEVER KNOW NOW DO YA ! COMPUTERS ARE JUST LIKE OWNING A PET EXCEPT YOU STILL GOT TO FEED IT EVERY DAY AND LOVE ‘EM. TEEKAAAAAAAAAAAAA .BRINGING DOWN YOUR BOTZZZ.NOW WHAT THEN SOME AND STILL WATCH ME END SOME ……..*HEHEHHEHEHE!

  4. Hitesh Chavda

    I love all of such articles of terminal by How to geek.

    please keep posting article like this.

    Thanks

  5. mimzy7378

    this is oing to be a big help thank you for homework can’t wait to use this on the teachers pet project .

  6. Sabrina

    Thanks for giving the more information about the How to Get Help With a Command from the Linux Terminal 8 Tricks for Beginners & Pros Alike.

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!