The man command in Linux: command reference manual

Introduction

In the Linux world, the terminal is the gateway to system power. One of the most valuable tools that every user should know is the commandman, abbreviationmanual. This command allows access to integrated documentation of almost any utility, program or call to the system, providing a quick and detailed reference without searching the web.

What is the man command?

The commandmanshows the manual pages, which are organized in numbered sections. Each section groups a type of documentation: for example, section 1 contains user commands, the 2 system calls, the 3 library C functions, and so on. When invokingmanfollowed by the name of a command, the system looks for the corresponding page and displays it in a text viewer, usuallyless, which allows you to move with the arrow keys, page up / down and leave withq.

Basic syntax

The simplest way to usemanis:

man command

Wherecomandois the name of the program whose manual you want to consult. If you don't know the exact name, you can search with the option.-k(orapropos) you look for in the descriptions of the manual pages:

man -k word _ key

This returns a list of pages that contain the keyword in your brief description.

Navigation within a manual page

Once the page opens, you can:

  • Move line to line with the arrows ↑ and ↓.
  • Move forward or back a full page withSpaceandb.
  • Go directly to the end withGor at first withg.
  • Find a pattern by writing/patrónand pressingEnter; repeat the search withn(next) orN(previous).
  • Get out of the view withq.

Practical examples

See the command manuallsto list directories:

man ls

If you want to know how the option is used-lofls, search inside the page:

/ -l

To view all the options related to compression, you can check the manualgzipand seek the wordcompress:

man gzip / compressor

Another utility is to verify the section to which a command belongs. For example,man 2 openshows the call page to the systemopen(section 2), whileman 3 printfshows library function Cprintf(section 3).

Customizing visualization

The default view is usuallylessbut you can change it by defining the environment variableMANPAGER. For example, to usevimas a viewer:

export MANPAGER = "vim -M + MANPAGER -" man ls

You can also adjust the output width with the variableMANWIDTH; establish80ensures that the lines are not unexpectedly broken in narrow terminals.

Tips and best practices

  • When you don't remember the exact name of a command, useaproposorman -kto explore.
  • If a manual page is very long, save its content in a file to read it later:man comando > comando.txt.
  • In modern distributions, manual pages can be available in several languages; specify the language with the variableLANGorLC_MESSAGES.
  • To update the database of manual pages (useful after installing new software), runmandbas root.
  • Remember that some programs include their own documentation in formatinfoor--help; manis only one of the available sources.

Conclusion

Domain commandmanis essential for any Linux user or administrator. It provides immediate access to official documentation, reduces external search dependence and allows for structured and efficient learning. Next time you need to know how an option or the purpose of a command works, open your terminal, writemanand let the manual guide you.

This work is under aCreative Commons License Attribution 4.0 International for Francesc Roig francesc @ vivaldi.net.

EnglishenEnglishEnglish