3 weeks ago

Terminal tools: how to get help from the Linux command line

The basic command line tools you need to get advice from the Linux terminal

We spend a lot of time in terminal, using the Linux command line environment on a Raspberry Pi. So it’s important to learn how to get help and advice right from the command line.

In our beginner’s guide to the command line, we looked briefly at ‘man’, the manual you can access from the command line. We’ve also looked at how to customise the command line.

Terminal: using Man to get help at the command line


The man tool is so important that we think it deserves a more thorough explanation. And man isn’t alone in offering help on the command line.

Other commands like whatis, info, and apropos all offer support and assistance. And let’s face it, support and assistance are what you will often need at the command line.

Even seasoned coders don’t always know the correct command to type into the Linux terminal. This guide is all about the various ways to get help at the command line, so no matter what command you come across, you’ll be able to find out more information on how to use it.

Your first point of call for getting help on the command line is man (short for ‘manual’). Enter man followed by the name of a command to get detailed information about it. For instance, enter:

…and you will see detailed information about the tool used to change your password. Man screens are displayed one page at a time. Press the SPACE bar to move to the next page, and press Q to exit the page and return to the command prompt.

Man pages can be a bit tricky to read at first, but you’ll soon get the hang of it.

At the top are the Name, Synopsis, and Description sections. Read these to get an overview of the command. Below them you’ll find options and parameters; read these carefully to discover ways to expand your usage of each command. It’s a good idea to use man on any commands you know, and read the manual for any new Linux commands you come across.

You can even read a man page for man:

Press H in the man screen to view a summary of navigational key presses. These are worth learning so you can do more than press space to move to the next page.

Use Info instead of Man in the Linux terminal

Man’s lesser-known partner is ‘info’, which is used to display information pages associated with commands. Sometimes these are the same as the man pages. In other cases they provide a different description. Try these:

While man bash gives you a brief description of the GNU Bourne-Again Shell and the options used with the bash command; info bash gives the whole history and hundreds of pages of detailed information.

Press H on an info screen to view the controls for navigating such long documents. As well as SPACE to move down, you use DELETE to go back a screen, TAB to highlight links, and RETURN to use them. Press Q to exit the help screen.

Get help with terminal commands

Terminal help: using man -k and apropros

Apropos in terminal

As you become more familiar with man and info, you’ll start searching for commands to look up. Here, the man -k command comes in useful. In particular, try this:

This command lists all available man entries. Press SPACE to run through them one at a time.

The man -k option is worth remembering. If you use man man, it tells you the -k option is ‘equivalent to apropos’. Apropos is used to search manual page names and descriptions. It’s a handy way to find commands when you don’t know their names.

For instance, enter:

…and you’ll get a list of all the commands that have the word ‘directory’ in their description or page name. Here you’ll find common commands such as ls, cd, and pwd, but you’ll also find less obvious commands, such as mktemp.

Next to each command is a number, like (1) or (2). These correspond to the section numbers of the manual (view using man man).

The section numbers are useful for guiding you to the commands that can be used on the command line. As a general rule, 1: Executable programs or shell commands, and 2: System calls, both tend to be worth investigating. Higher numbers are for library calls, special files, and kernel routines for advanced users.

You can find out more information about any command using man:

This command gives you detailed information on how to create temporary directories.

  • Brian Rideout

    On a pizero running latest raspbian jesse tried both versions of ‘directory’ command. Received ‘directory: nothing appropriate.’ as a response for both.

  • David Simmons

    Hi Brian – remember that the focus of this article is ‘How to Get Help’ while at the command line. Having said that, did you make sure to include ‘apropos’ before the word ‘directory’? When I enter that command, it lists 59 lines of possible commands (I know there are 59 because I used the ‘word count’ program to count the lines by entering ‘apropos directory | wc -l’ ).

    To answer your question, you might try the commands ‘ls’ or ‘dir’….obtaining more information about both of these by issuing:
    info ls
    info dir

    Does this help? – dave