[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Ceci est une ancienne révision du document !


Comment Rechercher et Consulter Efficacement les Manpages

TRADUCTION en cours — Cedric M. 2015/09/11 00:29

Les Manpages sont les pages du Manuel Unix en ligne. J'espère que ce Howto pourra en aider quelques uns plus efficacement, même si je suis conscient que beaucoup de lecteurs sont déjà familiers avec ce sujet.

Recherche une Manpage

Pour rechercher des informations sur quoi que ce soit dans les pages de manuel que vous pouvez utiliser l'une des commandes suivantes:

  • apropos
  • man -k
  • whatis

apropos est juste un alias pour man -k; il n'y a aucune différence entre les deux. La différence entre whatis et les autres commandes est que whatis recherches les mots en entier alors que apropos (ou man -k) recherche une partie du mot.

Si vous ne savez pas exactement comment un mot, par exemple une commande, s'écrit, vous pouvez utiliser à propos . Si vous connaissez l'orthographe exacte du mot à rechercher, whatis sera plus efficace car il retournera moins de lignes.

Exemple

Rechercher des information sur DHCP:

Avec la commande apropos :

user@darkstar$ apropos dhcp
dhclient []          (8)  - script - DHCP client network configuration script
dhclient.conf []     (5)  - DHCP client configuration file
dhclient.leases []   (5)  - DHCP client lease database
dhcp []              (5)  - eval - ISC DHCP conditional evaluation
dhcp []              (5)  - options - Dynamic Host Configuration Protocol options
dhcpcd []            (8)  - an RFC 2131 compliant DHCP client
dhcpcd []            (8)  - run-hooks - DHCP client configuration script
dhcpcd.conf []       (5)  - dhcpcd configuration file
dhcpctl_initialize [] (3)  - dhcpctl library initialization
dhcpctl_initialize [] (3p)  - dhcpctl library initialization
dhcpd []             (8)  - Dynamic Host Configuration Protocol Server
dhcpd.conf []        (5)  - dhcpd configuration file
dhcpd.leases []      (5)  - DHCP client lease database
dnsmasq []           (8)  - A lightweight DHCP and caching DNS server

Avec la commande whatis :

user@darkstar$ whatis dhcp
dhcp []              (5)  - eval - ISC DHCP conditional evaluation
dhcp []              (5)  - options - Dynamic Host Configuration Protocol options

Les deux commandes sont sensibles à la casse!

Mettre à Jour la Base de Données de ''whatis''

La commande whatis possède sa propre base de données. Les pages de manuel pour tous les paquets de l'installation par défaut de la Slackware sont déjà présents dans la base de données. C'est également vrai si vous mettez à niveau ces paquets. Mais si vous construisez vos propres paquets depuis les sources, par exemple à partir de SlackBuilds.org, les pages de manuel pour ceux-ci ne seront pas présents dans la base de données whatis. Afin de mettre à jour la base de données après l'installation de ces nouveaux paquets, Slackware fournit la commande makewhatis. Elle doit être exécuté en tant que root.

Notez que certaines distributions Linux utilisent la commande mandb pour réaliser cette tâche.

Les Sections dans le Manual

Ne confondez pas ces sections avec les sections au sein de la structure de chaque page de manuel; ils sont décrits dans le paragraphe ci-dessous.

Le manuel manpages est divisé en huit sections différentes. Voici un extrait de la page de manuel pour la commande man.

MANUAL SECTIONS 
       The standard sections of the manual include: 
       1      User Commands 
       2      System Calls 
       3      C Library Functions 
       4      Devices and Special Files 
       5      File Formats and Conventions 
       6      Games et. Al. 
       7      Miscellanea
       8      System Administration tools and Daemons

Si les pages de manuel pour un sujet sont divisés en différentes sections, on peut passer le numéro de la section comme un argument supplémentaire à la commande man.

Exemple

user@darkstar$ apropos man  
 ... 
makecontext []       (3)  - manipulate user context 
makedev []           (3)  - manage a device number 
man []               (1)  - format and display the on-line manual pages 
man []               (7)  - macros to format man pages 
man []               (7)  - pages - conventions for writing Linux man pages 
man.conf []          (5)  - configuration data for man 
man2html []          (1)  - format a manual page in html 
manuals with []      (7)  - mdoc 

Maintenant, si vous voulez lire la manpages “macros to format man pages” de la section 7, vous devrez exécuter la commande suivante:

user@darkstar$ man 7 man

The Structure of the Manpages

The manpages all have (or should have) the same structure:

  • Name
    • Name of the command and a short description of its function(s)
  • Synopsis
    • A usage statement including a short list of the options
  • Description
    • A detailed explanation of the command
  • Options
    • Detailed explanation of the command line options for the command
  • Bugs
    • Known Bugs
  • Author
    • The author(s) of the package and maybe the author of the manpage
  • See also
    • Advice for manpages about similar or related programs

If one searches for information about a subject rather than a single command the “see also” line is very interesting.

Searching within a Manpage

The reader for the manpages is the program less. Its keybindings are very similar to the vi editor.

  • / searches the document forward
  • ? searched the document backwards
  • n the cursor jumps to the next match.

The key has no special meaning in the search patterns, so it is possible to search (for example) for the -k option with /-k

Example

Searching for the -h option in the manpage for the ls command with -h gives us

 -h, --human-readable 
              with -l, print sizes in human readable format (e.g., 1K 234M 2G)

Navigation commands are like those in vi:

  • G end of the manpage
  • G,G first line of the mapage
  • n,G nth line of the manpage

One can also set marks at a line of the manpage

  • M,a sets mark a in the current line
  • ', a jumps to mark a in the manpage

Unfortunately these marks are lost when you leave the manpage (which is done with Q).

Formatting a Manpage as a PDF-document

If you want to have a manpage as a PDF document you can use the command:

man -t ls | ps2pdf - > ls-manpage.pdf

which formats the manpage for the ls command into a pdf document named “ls-manpage.pdf”.

Further Reading

For more information read the manpage for the man command and the manpages listed in “see also”.

Sources

 fr:howtos:general_admin:searching_and_reading_manpages_efficiently ()
Cette traduction est plus ancienne que la page originale et est peut-être dépassée. Voir ce qui a changé.