linux Gets Commands to Help Explain

Keywords: CentOS shell Linux Database

The ability to get help determines your technical ability.

This blog article teaches you how to get help documents for commands, such as queries through help, man, and locally installed methods.

Types of commands in linux

Command types in linux are divided into internal commands and external commands.
The type command determines whether a command is an external or an internal command, as shown below:

[root@centos7 ~]#type cd           
cd is a shell builtin               #cd is the shell's built-in command
[root@centos7 ~]#type passwd
passwd is /usr/bin/passwd           #Passwd commands are stored in the / usr/bin/passwd path

2. Use man command to get help information from external commands

The man manual is divided into the following chapters, but not every command contains these chapters.
Chapter man:

        1 user command
        2 System Call
        3 Call from library
        4 Preparatory Documents and Special Documents
        5-bit file format
        6 games
        7 Miscellaneous
        8-category commands
        9 linux kernel API

Manual pages of man commands are stored in / usr/shar/man
The configuration file for the man command: / etc/man.config (CentOS 6)|man_db.conf(CentOS 7)

The whatis command is an overview of the manual section of a command

        [root@centos7 ~]#whatis ls
        ls (1)               - list directory contents
        ls (1p)              - list directory contents

This command may not work properly on the newly installed system; you can create a database manually using the command makewhatis(CentOS 6); the location of the file is in / var/cache/man/. mandb Update Database (CentOS 7)

Usually, the man command is used to get help.
type COMMAND –>whatis COMMAND –>man # COMMAND

man command uses

- a Lists all help information
- k Searches for keywords and lists all matching pages

        [root@centos7 ~]#man -k passwd
        chpasswd (8)         - update passwords in batch mode
        fgetpwent_r (3)      - get passwd file entry reentrantly
        getpwent_r (3)       - get passwd file entry reentrantly
        gpasswd (1)          - administer /etc/group and /etc/gshadow
        grub2-mkpasswd-pbkdf2 (1) - Generate a PBKDF2 password hash.
        lpasswd (1)          - Change group or user password
        lppasswd (1)         - add, change, or delete digest passwords.
        pam_localuser (8)    - require users to be listed in /etc/passwd
        passwd (1)           - update user's authentication tokens
        sslpasswd (1ssl)     - compute password hashes
        passwd (5)           - password file
        passwd2des (3)       - RFS password encryption
        pwhistory_helper (8) - Helper binary that transfers password hashes from pa...
        saslpasswd2 (8)      - set a user's sasl password
        smbpasswd (5)        - The Samba encrypted password file
        vncpasswd (1)        - change the VNC password

- f is equivalent to whatis command

        [root@centos7 ~]#man -f ls
        ls (1)               - list directory contents
        ls (1p)              - list directory contents

-w # Display Path

    [root@centos7 ~]#man -w ls
    /usr/share/man/man1/ls.1.gz

3. help Gets Command help

1. View the internal command help COMMAND

        [root@centos7 ~]#help cd
        cd: cd [-L|[-P [-e]]] [dir]
            Change the shell working directory.

            Change the current directory to DIR.  The default DIR is the value of the
            HOME shell variable.

2. View the external command COMMAND - help | -h

        [root@centos7 ~]#ls --help
        Usage: ls [OPTION]... [FILE]...
        List information about the FILEs (the current directory by default).
        Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

IV. Getting Help from Local Documents

Local documents are stored in the / usr/shar/man directory
1. Subdirectories of most installed software packages, including explanations of the relevant principles of these software;
2. Common Documents: README INSTALL CHANGES
3. You can install the help document manually by yourself and install it in / usr/shar/man by default.

         [root@centos7 ~]#rpm -ivh /run/media/root/CentOS\ 7\ x86_64/Packages/httpd-manual-2.4.6-45.el7.centos.noarch.rpm 

Posted by visualAd on Wed, 12 Jun 2019 13:27:19 -0700