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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/333586.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

xml不利于调试_流利的接口不利于维护

xml不利于调试流畅的界面 (最初由Martin Fowler 创造)是一种与OOP中的对象进行通信的非常便捷的方式。 它使他们的外墙更易于使用和理解。 但是,它破坏了它们的内部设计,使它们更难以维护。 Marco Pivetta在他的博客文章Fluent In…

java输入月份求天数_java输入年份,月份,输出当月天数

package 第二次作业; public class 第二题 { //java文件名 public static void main(String[] args) { //相当于创建主函数 String 年份 = javax.swing.JOptionPane.showInputDialog("输入一个年份:"); //求出输…

java 换行 运算符格式_Java代码样式运算符换行格式

java 换行 运算符格式上周,我发现了什么决定了我在较长时间里一直在努力解决的问题的决定:是否放置&& , ||之类的运算符 或在同一行或下一行。 在构造布尔表达式或隐含字符串时,我们可能需要中断长行。 根据《 Google Ja…

pipeline java_架构模式:pipeline

知名的 Pipeline 模式unix 的 pipelinecat helloworld.txt | grep "hello world" | rev | > output.txt读取文本内容,并过滤 “hello world”,然后反转字符,将最终结果输出到 output.txtWeb 框架中间件Laravel 中的管道Laravel …

MacOS 系统使用命令安装软件包

文章目录 使用 Homebrew 安装软件包先安装 Homebrew使用命令 brew 安装软件包使用命令 installer 安装 pkg 软件包使用命令安装 dmg 格式的软件包包含普通的应用程序文件的 dmg 文件如何使用命令完成安装呢?包含 pkg 安装程序的 dmg 文件又该如何通过命令完成安装呢?Linux 操…

身份证验证 校验码_用户身份验证最佳做法清单

身份证验证 校验码用户身份验证是每个Web应用程序共享的功能。 我们已经实施了很多次了,所以早就应该完善它了。 然而,错误无时无刻不在。 造成这种情况的部分原因是,可能出错的事情列表很长。 您可能会错误地存储密码,可能会具有…

mysql查询不确定的信息_mysql 07.18

1.索引搜索引导,索引是一个特殊的数据结构,期存储的是数据的关键信息与详细详细的位置对应关系。目的:加速查询。索引的影响:不是说拥有索引就能加速,得看你的查询语句有没有正确使用索引,索引也需要占用额…

MacOS 常用命令汇总

文章目录设置环境变量列出所有可以更新的软件包直接更新所有可以更新的软件包打包压缩文件忽略 Mac OS 文件系统中的扩展属性忽略 Mac OS 专有的隐藏文件创建 DMG 格式的文件修改 DMG 文件的大小修改 DMG 格式中的加密口令挂载 DMG 格式的文件推出 DMG 文件将 ISO 格式的文件转…

java多功能钟_Java 11将包含更多功能

java多功能钟Java 11即将发布的功能是什么?它与Java 9和10有何不同? Java 10可能是新手,但现在该谈论Java 11了。Oracle迈向更快的发布周期意味着更多的特性和功能以比以往更快的速度出现。 尽管距离Java 11发行还有六个月的时间&#xff0…

MacOS 好用的插件和图形界面程序

文章目录文件预览插件OS X 图形界面程序文件预览插件 有些插件可以让 Mac 上的文件预览更有效,比如语法高亮、markdown 渲染、json 预览等。 $ brew cask install qlcolorcode $ brew cask install qlstephen $ brew cask install qlmarkdown $ brew cask install…

java 线程安全性_我如何测试Java类的线程安全性

java 线程安全性我在最近的一次网络研讨会中谈到了这个问题,现在是时候以书面形式进行解释了。 线程安全是Java等语言/平台中类的重要品质,在Java中我们经常在线程之间共享对象。 缺乏线程安全性导致的问题很难调试,因为它们是零星的&#xf…

java asin_Java asin()方法

Java asin()方法asin() 方法用于返回指定double类型参数的反正弦值。语法doubleasin(doubled)参数 d -- 任何原生数据类型。返回值返回指定double类型参数的反正弦值。实例public class Test{public static void main(String args[]){double degrees 45.0;double radians Mat…

MacOS 的软件包管理工具 HomeBrew 详解

文章目录一、软件介绍二、安装 Homebrew使用 Ruby 或者 Shell 脚本安装手动 clone 安装三、卸载 Homebrew四、Homebrew 安装目录五、安装包所在位置六、程序安装目录七、软件版本切换八、清除旧版本文件九、brew 命令汇总安装、升级和删除软件包查看和检验软件包参考示例服务相…

java中的深度克隆浅克隆_了解Java中的可克隆接口

java中的深度克隆浅克隆什么是对象克隆? 对象克隆是生成具有不同名称的对象的精确字段到字段副本的过程。 克隆的对象在内存中有自己的空间,可在其中复制原始对象的内容。 这就是为什么在克隆后更改原始对象的内容时,所做的更改不会反映在克隆…

python env_#!/usr/bin/env python 有什么用?

我们经常会在别人的脚本或者项目的入口文件里看到第一行是下面这样#!/usr/bin/python或者这样#!/usr/bin/env python那么他们有什么用呢?要理解它,得把这一行语句拆成两部分。第一部分是 #!第二部分是 /usr/bin/python 或者 /usr/bin/env python关于 #! …

MacBook(macOS) 如何安装 Homebrew Cask(作废)

文章目录重要通知(不要再去安装 Homebrew Cask 了)Homebrew Cask 简介相关文件和目录Homebrew Cask 安装使用命令下载安装直接从官网下载安装包利用国内源手动 clone下载(推荐)Homebrew Cask 换源重要通知(不要再去安装…

java.io.file()_JAVA基础知识之IO-File类

File类介绍File是java.io包下面的一个类,代表与平台无关的文件或者目录。JAVA中,无论文件还是目录,都可以看作File类的一个对象。File类能对文件或目录新建,删除,获取属性等操作,但是不能直接操作文件内容(…

netflix 模式创新_创新设计模式:单例模式

netflix 模式创新单例设计模式是一种软件设计模式,用于将类的实例化限制为一个对象。 与其他创建设计模式(例如抽象工厂 , 工厂和构建器模式)相比,单例将创建一个对象,但也将负责,因此该对象只…

美式英语 [t] 的发音

爆破音 true [t],发真实的 t。 单词的开始处重读音节的开始处,且前面没有跟着清辅音 [s] held 住不发声 叫法很多,声门塞音、吞音、喉塞(s)音、stop [t],held [t],不爆破的 [t]。 发音的口…

设计模式 原型模式_创新设计模式:原型模式

设计模式 原型模式原型模式用于创建对象的副本。 这种模式非常有用,特别是当从头开始创建对象的成本很高时。 与builder , factory和abstract factory模式相比,它不会从头开始创建对象,而是会克隆/重新创建它。 与单例模式相比&a…