Linux+: Linux Shell 11 – Shell Commands Help - Man

J

Jarret W. Buse

Guest
Linux+: Linux Shell 11 – Shell Commands Help - Man

It is very useful to have access to help information for the various shell commands and other objects. There are two shell commands which allow for a user to access help information that can be mentioned on the Linux+ Certification:

  1. Manual pages (man)
  2. Information pages (info)

This article will look at the 'man' pages, being more popular, but first let's look at the syntax:

man [options] command

The simplest way to look up a command is to use no options. For example, to look up more information on the command 'ls', you would enter:

man ls

NOTE: As with other commands, the options are optional. Also, 'man' is simply another command so you can type 'man man' to get help on the 'man' command.

The options for the 'man' command are:

  • -a (--all) – shows all available topics not just the one most suitable

man -a ls

  • -c (--catman) – option used by the catman program only
  • -C file (--config-file=file) – specifies the user configuration file rather than the default of ~/.manpath

man -C ~/manpages

  • -d (--debug) – Print debugging information

man -d

  • -D (--default) – The option is normally issued as the first option and resets man's behavior to default. Options that follow -D will operate normally

man -D

  • -e extension (--extension=extension) – Specifies the type of manual page to view if multiple source pages exist
man -e 2 exit

NOTE: On some man pages, you may see entries such as exit(2) or exit(3). The extension specifies which specific man page section to view.

  • -E encoding (--encoding=encoding) – Specifies output encoding such as ascii, utf8, etc.
man -E ascii ls

  • -h (--help) – Displays help information
man -h

  • -H[browser] (--html=browser) – Produces an HTML output and uses specified browser to view it
man -Hfirefox ls

NOTE: If you get an error status of 3 from the command, re-install 'groff'.
  • -i (--ignore-case) – Case-sensitivity is ignored (default setting)
  • -I (--match-case) – Case-sensitivity is used for searches
  • -k (--apropos) – Equivalent to using apropos

man -k “web

NOTE: The command is equivalent to 'apropos web'.

  • -K (--global-apropos) – Searches for keyword in all texts

man -K “web”

NOTE: The search checks not only the title and description, but the whole source file.

  • -l (--local-file) – Searches local files only, and not the manuals for the whole system
NOTE: The local man pages are ones which you create or install locally

  • -L locale_type (--locale=locale_type) – The default locale_type is found by the system environment such as $LANG. The default can be overwritten with this parameter
  • -m system_type (--system=system_type) – Specifies another system's man pages to check. Overrides default in the environment variable $SYSTEM. Multiple systems can be listed separated by commas
  • -M path (--manpath=path) – Specifies the path of different man pages. Default is the environment variable $MANPATH
  • -p string (--preprocessor=string) – Allows specification of preprocessors to run on man pages
  • -P path – Specifies a different pagination program other than less

man -P more ls

NOTE: Uses 'more' to paginate the output rather than 'less'.

  • -r prompt – Allows overriding of the default 'less' prompt

man -r "Linux\.org rules" ls

  • -R encoding (--recode=encoding) – Specifies output style such as ascii, latin1, or utf8.
  • -S list (-s list, --selection=list) – Lists order of man page selections to check. Default is environment variable $MANSECT
  • -t (--troff) – Uses “groff -mandoc” to format man pages for display
  • -T device (--troff-device=device) – Changes groff output to the specified device
  • -u (--update) – Performs a consistency check on the inode level of the man pages
  • -V (--version) – Displays version information for man application
  • -w (--where, --location) – Displays file location of matches and not the man page

man -w ls

NOTE: The -w option displays the file and location of the ls man page. The following command would let you view the source page: zless `man -w ls`.

  • -W (--where-cat, --location-cat) – Displays location of matches of cat files
  • -X[dpi] (--gxditview=dpi) – Displays output in a graphical viewer called gxditview using the specified dpi (75, 75-12. 100, 100-12)
  • -Z (--ditroff) – Runs troff and provides a suitable output for specified device (requires -t)
  • -7 (--ascii) – Translates manual pages for a 7-bit viewer
  • --names-only – Used with “–regex” or “–wildcards” to match name only and not the description
  • --no-hyphenation – Prevents words from being hyphenated in the display unless they are already hyphenated
  • --no-justification – By default, the man pages are full-justified. This option forces left-justification
  • --no-subpages – By default, man interprets keywords with hyphens and underscores as one page. The option causes them to be individual keywords
  • --regex – Use part of keyword for searching and also search description matching page argument as a regular expression
  • --warnings[=warnings] – Enable warnings
  • --wildcard – Use part of keyword to match name or description matching each page argument using shell style wildcards
 

Attachments

  • slide.jpg
    slide.jpg
    49.4 KB · Views: 264,279


Latest posts

Top