4

Recently I was reading about techniques of encryption. I found crypt and encrypt commands. When I read man page it displays ok but when I run some examples system displayed message about bash command not found. I am working on RHEL 5.9.Is this behaviour of system is regular OR my OS is corrupted?. Please guide.

2 Answers2

7

Many manpages don’t describe commands available to the shell, but functions available to programs, or concepts, or configuration files. The manpages for crypt and encrypt describe library functions.

You can get a quick idea of what a given manpage describes based on its section. Commands available to the shell are in section 1 or 8 (the latter for administrative commands, often only useful for root).

Note too that you can have section 1 or 8 manpages installed without having the corresponding command, so even if a manpage is in section 1 there is still no guarantee that the command is available. In some cases, manpages exist in different sections with the same name; you can specify the section you want:

man 1 printf
man 3 printf

See What do the numbers in a man page mean? for details of the sections.

Stephen Kitt
  • 434,908
  • 2
    Also maybe not OP's problem but the man pages for commands in the sys path will be there but may not be in a normal user's path. – user1794469 Feb 27 '20 at 18:33
4

No, your system is not broken. Many man pages exist to provide reference, but not necessarily about executable commands. The pages in the man system could contain:

  1. Commands that are not available to the user. A common command (if the package sudo is installed) is visudo. It has a man entry in man visudo (as it should). But it is available only to the root user (as it should be). No user could execute it (without sudo), so, an user (prompt $) can not execute it and usually is not in the path of any other user except root. Thus:

    $ visudo
    bash: visudo: command not found
    

    But:

    $ sudo visudo
    

    or (as root, # prompt):

    # visudo
    

    would work.

  2. General concepts like:

    man man
    man ascii
    

    Of course, man is also an executable, and the one to call man pages. Its manual page describe the concept of what a section means to the man system.

    That is important for concepts like passwd (the -f option means find):

    $ man -f passwd 
    passwd (1)           - change user password
    passwd (1ssl)        - compute password hashes
    passwd (5)           - the password file
    

    That shows that three pages in sections 1, 1ssl and 5 exist. The 1ssl section will be available only if the openssl package has been installed. The man page for section 5 describe a file format, the /etc/passwd file format. The full list of section 5 (for linux) may be seen here or here. That may have (depending of your OS) entries like:

    man acl
    

    Which is not an executable, nor is it expected to be (well, not yet).

  3. The man entry may not even exist as a command or a file.

    If the package openssl is installed, there are man pages like:

    man dgst
    

    Which explain how a part of the openssl command will work, it is called as openssl dgst. There is no dgst command.

    Or:

    man ascii
    

    Which explain what is an ascii character.

  4. Programming (C language) functions

    Many c language functions have a man page:

    man scanf
    

    There is no command, nor is it expected to exist, called scanf.

    But some pages exist in several sections:

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

    There is a command (section 1) called printf and there is a page for the c language function also called printf.