Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

How To Get Information on Linux

August 02, 2023 — Gregg Szumowski

The manpages are historically the place to go for any information about the software and utilities installed on a Linux machine. I believe that the info page seems to be the best place for newbies to go because it is so much easier to navigate, and, like manpages, it is a still a great place to get information about your system.

Suppose you want to get information about socket. You would type:

$ info socket

and you’d get a page that looks similar to a manpage but it can be navigated by using keyboard shortcuts:

q- exits back to the shell
u- moves up one level
n- moves to the next node on the current level
p- moves to the previous node on the current level
space- goes to the selected node under the cursor
H- lists all of the Info commands

The commands whatis and whereis are also very useful in finding information on the system.

$ whatis printf
printf (3) - formatted output conversion
printf (1) - format and print data

The whatis command will list the set of manpages for a specific keyword. The keyword printf is used in the bash shell as well as the c programming language. Here you see separate pages for each usage. To view them you would specify the section number in your command to man, i.e., $ man 3 printf or man printf (which defaults to section 1). This is the same output as entering $ man -f printf.

The whereis command will list which system files reference a specified keyword or command. For example,

$ whereis socket
socket: /usr/man/man7/socket.7.gz /usr/man/mann/socket.n.gz /usr/man/man2/socket.2.gz
$ whereis printf
printf: /usr/bin/printf /bin/printf /usr/man/man3/printf.3.gz /usr/man/man1/printf.1.gz

In case you aren’t really sure of what you’re looking for you can use a ‘keyword’ search to the man or apropos commands which will use the keyword you enter as a regex (regular expression) to find all of the matches throughout the manpages:

$ man -k printf
aa_printf (3) - print text to AA-lib output buffers.
asprintf (3) - print to allocated string
ber_printf (3) - OpenLDAP LBER simplified Basic Encoding Rules library routines f...
BIO_printf (3) - formatted output to a BIO
BIO_snprintf (3) - formatted output to a BIO
BIO_vprintf (3) - formatted output to a BIO
BIO_vsnprintf (3) - formatted output to a BIO
buffer_printf.c (3) - Buffer management functions.
curl_mprintf (3) - formatted output conversion
dprintf (3) - formatted output conversion
format (n) - Format a string in the style of sprintf
fprintf (3) - formatted output conversion
etc...

In case you are interested, the manpages are broken down into different sections as listed here:

1 General Commands
2 System Calls and Error Numbers
3 C Libraries
3p perl
4 Devices and device drivers
5 File Formats and config files
6 Game instructions
7 Miscellaneous information
8 System maintenance
9 Kernel internals

Tags: cli, man, apropos, whereis, whatis, motd