美文网首页
man的使用

man的使用

作者: 平知 | 来源:发表于2019-08-11 11:22 被阅读0次
章节号 内容            
1图片格式(png) 宽度大于620px,保持高宽比减低为620px
1-1 应用
1-1-1 方法
  备查表:

  RETURN=回车
  Carriage Return=回车
  Enter=回车
  GIMP取消选区,Ctrl+Shift+A
  重命名文件:sudo mv 原文件 新文件

第1章节 man man

  touch 1,创建一个名为1的文件
  sudo chmod 666,修改文件权限,使得文件可写。
  sudo chmod 666,修改文件权限,使得文件可写。
  在命令行中输入man man
  进入帮助文档界面,输入-O 1(大写字母O 1)
  成功把man命令的手册输出到文件1中
  然后.......当你使用其他文本编辑器打开时,会发现一片乱码
  使用vim打开才可见:


  经过搜索网上大神的帖子,解决办法有2:一是在vim使用正则表达式进行匹配替换(原谅我这个vim渣渣只能想到用notepadqq来匹配替换);二是使用一条命令man 你要查询的命令 | col -b >/home/XX.txt来导出帮助手册内容(首先XX.txt文件存在,然后当前账户对此文件有写权限)。
  这里使用第二个办法来倒出文件内容如下:
MAN(1)                   Manual pager utils                  MAN(1)

NAME
       man - an interface to the on-line reference manuals

SYNOPSIS
       man  [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-m system[,...]]
       [-M path] [-S list] [-e extension] [-i|-I]  [--regex|--wildcard]  [--names-only]  [-a]  [-u]
       [--no-subpages]  [-P pager] [-r prompt] [-7] [-E encoding] [--no-hyphenation] [--no-justifi‐
       cation] [-p string] [-t] [-T[device]] [-H[browser]]  [-X[dpi]]  [-Z]  [[section]  page[.sec‐
       tion] ...] ...
       man -k [apropos options] regexp ...
       man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...
       man -f [whatis options] page ...
       man  -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-P pager] [-r
       prompt] [-7] [-E encoding] [-p string] [-t] [-T[device]] [-H[browser]] [-X[dpi]]  [-Z]  file
       ...
       man -w|-W [-C file] [-d] [-D] page ...
       man -c [-C file] [-d] [-D] page ...
       man [-?V]

DESCRIPTION
       man is the system's manual pager.  Each page argument given to man is normally the name of a
       program, utility or function.  The manual page associated with each of  these  arguments  is
       then found and displayed.  A section, if provided, will direct man to look only in that sec‐
       tion of the manual.  The default action is to search in all of the available  sections  fol‐
       lowing  a pre-defined order ("1 n l 8 3 2 3posix 3pm 3perl 3am 5 4 9 6 7" by default, unless
       overridden by the SECTION directive in /etc/manpath.config), and to show only the first page
       found, even if page exists in several sections.

  到这里觉得有必要cat一下这个文件看一看:

li@li-System-Product-Name:/home$ cat /etc/manpath.config
# manpath.config
#
# This file is used by the man-db package to configure the man and cat paths.
# It is also used to provide a manpath for those without one by examining
# their PATH environment variable. For details see the manpath(5) man page.
#
# Lines beginning with `#' are comments and are ignored. Any combination of
# tabs or spaces may be used as `whitespace' separators.
#
# There are three mappings allowed in this file:
# --------------------------------------------------------
# MANDATORY_MANPATH         manpath_element
# MANPATH_MAP       path_element    manpath_element
# MANDB_MAP     global_manpath  [relative_catpath]
#---------------------------------------------------------
# every automatically generated MANPATH includes these fields
#
#MANDATORY_MANPATH          /usr/src/pvm3/man
#
MANDATORY_MANPATH           /usr/man
MANDATORY_MANPATH           /usr/share/man
MANDATORY_MANPATH           /usr/local/share/man
#---------------------------------------------------------
# set up PATH to MANPATH mapping
# ie. what man tree holds man pages for what binary directory.
#
#       *PATH*        ->    *MANPATH*
#
MANPATH_MAP /bin            /usr/share/man
MANPATH_MAP /usr/bin        /usr/share/man
MANPATH_MAP /sbin           /usr/share/man
MANPATH_MAP /usr/sbin       /usr/share/man
MANPATH_MAP /usr/local/bin      /usr/local/man
MANPATH_MAP /usr/local/bin      /usr/local/share/man
MANPATH_MAP /usr/local/sbin     /usr/local/man
MANPATH_MAP /usr/local/sbin     /usr/local/share/man
MANPATH_MAP /usr/X11R6/bin      /usr/X11R6/man
MANPATH_MAP /usr/bin/X11        /usr/X11R6/man
MANPATH_MAP /usr/games      /usr/share/man
MANPATH_MAP /opt/bin        /opt/man
MANPATH_MAP /opt/sbin       /opt/man
#---------------------------------------------------------
# For a manpath element to be treated as a system manpath (as most of those
# above should normally be), it must be mentioned below. Each line may have
# an optional extra string indicating the catpath associated with the
# manpath. If no catpath string is used, the catpath will default to the
# given manpath.
#
# You *must* provide all system manpaths, including manpaths for alternate
# operating systems, locale specific manpaths, and combinations of both, if
# they exist, otherwise the permissions of the user running man/mandb will
# be used to manipulate the manual pages. Also, mandb will not initialise
# the database cache for any manpaths not mentioned below unless explicitly
# requested to do so.
#
# In a per-user configuration file, this directive only controls the
# location of catpaths and the creation of database caches; it has no effect
# on privileges.
#
# Any manpaths that are subdirectories of other manpaths must be mentioned
# *before* the containing manpath. E.g. /usr/man/preformat must be listed
# before /usr/man.
#
#       *MANPATH*     ->    *CATPATH*
#
MANDB_MAP   /usr/man        /var/cache/man/fsstnd
MANDB_MAP   /usr/share/man      /var/cache/man
MANDB_MAP   /usr/local/man      /var/cache/man/oldlocal
MANDB_MAP   /usr/local/share/man    /var/cache/man/local
MANDB_MAP   /usr/X11R6/man      /var/cache/man/X11R6
MANDB_MAP   /opt/man        /var/cache/man/opt
#
#---------------------------------------------------------
# Program definitions.  These are commented out by default as the value
# of the definition is already the default.  To change: uncomment a
# definition and modify it.
#
#DEFINE     pager   pager
#DEFINE     cat cat
#DEFINE     tr  tr '\255\267\264\327' '\055\157\047\170'
#DEFINE     grep    grep
#DEFINE     troff   groff -mandoc
#DEFINE     nroff   nroff -mandoc
#DEFINE     eqn     eqn
#DEFINE     neqn    neqn
#DEFINE     tbl     tbl
#DEFINE     col     col
#DEFINE     vgrind  vgrind
#DEFINE     refer   refer
#DEFINE     grap    grap
#DEFINE     pic     pic -S
#
#DEFINE     compressor  gzip -c7
#---------------------------------------------------------
# Misc definitions: same as program definitions above.
#
#DEFINE     whatis_grep_flags       -i
#DEFINE     apropos_grep_flags      -iEw
#DEFINE     apropos_regex_grep_flags    -iE
#---------------------------------------------------------
# Section names. Manual sections will be searched in the order listed here;
# the default is 1, n, l, 8, 3, 0, 2, 5, 4, 9, 6, 7. Multiple SECTION
# directives may be given for clarity, and will be concatenated together in
# the expected way.
# If a particular extension is not in this list (say, 1mh), it will be
# displayed with the rest of the section it belongs to. The effect of this
# is that you only need to explicitly list extensions if you want to force a
# particular order. Sections with extensions should usually be adjacent to
# their main section (e.g. "1 1mh 8 ...").
#
SECTION     1 n l 8 3 2 3posix 3pm 3perl 3am 5 4 9 6 7
#
#---------------------------------------------------------
# Range of terminal widths permitted when displaying cat pages. If the
# terminal falls outside this range, cat pages will not be created (if
# missing) or displayed.
#
#MINCATWIDTH    80
#MAXCATWIDTH    80
#
# If CATWIDTH is set to a non-zero number, cat pages will always be
# formatted for a terminal of the given width, regardless of the width of
# the terminal actually being used. This should generally be within the
# range set by MINCATWIDTH and MAXCATWIDTH.
#
#CATWIDTH   0
#
#---------------------------------------------------------
# Flags.
# NOCACHE keeps man from creating cat pages.
#NOCACHE

       The  table below shows the section numbers of the manual followed by the types of pages they
       contain.

       1   Executable programs or shell commands
       2   System calls (functions provided by the kernel)
       3   Library calls (functions within program libraries)
       4   Special files (usually found in /dev)
       5   File formats and conventions eg /etc/passwd
       6   Games
       7   Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
       8   System administration commands (usually only for root)
       9   Kernel routines [Non standard]

       A manual page consists of several sections.

       Conventional section names include  NAME,  SYNOPSIS,  CONFIGURATION,  DESCRIPTION,  OPTIONS,
       EXIT STATUS, RETURN VALUE, ERRORS, ENVIRONMENT, FILES, VERSIONS, CONFORMING TO, NOTES, BUGS,
       EXAMPLE, AUTHORS, and SEE ALSO.

       The following conventions apply to the SYNOPSIS section and can be used as a guide in  other
       sections.

       bold text      type exactly as shown.
       italic text    replace with appropriate argument.
       [-abc]         any or all arguments within [ ] are optional.
       -a|-b          options delimited by | cannot be used together.
       argument ...   argument is repeatable.
       [expression] ...   entire expression within [ ] is repeatable.

       Exact rendering may vary depending on the output device.  For instance, man will usually not
       be able to render italics when running in a terminal, and will typically use  underlined  or
       coloured text instead.

       The  command  or  function  illustration is a pattern that should match all possible invoca‐
       tions.  In some cases it is advisable to illustrate  several  exclusive  invocations  as  is
       shown in the SYNOPSIS section of this manual page.

