Linux/Unix 如何查看 man 搜索到的手册页(manual page)的位置及复制手册页的内容
生活随笔
收集整理的這篇文章主要介紹了
Linux/Unix 如何查看 man 搜索到的手册页(manual page)的位置及复制手册页的内容
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 命令 man 是如何搜索手冊頁的?
- 如何查看手冊頁所在的路徑
- 通過管道輸出給 vim
命令 man 是如何搜索手冊頁的?
man uses a sophisticated method of finding manual page files, based on the invocation options and environment variables, the /private/etc/man.conf configuration file, and some built in conventions and heuristics.First of all, when the name argument to man contains a slash (/), man assumes it is a file specification itself, and there is no searching involved.But in the normal case where name doesn't contain a slash, man searches a variety of directories for a file thatcould be a manual page for the topic named.If you specify the -M pathlist option, pathlist is a colon-separated list of the directories that man searches.If you don't specify -M but set the MANPATH environment variable, the value of that variable is the list of thedirectories that man searches.If you don't specify an explicit path list with -M or MANPATH, man develops its own path list based on the contents of the configuration file /private/etc/man.conf. The MAN-PATH statements in the configuration file identify particular directories to include in the search path.Furthermore, the MANPATH_MAP statements add to the search path depending on your command search path (i.e. your PATH environment variable). For each directory that may be in the command search path, a MANPATH_MAP statement specifies a directory that should be added to the search path for manual page files. man looks at the PATH variable and adds the corresponding directories to the manual page file search path. Thus, with the proper use of MANPATH_MAP, when you issue the command man xyz, you get a manual page for the program that would run if you issued the command xyz.In addition, for each directory in the command search path (we'll call it a "command directory") for which you do not have a MANPATH_MAP statement, man automatically looks for a manual page directory "nearby" namely as a subdirectory in the command directory itself or in the parent directory of the command directory.You can disable the automatic "nearby" searches by including a NOAUTOPATH statement in /private/etc/man.conf.In each directory in the search path as described above, man searches for a file named topic.section, with an optional suffix on the section number and possibly a compression suffix. If it doesn't find such a file, it then looks in any subdirectories named manN or catN where N is the manual section number. If the file is in a catN subdirectory,man assumes it is a formatted manual page file (cat page). Otherwise, man assumes it is unformatted. In either case, if the filename has a known compression suffix (like.gz), man assumes it is gzipped.If you want to see where (or if) man would find the manual page for a particular topic, use the --path (-w) option.如何查看手冊頁所在的路徑
如果您想查看某個特定主題的手冊頁在哪里(或是否在哪里),請使用 --path 或 -w 選項。例如,我想知道命令man的手冊頁文件在哪里,可以輸入下面的命令:
lwxdeMacBook-Air:cmd lwx$ man -w man /usr/share/man/man1/man.1 lwxdeMacBook-Air:~ lwx$ cp /usr/share/man/man1/man.1 /Users/liaowenxiong/desktop # copy to desktop to look look通過管道輸出給 vim
執行以下的命令就可以用 vim 的快捷鍵/命令來復制里面的內容:
man command_name | vim總結
以上是生活随笔為你收集整理的Linux/Unix 如何查看 man 搜索到的手册页(manual page)的位置及复制手册页的内容的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 振兴银行振兴存受存款保险保护吗?
- 下一篇: Windows 系统下通过命令将本地文件