日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux/Unix 如何查看 man 搜索到的手册页(manual page)的位置及复制手册页的内容

發布時間:2023/12/3 linux 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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)的位置及复制手册页的内容的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。