EXAMPLES
       man ls
       Display the manual page for the item (program) ls.

       man man.7
       Display the manual page for macro package man from section 7.

       man -a intro
       Display,  in  succession,  all  of the available intro manual pages contained within the
       manual.  It is possible to quit between successive displays or skip any of them.

       man -t alias | lpr -Pps
       Format the manual page referenced by `alias', usually a  shell  manual  page,  into  the
       default  troff  or groff format and pipe it to the printer named ps.  The default output
       for groff is usually PostScript.  man --help should advise  as  to  which  processor  is
       bound to the -t option.

       man -l -Tdvi ./foo.1x.gz > ./foo.1x.dvi
       This  command will decompress and format the nroff source manual page ./foo.1x.gz into a
       device independent (dvi) file.  The redirection is necessary as the -T flag causes  out‐
       put  to  be directed to stdout with no pager.  The output could be viewed with a program
       such as xdvi or further processed into PostScript using a program such as dvips.

       man -k printf
       Search the short descriptions and manual page names for the keyword  printf  as  regular
       expression.  Print out any matches.  Equivalent to apropos printf.

       man -f smail
       Lookup  the manual pages referenced by smail and print out the short descriptions of any
       found.  Equivalent to whatis smail.

OVERVIEW
       Many options are available to man in order to give as much flexibility as  possible  to  the
       user.   Changes  can  be made to the search path, section order, output processor, and other
       behaviours and operations detailed below.

       If set, various environment variables are interrogated to determine the  operation  of  man.
       It  is possible to set the `catch all' variable $MANOPT to any string in command line format
       with the exception that any spaces used as part of an  option's  argument  must  be  escaped
       (preceded  by  a  backslash).  man will parse $MANOPT prior to parsing its own command line.
       Those options requiring an argument will be overridden by the same options found on the com‐
       mand  line.   To reset all of the options set in $MANOPT, -D can be specified as the initial
       command line option.  This will allow man to `forget' about the options specified in $MANOPT
       although they must still have been valid.

       The  manual  pager utilities packaged as man-db make extensive use of index database caches.
       These caches contain information such as where each manual page can be found on the filesys‐
       tem and what its whatis (short one line description of the man page) contains, and allow man
       to run faster than if it had to search the filesystem each time to find the appropriate man‐
       ual  page.  If requested using the -u option, man will ensure that the caches remain consis‐
       tent, which can obviate the need to manually run software to update traditional whatis  text
       databases.

       If  man cannot find a mandb initiated index database for a particular manual page hierarchy,
       it will still search for the requested manual pages, although file globbing will  be  neces‐
       sary  to  search within that hierarchy.  If whatis or apropos fails to find an index it will
       try to extract information from a traditional whatis database instead.

       These utilities support compressed source nroff files having, by default, the extensions  of
       .Z, .z and .gz.  It is possible to deal with any compression extension, but this information
       must be known at compile time.  Also, by default, any  cat  pages  produced  are  compressed
       using  gzip.   Each  `global' manual page hierarchy such as /usr/share/man or /usr/X11R6/man
       may have any directory as its cat page hierarchy.  Traditionally the cat  pages  are  stored
       under  the  same  hierarchy as the man pages, but for reasons such as those specified in the
       File Hierarchy Standard (FHS), it may be better to store them elsewhere.  For details on how
       to do this, please read manpath(5).  For details on why to do this, read the standard.

       International  support  is  available  with  this package.  Native language manual pages are
       accessible (if available on your system) via use of locale functions.  To activate such sup‐
       port, it is necessary to set either $LC_MESSAGES, $LANG or another system dependent environ‐
       ment variable to your language locale, usually specified in the POSIX 1003.1 based format:

       <language>[_<territory>[.<character-set>[,<version>]]]

       If the desired page is available in your locale, it will be displayed in lieu of  the  stan‐
       dard (usually American English) page.

       Support  for  international  message  catalogues is also featured in this package and can be
       activated in the same way, again if available.  If you find that the manual pages  and  mes‐
       sage catalogues supplied with this package are not available in your native language and you
       would like to supply them, please contact the  maintainer  who  will  be  coordinating  such
       activity.

       For  information  regarding  other features and extensions available with this manual pager,
       please read the documents supplied with the package.

DEFAULTS
       man will search for the desired manual pages within the index database  caches.  If  the  -u
       option  is  given, a cache consistency check is performed to ensure the databases accurately
       reflect the filesystem.  If this option is always given, it is not  generally  necessary  to
       run  mandb after the caches are initially created, unless a cache becomes corrupt.  However,
       the cache consistency check can be slow on systems with many manual pages installed,  so  it
       is  not  performed by default, and system administrators may wish to run mandb every week or
       so to keep the database caches fresh.  To forestall problems caused by outdated caches,  man
       will  fall  back  to file globbing if a cache lookup fails, just as it would if no cache was
       present.

       Once a manual page has been located, a check is performed to find out if a relative  prefor‐
       matted  `cat' file already exists and is newer than the nroff file.  If it does and is, this
       preformatted file is (usually) decompressed and then displayed, via use  of  a  pager.   The
       pager can be specified in a number of ways, or else will fall back to a default is used (see
       option -P for details).  If no cat is found or is older than the nroff file,  the  nroff  is
       filtered through various programs and is shown immediately.

       If  a  cat file can be produced (a relative cat directory exists and has appropriate permis‐
       sions), man will compress and store the cat file in the background.

       The filters are deciphered by a number of means.  Firstly, the command line option -p or the
       environment  variable  $MANROFFSEQ  is interrogated.  If -p was not used and the environment
       variable was not set, the initial line of the  nroff  file  is  parsed  for  a  preprocessor
       string.  To contain a valid preprocessor string, the first line must resemble

       '\" <string>

       where string can be any combination of letters described by option -p below.

       If none of the above methods provide any filter information, a default set is used.

       A  formatting  pipeline  is  formed  from  the  filters  and the primary formatter (nroff or
       [tg]roff with -t) and executed.  Alternatively, if  an  executable  program  mandb_nfmt  (or
       mandb_tfmt with -t) exists in the man tree root, it is executed instead.  It gets passed the
       manual source file, the preprocessor string, and optionally the device specified with -T  or
       -E as arguments.

OPTIONS
       Non  argument  options  that are duplicated either on the command line, in $MANOPT, or both,
       are not harmful.  For options that require an argument, each duplication will  override  the
       previous argument value.

   General options
       -C file, --config-file=file
          Use this user configuration file rather than the default of ~/.manpath.

       -d, --debug
          Print debugging information.

       -D, --default
          This option is normally issued as the very first option and resets man's behaviour to
          its default.  Its use is to reset those options that may have been  set  in  $MANOPT.
          Any options that follow -D will have their usual effect.

       --warnings[=warnings]
          Enable  warnings from groff.  This may be used to perform sanity checks on the source
          text of manual pages.  warnings is a comma-separated list of warning names; if it  is
          not supplied, the default is "mac".  See the “Warnings” node in info groff for a list
          of available warning names.

   Main modes of operation
       -f, --whatis
          Equivalent to whatis.  Display a short description from the manual  page,  if  avail‐
          able.  See whatis(1) for details.

       -k, --apropos
          Equivalent  to  apropos.   Search the short manual page descriptions for keywords and
          display any matches.  See apropos(1) for details.

       -K, --global-apropos
          Search for text in all manual pages.  This is a brute-force search, and is likely  to
          take  some  time;  if  you  can, you should specify a section to reduce the number of
          pages that need to be searched.  Search terms may be simple strings (the default), or
          regular expressions if the --regex option is used.

          Note  that  this searches the sources of the manual pages, not the rendered text, and
          so may include false positives due to things like comments in source files.   Search‐
          ing the rendered text would be much slower.

       -l, --local-file
          Activate  `local'  mode.   Format and display local manual files instead of searching
          through the system's manual collection.  Each manual page  argument  will  be  inter‐
          preted  as  an nroff source file in the correct format.  No cat file is produced.  If
          '-' is listed as one of the arguments, input will be taken  from  stdin.   When  this
          option  is  not  used, and man fails to find the page required, before displaying the
          error message, it attempts to act as if this option was supplied, using the name as a
          filename and looking for an exact match.

       -w, --where, --path, --location
          Don't  actually  display the manual pages, but do print the location(s) of the source
          nroff files that would be formatted.

       -W, --where-cat, --location-cat
          Don't actually display the manual pages, but do print  the  location(s)  of  the  cat
          files that would be displayed.  If -w and -W are both specified, print both separated
          by a space.

       -c, --catman
          This option is not for general use and should only be used by the catman program.

       -R encoding, --recode=encoding
          Instead of formatting the manual page in the usual way, output its  source  converted
          to  the specified encoding.  If you already know the encoding of the source file, you
          can also use manconv(1) directly.  However, this option allows you to convert several
          manual  pages to a single encoding without having to explicitly state the encoding of
          each, provided that they were already installed in a structure similar  to  a  manual
          page hierarchy.

   Finding manual pages
       -L locale, --locale=locale
          man  will  normally  determine your current locale by a call to the C function setlo‐
          cale(3) which interrogates various environment variables, possibly including $LC_MES‐
          SAGES  and  $LANG.   To temporarily override the determined value, use this option to
          supply a locale string directly to man.  Note that it will not take effect until  the
          search  for  pages  actually  begins.  Output such as the help message will always be
          displayed in the initially determined locale.

       -m system[,...], --systems=system[,...]
          If this system has access to other operating  system's  manual  pages,  they  can  be
          accessed  using  this  option.   To search for a manual page from NewOS's manual page
          collection, use the option -m NewOS.

          The system specified can be a combination of comma delimited operating system  names.
          To include a search of the native operating system's manual pages, include the system
          name man in the argument string.  This option will override the  $SYSTEM  environment
          variable.

       -M path, --manpath=path
          Specify  an  alternate  manpath to use.  By default, man uses manpath derived code to
          determine the path to search.  This option overrides the $MANPATH  environment  vari‐
          able and causes option -m to be ignored.

          A  path specified as a manpath must be the root of a manual page hierarchy structured
          into sections as described in the man-db manual (under "The manual page system").  To
          view manual pages outside such hierarchies, see the -l option.

       -S list, -s list, --sections=list
          List  is  a  colon-  or  comma-separated  list of `order specific' manual sections to
          search.  This option overrides the $MANSECT environment variable.  (The  -s  spelling
          is for compatibility with System V.)

       -e sub-extension, --extension=sub-extension
          Some systems incorporate large packages of manual pages, such as those that accompany
          the Tcl package, into the main manual page hierarchy.  To get around the  problem  of
          having  two  manual pages with the same name such as exit(3), the Tcl pages were usu‐
          ally all assigned to section l.  As this is unfortunate, it is now  possible  to  put
          the  pages  in  the correct section, and to assign a specific `extension' to them, in
          this case, exit(3tcl).  Under normal operation, man will display exit(3)  in  prefer‐
          ence  to  exit(3tcl).   To negotiate this situation and to avoid having to know which
          section the page you require resides in, it is now possible to give man a  sub-exten‐
          sion  string indicating which package the page must belong to.  Using the above exam‐
          ple, supplying the option -e tcl to man will restrict the search to pages  having  an
          extension of *tcl.

       -i, --ignore-case
          Ignore case when searching for manual pages.  This is the default.

       -I, --match-case
          Search for manual pages case-sensitively.

       --regex
          Show  all  pages  with  any part of either their names or their descriptions matching
          each page argument as a regular expression, as with apropos(1).  Since there is  usu‐
          ally no reasonable way to pick a "best" page when searching for a regular expression,
          this option implies -a.

       --wildcard
          Show all pages with any part of either their names  or  their  descriptions  matching
          each  page  argument using shell-style wildcards, as with apropos(1) --wildcard.  The
          page argument must match the entire name or description, or match on word  boundaries
          in  the  description.  Since there is usually no reasonable way to pick a "best" page
          when searching for a wildcard, this option implies -a.

       --names-only
          If the --regex or --wildcard option is used, match only page names, not page descrip‐
          tions, as with whatis(1).  Otherwise, no effect.

       -a, --all
          By  default,  man  will exit after displaying the most suitable manual page it finds.
          Using this option forces man to display all the manual pages with  names  that  match
          the search criteria.

       -u, --update
          This  option causes man to perform an `inode level' consistency check on its database
          caches to ensure that they are an accurate representation of the filesystem.  It will
          only have a useful effect if man is installed with the setuid bit set.

       --no-subpages
          By default, man will try to interpret pairs of manual page names given on the command
          line as equivalent to a single manual page name containing a hyphen or an underscore.
          This  supports the common pattern of programs that implement a number of subcommands,
          allowing them to provide manual pages for each that can  be  accessed  using  similar
          syntax as would be used to invoke the subcommands themselves.  For example:

        $ man -aw git diff
        /usr/share/man/man1/git-diff.1.gz

          To disable this behaviour, use the --no-subpages option.

        $ man -aw --no-subpages git diff
        /usr/share/man/man1/git.1.gz
        /usr/share/man/man3/Git.3pm.gz
        /usr/share/man/man1/diff.1.gz

   Controlling formatted output
       -P pager, --pager=pager
          Specify  which  output pager to use.  By default, man uses pager, falling back to cat
          if pager is not found or is not executable.   This  option  overrides  the  $MANPAGER
          environment variable, which in turn overrides the $PAGER environment variable.  It is
          not used in conjunction with -f or -k.

          The value may be a simple command name or a command with arguments, and may use shell
          quoting (backslashes, single quotes, or double quotes).  It may not use pipes to con‐
          nect multiple commands; if you need that, use a wrapper script, which  may  take  the
          file to display either as an argument or on standard input.

       -r prompt, --prompt=prompt
          If  a recent version of less is used as the pager, man will attempt to set its prompt
          and some sensible options.  The default prompt looks like

           Manual page name(sec) line x

          where name denotes the manual page name, sec denotes the section it was  found  under
          and x the current line number.  This is achieved by using the $LESS environment vari‐
          able.

          Supplying -r with a string will override this default.  The string  may  contain  the
          text  $MAN_PN  which  will be expanded to the name of the current manual page and its
          section name surrounded by `(' and `)'.  The string used to produce the default could
          be expressed as

          \ Manual\ page\ \$MAN_PN\ ?ltline\ %lt?L/%L.:
          byte\ %bB?s/%s..?\ (END):?pB\ %pB\\%..
          (press h for help or q to quit)

          It is broken into three lines here for the sake of readability only.  For its meaning
          see the less(1) manual page.  The prompt string is first evaluated by the shell.  All
          double quotes, back-quotes and backslashes in the prompt must be escaped by a preced‐
          ing backslash.  The prompt string may end in an escaped $ which may  be  followed  by
          further options for less.  By default man sets the -ix8 options.

          The $MANLESS environment variable described below may be used to set a default prompt
          string if none is supplied on the command line.

       -7, --ascii
          When viewing a pure ascii(7) manual page on a 7 bit terminal  or  terminal  emulator,
          some characters may not display correctly when using the latin1(7) device description
          with GNU nroff.  This option allows pure ascii manual pages to be displayed in  ascii
          with  the latin1 device.  It will not translate any latin1 text.  The following table
          shows the translations performed: some parts of it may  only  be  displayed  properly
          when using GNU nroff's latin1(7) device.

          Description       Octal   latin1   ascii
          ─────────────────────────────────────────────
          continuation hyphen    255      ‐        -
          bullet (middle dot)    267      ·        o
          acute accent       264      ´        '
          multiplication sign    327      ×        x

          If the latin1 column displays correctly, your terminal may be set up for latin1 char‐
          acters and this option is not necessary.  If the latin1 and ascii columns are identi‐
          cal,  you  are  reading  this  page using this option or man did not format this page
          using the latin1 device description.  If the latin1 column is missing or corrupt, you
          may need to view manual pages with this option.

          This  option  is  ignored when using options -t, -H, -T, or -Z and may be useless for
          nroff other than GNU's.

       -E encoding, --encoding=encoding
          Generate output for a character encoding other than the default.  For  backward  com‐
          patibility, encoding may be an nroff device such as ascii, latin1, or utf8 as well as
          a true character encoding such as UTF-8.

       --no-hyphenation, --nh
          Normally, nroff will automatically hyphenate text at line breaks even in  words  that
          do  not contain hyphens, if it is necessary to do so to lay out words on a line with‐
          out excessive spacing.  This option disables automatic  hyphenation,  so  words  will
          only be hyphenated if they already contain hyphens.

          If  you are writing a manual page and simply want to prevent nroff from hyphenating a
          word at an inappropriate point, do not use this option, but consult the  nroff  docu‐
          mentation  instead;  for instance, you can put "\%" inside a word to indicate that it
          may be hyphenated at that point, or put "\%" at the start of a  word  to  prevent  it
          from being hyphenated.

       --no-justification, --nj
          Normally,  nroff  will  automatically justify text to both margins.  This option dis‐
          ables full justification, leaving justified only to the left margin, sometimes called
          "ragged-right" text.

          If  you  are  writing  a manual page and simply want to prevent nroff from justifying
          certain paragraphs, do not use this  option,  but  consult  the  nroff  documentation
          instead;  for  instance,  you  can use the ".na", ".nf", ".fi", and ".ad" requests to
          temporarily disable adjusting and filling.

       -p string, --preprocessor=string
          Specify the sequence of preprocessors to run before nroff or  troff/groff.   Not  all
          installations  will  have a full set of preprocessors.  Some of the preprocessors and
          the letters used to designate them are: eqn (e), grap (g), pic (p), tbl  (t),  vgrind
          (v), refer (r).  This option overrides the $MANROFFSEQ environment variable.  zsoelim
          is always run as the very first preprocessor.

       -t, --troff
          Use groff -mandoc to format the manual page to stdout.  This option is  not  required
          in conjunction with -H, -T, or -Z.

       -T[device], --troff-device[=device]
          This option is used to change groff (or possibly troff's) output to be suitable for a
          device other than the default.  It implies -t.  Examples (provided  with  Groff-1.17)
          include dvi, latin1, ps, utf8, X75 and X100.

       -H[browser], --html[=browser]
          This  option will cause groff to produce HTML output, and will display that output in
          a web browser.  The choice of browser is determined by the optional browser  argument
          if  one  is  provided,  by  the  $BROWSER  environment variable, or by a compile-time
          default if that is unset (usually lynx).  This option implies -t, and will only  work
          with GNU troff.

       -X[dpi], --gxditview[=dpi]
          This  option  displays  the output of groff in a graphical window using the gxditview
          program.  The dpi (dots per inch) may be 75, 75-12, 100, or 100-12, defaulting to 75;
          the  -12  variants  use  a  12-point base font.  This option implies -T with the X75,
          X75-12, X100, or X100-12 device respectively.

       -Z, --ditroff
          groff will run troff and then use an appropriate  post-processor  to  produce  output
          suitable  for the chosen device.  If groff -mandoc is groff, this option is passed to
          groff and will suppress the use of a post-processor.  It implies -t.

   Getting help
       -?, --help
          Print a help message and exit.

       --usage
          Print a short usage message and exit.

       -V, --version
          Display version information.

EXIT STATUS
       0      Successful program execution.

       1      Usage, syntax or configuration file error.

       2      Operational error.

       3      A child process returned a non-zero exit status.

       16     At least one of the pages/files/keywords didn't exist or wasn't matched.

ENVIRONMENT
       MANPATH
          If $MANPATH is set, its value is used as the path to search for manual pages.

       MANROFFOPT
          The contents of $MANROFFOPT are added to the command line every time man invokes  the
          formatter (nroff, troff, or groff).

       MANROFFSEQ
          If  $MANROFFSEQ  is  set,  its value is used to determine the set of preprocessors to
          pass each manual page through.  The default preprocessor list is system dependent.

       MANSECT
          If $MANSECT is set, its value is a colon-delimited list of sections and it is used to
          determine which manual sections to search and in what order.  The default is "1 n l 8
          3 2 3posix 3pm 3perl 3am 5 4 9 6 7", unless overridden by the  SECTION  directive  in
          /etc/manpath.config.

       MANPAGER, PAGER
          If $MANPAGER or $PAGER is set ($MANPAGER is used in preference), its value is used as
          the name of the program used to display the manual page.  By default, pager is  used,
          falling back to cat if pager is not found or is not executable.

          The value may be a simple command name or a command with arguments, and may use shell
          quoting (backslashes, single quotes, or double quotes).  It may not use pipes to con‐
          nect  multiple  commands;  if you need that, use a wrapper script, which may take the
          file to display either as an argument or on standard input.

       MANLESS
          If $MANLESS is set, its value will be used as the default prompt string for the  less
          pager,  as  if it had been passed using the -r option (so any occurrences of the text
          $MAN_PN will be expanded in the same way).  For example,  if  you  want  to  set  the
          prompt   string   unconditionally   to   “my   prompt   string”,   set   $MANLESS  to
          ‘-Psmy prompt string’.  Using the -r option overrides this environment variable.

       BROWSER
          If $BROWSER is set, its value is a colon-delimited list of commands, each of which in
          turn  is  used  to try to start a web browser for man --html.  In each command, %s is
          replaced by a filename containing the HTML output from groff, %%  is  replaced  by  a
          single percent sign (%), and %c is replaced by a colon (:).

       SYSTEM If  $SYSTEM  is  set, it will have the same effect as if it had been specified as the
          argument to the -m option.

       MANOPT If $MANOPT is set, it will be parsed prior to man's command line and is  expected  to
          be  in  a similar format.  As all of the other man specific environment variables can
          be expressed as command line options, and are thus candidates for being  included  in
          $MANOPT  it is expected that they will become obsolete.  N.B.  All spaces that should
          be interpreted as part of an option's argument must be escaped.

       MANWIDTH
          If $MANWIDTH is set, its value is used as the line  length  for  which  manual  pages
          should  be  formatted.   If it is not set, manual pages will be formatted with a line
          length appropriate to the current terminal (using the value of $COLUMNS, an  ioctl(2)
          if  available,  or falling back to 80 characters if neither is available).  Cat pages
          will only be saved when the default formatting can be used, that is when the terminal
          line length is between 66 and 80 characters.

       MAN_KEEP_FORMATTING
          Normally,  when  output  is  not being directed to a terminal (such as to a file or a
          pipe), formatting characters are discarded to make it easier to read the result with‐
          out  special  tools.  However, if $MAN_KEEP_FORMATTING is set to any non-empty value,
          these formatting characters are retained.  This may be useful for wrappers around man
          that can interpret formatting characters.

       MAN_KEEP_STDERR
          Normally, when output is being directed to a terminal (usually to a pager), any error
          output from the command used to produce formatted versions of manual  pages  is  dis‐
          carded  to  avoid interfering with the pager's display.  Programs such as groff often
          produce relatively minor error messages about typographical  problems  such  as  poor
          alignment,  which are unsightly and generally confusing when displayed along with the
          manual page.  However, some users want to see them anyway, so, if $MAN_KEEP_STDERR is
          set to any non-empty value, error output will be displayed as usual.

       LANG, LC_MESSAGES
          Depending on system and implementation, either or both of $LANG and $LC_MESSAGES will
          be interrogated for the current message locale.  man will  display  its  messages  in
          that locale (if available).  See setlocale(3) for precise details.

FILES
       /etc/manpath.config
          man-db configuration file.

       /usr/share/man
          A global manual page hierarchy.

       /usr/share/man/index.(bt|db|dir|pag)
          A traditional global index database cache.

       /var/cache/man/index.(bt|db|dir|pag)
          An FHS compliant global index database cache.

SEE ALSO
       apropos(1), groff(1), less(1), manpath(1), nroff(1), troff(1), whatis(1), zsoelim(1), setlo‐
       cale(3), manpath(5), ascii(7), latin1(7), man(7), catman(8), mandb(8),  the  man-db  package
       manual, FSSTND

HISTORY
       1990, 1991 – Originally written by John W. Eaton (jwe@che.utexas.edu).

       Dec  23  1992:  Rik  Faith  (faith@cs.unc.edu)  applied bug fixes supplied by Willem Kasdorp
       (wkasdo@nikhefk.nikef.nl).

       30th April 1994 – 23rd February 2000: Wilf. (G.Wilford@ee.surrey.ac.uk) has been  developing
       and maintaining this package with the help of a few dedicated people.

       30th  October  1996 – 30th March 2001: Fabrizio Polacco <fpolacco@debian.org> maintained and
       enhanced this package for the Debian project, with the help of all the community.

       31st March 2001 – present day: Colin Watson  <cjwatson@debian.org>  is  now  developing  and
       maintaining man-db.

2.8.3                        2018-04-05                      MAN(1)

  简直长出了人生新高度,权当读阅读理解。

  • 1-1 man man—Shell

  内容

  1-1-1. 导言—用户管理—用户的分类及介绍
  • 1-2 man man—Shell

  内容

  1-2-1. 导言—用户管理—用户的分类及介绍

第2章节 man页面下的键盘操作

  首先随意man一个命令,然后再按h键,可见如下帮助文档:

                   SUMMARY OF LESS COMMANDS

      Commands marked with * may be preceded by a number, N.
      Notes in parentheses indicate the behavior if N is given.
      A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.

  h  H                 Display this help.
  q  :q  Q  :Q  ZZ     Exit.
 ---------------------------------------------------------------------------

                           MOVING

  e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).
  y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).
  f  ^F  ^V  SPACE  *  Forward  one window (or N lines).
  b  ^B  ESC-v      *  Backward one window (or N lines).
  z                 *  Forward  one window (and set window to N).
  w                 *  Backward one window (and set window to N).
  ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
  d  ^D             *  Forward  one half-window (and set half-window to N).
  u  ^U             *  Backward one half-window (and set half-window to N).
  ESC-)  RightArrow *  Right one half screen width (or N positions).
  ESC-(  LeftArrow  *  Left  one half screen width (or N positions).
  ESC-}  ^RightArrow   Right to last column displayed.
  ESC-{  ^LeftArrow    Left  to first column.
  F                    Forward forever; like "tail -f".
  ESC-F                Like F but stop when search pattern is found.
  r  ^R  ^L            Repaint screen.
  R                    Repaint screen, discarding buffered input.
        ---------------------------------------------------
        Default "window" is the screen height.
        Default "half-window" is half of the screen height.
 ---------------------------------------------------------------------------

                          SEARCHING

  /pattern          *  Search forward for (N-th) matching line.
HELP -- Press RETURN for more, or q when done
  ?pattern          *  Search backward for (N-th) matching line.
  n                 *  Repeat previous search (for N-th occurrence).
  N                 *  Repeat previous search in reverse direction.
  ESC-n             *  Repeat previous search, spanning files.
  ESC-N             *  Repeat previous search, reverse dir. & spanning files.
  ESC-u                Undo (toggle) search highlighting.
  &pattern          *  Display only matching lines
        ---------------------------------------------------
        A search pattern may be preceded by one or more of:
        ^N or !  Search for NON-matching lines.
        ^E or *  Search multiple files (pass thru END OF FILE).
        ^F or @  Start search at FIRST file (for /) or last file (for ?).
        ^K       Highlight matches, but don't move (KEEP position).
        ^R       Don't use REGULAR EXPRESSIONS.
 ---------------------------------------------------------------------------

                           JUMPING

  g  <  ESC-<       *  Go to first line in file (or line N).
  G  >  ESC->       *  Go to last line in file (or line N).
  p  %              *  Go to beginning of file (or N percent into file).
  t                 *  Go to the (N-th) next tag.
  T                 *  Go to the (N-th) previous tag.
  {  (  [           *  Find close bracket } ) ].
  }  )  ]           *  Find open bracket { ( [.
  ESC-^F <c1> <c2>  *  Find close bracket <c2>.
  ESC-^B <c1> <c2>  *  Find open bracket <c1> 
        ---------------------------------------------------
        Each "find close bracket" command goes forward to the close bracket 
          matching the (N-th) open bracket in the top line.
        Each "find open bracket" command goes backward to the open bracket 
          matching the (N-th) close bracket in the bottom line.

  m<letter>            Mark the current position with <letter>.
  '<letter>            Go to a previously marked position.
  ''                   Go to the previous position.
  ^X^X                 Same as '.
        ---------------------------------------------------
        A mark is any upper-case or lower-case letter.
        Certain marks are predefined:
             ^  means  beginning of the file
             $  means  end of the file
 ---------------------------------------------------------------------------

                        CHANGING FILES

  :e [file]            Examine a new file.
  ^X^V                 Same as :e.
  :n                *  Examine the (N-th) next file from the command line.
  :p                *  Examine the (N-th) previous file from the command line.
  :x                *  Examine the first (or N-th) file from the command line.
  :d                   Delete the current file from the command line list.
  =  ^G  :f            Print current file name.
 ---------------------------------------------------------------------------

                    MISCELLANEOUS COMMANDS

  -<flag>              Toggle a command line option [see OPTIONS below].
  --<name>             Toggle a command line option, by name.
  _<flag>              Display the setting of a command line option.
  __<name>             Display the setting of an option, by name.
  +cmd                 Execute the less cmd each time a new file is examined.

  !command             Execute the shell command with $SHELL.
  |Xcommand            Pipe file between current pos & mark X to shell command.
  s file               Save input to a file.
  v                    Edit the current file with $VISUAL or $EDITOR.
  V                    Print version number of "less".
 ---------------------------------------------------------------------------

                           OPTIONS

        Most options may be changed either on the command line,
        or from within less by using the - or -- command.
        Options may be given in one of two forms: either a single
        character preceded by a -, or a name preceded by --.
  -?  ........  --help
                  Display help (from command line).
  -a  ........  --search-skip-screen
                  Search skips current screen.
  -A  ........  --SEARCH-SKIP-SCREEN
                  Search starts just after target line.
  -b [N]  ....  --buffers=[N]
                  Number of buffers.
  -B  ........  --auto-buffers
                  Don't automatically allocate buffers for pipes.
  -c  ........  --clear-screen
                  Repaint by clearing rather than scrolling.
  -d  ........  --dumb
                  Dumb terminal.
  -D [xn.n]  .  --color=xn.n
                  Set screen colors. (MS-DOS only)
  -e  -E  ....  --quit-at-eof  --QUIT-AT-EOF
                  Quit at end of file.
  -f  ........  --force
                  Force open non-regular files.
  -F  ........  --quit-if-one-screen
                  Quit if entire file fits on first screen.
  -g  ........  --hilite-search
                  Highlight only last match for searches.
  -G  ........  --HILITE-SEARCH
                  Don't highlight any matches for searches.
  -h [N]  ....  --max-back-scroll=[N]
                  Backward scroll limit.
  -i  ........  --ignore-case
                  Ignore case in searches that do not contain uppercase.
  -I  ........  --IGNORE-CASE
                  Ignore case in all searches.
  -j [N]  ....  --jump-target=[N]
                  Screen position of target lines.
  -J  ........  --status-column
                  Display a status column at left edge of screen.
  -k [file]  .  --lesskey-file=[file]
                  Use a lesskey file.
  -K            --quit-on-intr
                  Exit less in response to ctrl-C.
  -L  ........  --no-lessopen
                  Ignore the LESSOPEN environment variable.
  -m  -M  ....  --long-prompt  --LONG-PROMPT
                  Set prompt style.
  -n  -N  ....  --line-numbers  --LINE-NUMBERS
                  Don't use line numbers.
  -o [file]  .  --log-file=[file]
                  Copy to log file (standard input only).
  -O [file]  .  --LOG-FILE=[file]
                  Copy to log file (unconditionally overwrite).
  -p [pattern]  --pattern=[pattern]
                  Start at pattern (from command line).
  -P [prompt]   --prompt=[prompt]
                  Define new prompt.
  -q  -Q  ....  --quiet  --QUIET  --silent --SILENT
                  Quiet the terminal bell.
  -r  -R  ....  --raw-control-chars  --RAW-CONTROL-CHARS
                  Output "raw" control characters.
  -s  ........  --squeeze-blank-lines
                  Squeeze multiple blank lines.
  -S  ........  --chop-long-lines
                  Chop (truncate) long lines rather than wrapping.
  -t [tag]  ..  --tag=[tag]
                  Find a tag.
  -T [tagsfile] --tag-file=[tagsfile]
                  Use an alternate tags file.
  -u  -U  ....  --underline-special  --UNDERLINE-SPECIAL
                  Change handling of backspaces.
  -V  ........  --version
                  Display the version number of "less".
  -w  ........  --hilite-unread
                  Highlight first new line after forward-screen.
  -W  ........  --HILITE-UNREAD
                  Highlight first new line after any forward movement.
  -x [N[,...]]  --tabs=[N[,...]]
                  Set tab stops.
  -X  ........  --no-init
                  Don't use termcap init/deinit strings.
  -y [N]  ....  --max-forw-scroll=[N]
                  Forward scroll limit.
  -z [N]  ....  --window=[N]
                  Set size of window.
  -" [c[c]]  .  --quotes=[c[c]]
                  Set shell quote characters.
  -~  ........  --tilde
                  Don't display tildes after end of file.
  -# [N]  ....  --shift=[N]
                  Horizontal scroll amount (0 = one half screen width)
      ........  --no-keypad
                  Don't send termcap keypad init/deinit strings.
      ........  --follow-name
                  The F command changes files if the input file is renamed.
      ........  --use-backslash
                  Subsequent options use backslash as escape char.


 ---------------------------------------------------------------------------

                          LINE EDITING

        These keys can be used to edit text being entered 
        on the "command line" at the bottom of the screen.

 RightArrow ..................... ESC-l ... Move cursor right one character.
 LeftArrow ...................... ESC-h ... Move cursor left one character.
 ctrl-RightArrow  ESC-RightArrow  ESC-w ... Move cursor right one word.
 ctrl-LeftArrow   ESC-LeftArrow   ESC-b ... Move cursor left one word.
 HOME ........................... ESC-0 ... Move cursor to start of line.
 END ............................ ESC-$ ... Move cursor to end of line.
 BACKSPACE ................................ Delete char to left of cursor.
 DELETE ......................... ESC-x ... Delete char under cursor.
 ctrl-BACKSPACE   ESC-BACKSPACE ........... Delete word to left of cursor.
 ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
 ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
 UpArrow ........................ ESC-k ... Retrieve previous command line.
 DownArrow ...................... ESC-j ... Retrieve next command line.
 TAB ...................................... Complete filename & cycle.
 SHIFT-TAB ...................... ESC-TAB   Complete filename & reverse cycle.
 ctrl-L ................................... Complete filename, list all.
  • 2-1 man页面下的键盘操作—MOVING

      Commands marked with * may be preceded by a number, N.
      Notes in parentheses indicate the behavior if N is given.
      A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
  h  H                 Display this help.
  q  :q  Q  :Q  ZZ     Exit.

  下文中带*的命令,可以在输入命令前附加一个数字N
  如果给定了数字N,则该命令执行括号()内描述的功能。
  命令前带^符号代表这是一个 Ctrl组合键,^K表示ctrlK
  1、h或H显示本帮助。
  2、q或:q或Q或:Q或ZZ退出本帮助,请注意有大小写之区别。


                           MOVING(移动)

  e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).
  y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).
  f  ^F  ^V  SPACE  *  Forward  one window (or N lines).
  b  ^B  ESC-v      *  Backward one window (or N lines).
  z                 *  Forward  one window (and set window to N).
  w                 *  Backward one window (and set window to N).
  ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
  d  ^D             *  Forward  one half-window (and set half-window to N).
  u  ^U             *  Backward one half-window (and set half-window to N).
  ESC-)  RightArrow *  Right one half screen width (or N positions).
  ESC-(  LeftArrow  *  Left  one half screen width (or N positions).
  ESC-}  ^RightArrow   Right to last column displayed.
  ESC-{  ^LeftArrow    Left  to first column.
  F                    Forward forever; like "tail -f".
  ESC-F                Like F but stop when search pattern is found.
  r  ^R  ^L            Repaint screen.
  R                    Repaint screen, discarding buffered input.
        ---------------------------------------------------
        Default "window" is the screen height.
        Default "half-window" is half of the screen height.

  大抵相同的不在赘述,详述一些相对的难点。
  1、第一行:e,Ctrl E,j,Ctrl N,CR(回车键) 这5种不同方式都是相同功能: ######下翻一行######。如果在指令前附带数字n,则表示下翻n行。
如:

e
#下翻一行
10e
#下翻10行

  输入10时左下角会有提示:


  2、fb单独使用时,是 翻一,但是前加数字n时,是翻n行(请特别注意)。
  3、zw单独使用时,和fb功能相同。不同点在于加数字n后:nz表示下翻n行,同时把one window的长度定义为n行,此后再单独使用fbzw,一次都只会翻动n行,而不是默认的一次翻动一个窗口。
  4、!special note!:只要涉及到含有ESC的组合键,每按一次,必须松开ESC再按下,如果一直按住ESC,组合键第二次及后续均不生效。
  按下ESC同样会有提示

  5、du为上下翻动一个半屏,附加数字n后,效果同第三点。
  6、为左右翻动一个半屏,附加数字n后,效果同第三点。注意ESC )ESC (的按动顺序为先ESCSHIFT0或者9,或者同时按下这3个键亦可。
  7、ESC }ESC {的按动顺序为先ESCSHIFT]或者[,或者同时按下这3个键亦可。ESC }为向右翻动至最后一列,ESC {为向左翻动至第一列(把终端窗口缩小至左右显示不下一屏才能调试出效果)。
  如图所示:


  8、FESC F效果未知。
  • 2-2 man页面下的键盘操作—SEARCHING

                              SEARCHING

  /pattern          *  Search forward for (N-th) matching line.
  ?pattern          *  Search backward for (N-th) matching line.
  n                 *  Repeat previous search (for N-th occurrence).
  N                 *  Repeat previous search in reverse direction.
  ESC-n             *  Repeat previous search, spanning files.
  ESC-N             *  Repeat previous search, reverse dir. & spanning files.
  ESC-u                Undo (toggle) search highlighting.
  &pattern          *  Display only matching lines
        ---------------------------------------------------
        A search pattern may be preceded by one or more of:
        ^N or !  Search for NON-matching lines.
        ^E or *  Search multiple files (pass thru END OF FILE).
        ^F or @  Start search at FIRST file (for /) or last file (for ?).
        ^K       Highlight matches, but don't move (KEEP position).
        ^R       Don't use REGULAR EXPRESSIONS.

  1、/pattern从第一行往下查找字符串所在的,pattern部分用你想要搜索的字符串代替。注意:这里是搜索命中的行,而一行中可能包含多个pattern
  我们以 man ls的内容举例:
  在本页面,直接在键盘输入\for,注意在左下角会有显示。


  输入\for后直接回车,结果如下图。

  关于此页,需要注意三点:
  第一、回滚到文档顶部,可以看到在这个窗口内搜索命中了7次。
  第二、刚才回车之后,页面直接停在了第一行。
  第三、第4个、第5个字符串是在同一行。

  现在考虑问题:
  大部分的搜索命令都支持前输入数字n,表示搜索命中的第n行。如果要让搜索停在上图6所在行,应该输入什么?
  对,应该按顺序输入:5/for
  注意:数字5输入后,再输入/for时,数字5的显示会被覆盖,不影响正常操作。
  搜索结果显示如下:
  对比上图,正好停在上图6数字处。也就是命中的第5行:

  2、?pattern!本页的!最后一行往上查找字符串所在行。找到该行后,将该行放置于页面首行。
  依然考虑标有1-7数字的那张图片。如果我在此页面下,输入2?for,那页面首行会停在什么位置?
  对的,又说对了,页面首行停在了数字6所在行。是的,这正好和5/for效果是相同的。

  3、n。第一、如果上条命令是/pattern,则按n后,会向移动到下1个命中的行(步长为1)。输入N则向移动。
  如果输入数字+n,则会向移动到下数字个命中的行,比如输入2n,则向下移动的步长为2。输入N则向移动。
  第二、如果上条命令是?pattern,则按n后,会向移动到上1个命中的行(步长为1)。输入N则向移动。
  如果输入数字+n,则会向移动到上数字个命中的行,比如输入2n,则向上移动的步长为2。输入N则向移动。
  4、N,类比上一条。
  5、ESC-n类似n,但可以跨文件搜索。
  6、ESC-N类似N,跨文件搜索。
  7、ESC-u取消或打开命中的字符串的高亮,相当于一个开关。
  8、&pattern只显示命中搜索的的字符串所在的行。
  • 2-3 man页面下的键盘操作—JUMPING


                           JUMPING

  g  <  ESC-<       *  Go to first line in file (or line N).
  G  >  ESC->       *  Go to last line in file (or line N).
  p  %              *  Go to beginning of file (or N percent into file).
  t                 *  Go to the (N-th) next tag.
  T                 *  Go to the (N-th) previous tag.
  {  (  [           *  Find close bracket } ) ].
  }  )  ]           *  Find open bracket { ( [.
  ESC-^F <c1> <c2>  *  Find close bracket <c2>.
  ESC-^B <c1> <c2>  *  Find open bracket <c1> 
        ---------------------------------------------------
        Each "find close bracket" command goes forward to the close bracket 
          matching the (N-th) open bracket in the top line.
        Each "find open bracket" command goes backward to the open bracket 
          matching the (N-th) close bracket in the bottom line.

  m<letter>            Mark the current position with <letter>.
  '<letter>            Go to a previously marked position.
  ''                   Go to the previous position.
  ^X^X                 Same as '.
        ---------------------------------------------------
        A mark is any upper-case or lower-case letter.
        Certain marks are predefined:
             ^  means  beginning of the file
             $  means  end of the file

  1、g或<或ESC <,跳到首行。
  2、跳到尾行。
  3、p或者%,含义为percent百分比。单独输入这两个字符,则表示为翻动到文档的百分之0处,相等同于翻动到页面的开始。
  4、t或者
  5、T或者
  6、{或者,找到右括号。=》功能待查《=。
  7、}或者,找到左括号。=》功能待查《=。
  8、ESC-Shift-Ctrl+f,要按下4个键。注意可能会和系统按键有冲突。=》功能待查《=。
  9、ESC-Shift-Ctrl+b。=》功能待查《=。
  10、m加一个字母。在首行添加一个标记。

  11、加一个字符。跳到这个标记所在的首行。
  12、。=》功能待查《=。 &emsp;&emsp;13、Shift+Ctrl+x连续两次。效果等于按一次&emsp;&emsp;14、marks^$`。=》功能待查《=。
  • 2-4 man页面下的键盘操作—CHANGING FILES

                              CHANGING FILES

  :e [file]            Examine a new file.
  ^X^V                 Same as :e.
  :n                *  Examine the (N-th) next file from the command line.
  :p                *  Examine the (N-th) previous file from the command line.
  :x                *  Examine the first (or N-th) file from the command line.
  :d                   Delete the current file from the command line list.
  =  ^G  :f            Print current file name.

  首先我们设定这么一个情况:在/home/li/123路径下,有名为qwe的文件,内容如图所示。


  1、:e文件名。跳转到另外一个文件。
  此时输入:e /home/li/123/qwe,回车。

  效果如图,可以看到已经进入了qwe文件。

  2、Shift+Ctrl+x Shift+Ctrl+v效果等同于:e
  如果我们再一个文件的搜索过程中打开了另外一个文件,如此反复多次,则形成了一个搜索的文件流,如:
  文件1文件2文件3文件4
  形成了文件流后,则可进行如下操作:
  3、:n,翻动到下一个文件。
  4、:p,翻动到上一个文件。
  5、:x,翻动到第一个文件。
  6、:d,在文件流中删除本文件。
  7、= ^G :f,显示当前文档名。

  • 2-5 man页面下的键盘操作—MISCELLANEOUS COMMANDS

                     MISCELLANEOUS COMMANDS

  -<flag>              Toggle a command line option [see OPTIONS below].
  --<name>             Toggle a command line option, by name.
  _<flag>              Display the setting of a command line option.
  __<name>             Display the setting of an option, by name.
  +cmd                 Execute the less cmd each time a new file is examined.

  !command             Execute the shell command with $SHELL.
  |Xcommand            Pipe file between current pos & mark X to shell command.
  s file               Save input to a file.
  v                    Edit the current file with $VISUAL or $EDITOR.
  V                    Print version number of "less".

                           OPTIONS

        Most options may be changed either on the command line,
        or from within less by using the - or -- command.
        Options may be given in one of two forms: either a single
        character preceded by a -, or a name preceded by --.
  -?  ........  --help
                  Display help (from command line).
  -a  ........  --search-skip-screen
                  Search skips current screen.
  -A  ........  --SEARCH-SKIP-SCREEN
                  Search starts just after target line.
  -b [N]  ....  --buffers=[N]
                  Number of buffers.
  -B  ........  --auto-buffers
                  Don't automatically allocate buffers for pipes.
  -c  ........  --clear-screen
                  Repaint by clearing rather than scrolling.
  -d  ........  --dumb
                  Dumb terminal.
  -D [xn.n]  .  --color=xn.n
                  Set screen colors. (MS-DOS only)
  -e  -E  ....  --quit-at-eof  --QUIT-AT-EOF
                  Quit at end of file.
  -f  ........  --force
                  Force open non-regular files.

  4、-e -E,翻动到文件末尾自动退出。

  -F  ........  --quit-if-one-screen
                  Quit if entire file fits on first screen.
  -g  ........  --hilite-search
                  Highlight only last match for searches.
  -G  ........  --HILITE-SEARCH
                  Don't highlight any matches for searches.
  -h [N]  ....  --max-back-scroll=[N]
                  Backward scroll limit.
  -i  ........  --ignore-case
                  Ignore case in searches that do not contain uppercase.
  -I  ........  --IGNORE-CASE
                  Ignore case in all searches.
  -j [N]  ....  --jump-target=[N]
                  Screen position of target lines.
  -J  ........  --status-column
                  Display a status column at left edge of screen.
  -k [file]  .  --lesskey-file=[file]
                  Use a lesskey file.
  -K            --quit-on-intr
                  Exit less in response to ctrl-C.

  3、-J,在窗口左侧显示一个状态列。

  -L  ........  --no-lessopen
                  Ignore the LESSOPEN environment variable.
  -m  -M  ....  --long-prompt  --LONG-PROMPT
                  Set prompt style.
  -n  -N  ....  --line-numbers  --LINE-NUMBERS
                  Don't use line numbers.
  -o [file]  .  --log-file=[file]
                  Copy to log file (standard input only).
  -O [file]  .  --LOG-FILE=[file]
                  Copy to log file (unconditionally overwrite).

  1、-L,。

li@li-ThinkPad-T420s:~/123$ echo $LESSOPEN
| /usr/bin/lesspipe %s

  3、-n,关闭行号显示。-N加回车,开启行号显示。
  4、-o加文件名,将文档内容输出到文件中。读写会提示。
  如果出现can not write的提示,多半是文件写权限问题,用chmod修改权限后再写入。
  5、-O加文件名,无条件直接覆写。

  -p [pattern]  --pattern=[pattern]
                  Start at pattern (from command line).
  -P [prompt]   --prompt=[prompt]
                  Define new prompt.
  -q  -Q  ....  --quiet  --QUIET  --silent --SILENT
                  Quiet the terminal bell.
  -r  -R  ....  --raw-control-chars  --RAW-CONTROL-CHARS
                  Output "raw" control characters.
  -s  ........  --squeeze-blank-lines
                  Squeeze multiple blank lines.

  3、-q -Q,开关终端提示音。翻动到行首或行尾再继续翻动会有“咚咚”的提示音。

  -S  ........  --chop-long-lines
                  Chop (truncate) long lines rather than wrapping.
  -t [tag]  ..  --tag=[tag]
                  Find a tag.
  -T [tagsfile] --tag-file=[tagsfile]
                  Use an alternate tags file.
  -u  -U  ....  --underline-special  --UNDERLINE-SPECIAL
                  Change handling of backspaces.
  -V  ........  --version
                  Display the version number of "less".

  1、-S,一行显示不下的时候不折行,直接chop掉。
  4、-u,开启关闭加黑、下划线效果。-U,待查。
  5、-V,显示“less”的数字版本号。

  -w  ........  --hilite-unread
                  Highlight first new line after forward-screen.
  -W  ........  --HILITE-UNREAD
                  Highlight first new line after any forward movement.
  -x [N[,...]]  --tabs=[N[,...]]
                  Set tab stops.
  -X  ........  --no-init
                  Don't use termcap init/deinit strings.
  -y [N]  ....  --max-forw-scroll=[N]
                  Forward scroll limit.

  1、-w,使用zf进行下翻整屏的时候,高亮显示新的未读页的首行。
  2、-W,使用zfd进行下翻屏的时候,高亮显示新的未读的首行。

  -z [N]  ....  --window=[N]
                  Set size of window.
  -" [c[c]]  .  --quotes=[c[c]]
                  Set shell quote characters.
  -~  ........  --tilde
                  Don't display tildes after end of file.
  -# [N]  ....  --shift=[N]
                  Horizontal scroll amount (0 = one half screen width)
      ........  --no-keypad
                  Don't send termcap keypad init/deinit strings.
      ........  --follow-name
                  The F command changes files if the input file is renamed.
      ........  --use-backslash
                  Subsequent options use backslash as escape char.

  1、-zN,设置一个窗口的大小为N行。
  3、-~,在文档末尾之后不显示~符号。
  4、-#N,设置水平移动时窗口的大小为N列。

  • 2-6 man页面下的键盘操作—LINE EDITING

                                   LINE EDITING

        These keys can be used to edit text being entered 
        on the "command line" at the bottom of the screen.

 RightArrow ..................... ESC-l ... Move cursor right one character.
 LeftArrow ...................... ESC-h ... Move cursor left one character.
 ctrl-RightArrow  ESC-RightArrow  ESC-w ... Move cursor right one word.
 ctrl-LeftArrow   ESC-LeftArrow   ESC-b ... Move cursor left one word.
 HOME ........................... ESC-0 ... Move cursor to start of line.
 END ............................ ESC-$ ... Move cursor to end of line.
 BACKSPACE ................................ Delete char to left of cursor.
 DELETE ......................... ESC-x ... Delete char under cursor.
 ctrl-BACKSPACE   ESC-BACKSPACE ........... Delete word to left of cursor.
 ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
 ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
 UpArrow ........................ ESC-k ... Retrieve previous command line.
 DownArrow ...................... ESC-j ... Retrieve next command line.
 TAB ...................................... Complete filename & cycle.
 SHIFT-TAB ...................... ESC-TAB   Complete filename & reverse cycle.
 ctrl-L ................................... Complete filename, list all.

  在命令模式下的文本操作及编辑:
  1、ESC-l(每次操作都需要松开ESC再次按下):光标右移一个字符。
  2、ESC-h:光标左移一个字符。
  3、ESC-→ESC-w:光标右移一个单词(以空格隔开)。ctrl-RightArrow出现乱码。
  4、ESC-←ESC-b:光标左移一个单词(以空格隔开)。ctrl-LeftArrow出现乱码。
  5、HOMEESC-0:光标移动到行首。
  6、ENDESC-$:光标移动到行尾。
  7、BACKSPACE:删除光标左侧一个字符。
  8、DELETEESC-x:删除光标当下指向的一个字符。
  9、ctrl-BACKSPACEESC-BACKSPACE:Delete word to left of cursor(测试无效)。
  10、ESC-DELETEESC-X:删除光标指向的单词(从光标处起,一直删到空格为止,空格后面的单词保留)。 ctrl-DELETE出现乱码。
  11、ESC-k:上翻历史命令。
  12、ESC-j:下翻历史命令。
  13、TAB:出现乱码。
  14、SHIFT-TAB:出现乱码。
  15、ctrl-L:出现乱码。

相关文章

网友评论

      本文标题:man的使用

      本文链接:https://www.haomeiwen.com/subject/hmvjjctx.html