The man command is used to format and display the man pages.

The man pages are a user manual that is by default built into most Linux distributions (i.e., versions) and most other Unix-like operating systems during installation. They provide extensive documentation about commands and other aspects of the system, including configuration filessystem callslibrary routines and the kernel (i.e., the core of the operating system). A configuration file is a type of simple database that contains data that tells a program or operating system how to behave. A system call is a request made via a software interrupt (i.e., a signal to the kernel initiated by software) by an active process for a service performed by the kernel. A library routine is a subprogram that is used by programmers to simplify the development of software.

The man pages are tailored to the particular operating system, and version thereof, on which they are installed. This is beneficial because there can be slight differences in commands and other items according to the particular system.

The descriptions are rather terse, and they can seem somewhat cryptic to new users. However, users typically find them to be increasingly useful as they become more familiar with them and gain experience in the use of Unix-like operating systems.

The man command itself is extremely easy to use. Its basic syntax is

man [option(s)] keyword(s)

man is most commonly used without any options and with only one keyword. The keyword is the exact name of the command or other item for which information is desired. For example, the following provides information about the ls command (which is used to list the contents of any specified directory):

man ls

As another example, the following displays the man page about the man pages:

man man

man automatically sends its output through a pager, usually the program less. A pager is a program that causes the output of any program to be displayed one screenful at a time, rather than having a large amount of text scroll down the screen at high (and generally unreadable) speed.

less writes a colon at the bottom of the screen to indicate the end of the on-screen page. The user can move to the next page by pushing the space bar and can return to the previous page by pressing the b key. Pressing the q exits the man pages and returns the user to the shell program.

Each man page is a self-contained article that is divided into a number of sections, the headers for which are labeled with upper case letters. The sections for commands are typically something like NAME, SYNOPSIS, DESCRIPTION, OPTIONS, AUTHOR, BUGS, COPYRIGHT, HISTORY and SEE ALSO, although there may be some differences according to the particular command. Some of these might be broken down into subsections, particularly OPTIONS in the case of a command that has numerous options.

Also, the man pages as a whole are organized into sections, each containing pages about a specific category of topics as shown below. The section to which an article belongs is indicted in parenthesis in the top line, before the NAME header.

1. executable programs or shell commands 
2. system calls 
3. library routines 
4. special files (i.e., devices in the /dev directory) 
5. file formats 
6. games 
7. macro packages 
8. system administration commands 
9. kernel routines 
n. Tcl/Tk (a programming language)

Some topic names will have multiple articles, depending on context. For instance, there are two articles for mount, one corresponding to its use as a command in system management (i.e., to logically attach partition or other devices to the main filesystem) and the other for use in the C programming language. Generally, the most commonly used topic is displayed by default, and there are references to any other topics with the same name in the SEE ALSO section at the bottom of the final on-screen page.

The syntax to specify an article from a particular section is:

man section_number keyword

Thus, for example, the following would display the article about mount from Section 2 instead of from the default Section 8:

man 2 mount

The -w and -W options tell man to not actually display the man pages, but to provide the location(s) of the file(s) that would be formatted or displayed. If no arguments (i.e., input files) are provided, a list of directories that is searched by man for man pages is returned.

The -f option produces the same output as the whatis command. whatis provides very brief descriptions of commands from a database that is automatically created from the first line of the NAME section of each relevant man page. The -h option displays a terse summary of man's syntax and options.

A simpler version of a man page, i.e., without backspaces and underscores, can be obtained by piping (i.e., transferring) its output to the col command used with its -b option. Thus, for example, the following would write such a version of the man page about the pstree command (which shows the processes currently on the system in a tree diagram) to a text file called pstree.txt (and create a file with this name if it did not already exist):

man pstree | col -b > pstree.txt

Unix-like operating systems often also have an additional built-in manual referred to as the Info documents, the content of which is largely identical to that of the man pages. These documents can be accessed with the info command.

Although the man pages are usually viewed in a console (i.e., all-text mode) or terminal window (i.e., a text-mode window in a GUI), they can also be viewed in the Konquerer web browser, which is included with many Linux distributions. Some users might find that this provides enhanced usability, including the ability to scroll up and down an entire article regardless of its length and greater ease of changing font sizes. Any man article can be displayed in Konquerer by typing man followed by a colon and the name of the program.

Thus, for example, the following would tell Konquerer to display the man page for pstree:

man:pstree

The Linux Information Project (LINFO) is providing an on-line alternative to the man pages with its series of articles about commonly used commands and other aspects of Linux. One major difference is that the LINFO articles are designed to be useful to users of all levels, including absolute beginners. In particular, emphasis is placed on the most useful options for commands and specific examples are often provided. An index, along with brief descriptions, of such articles about commands that have been provided to date is Index of Linux Commands.

The man Command的更多相关文章

  1. ifconfig: command not found(CentOS专版,其他的可以参考)

    ifconfig: command not found 查看path配置(echo相当于c中的printf,C#中的Console.WriteLine) echo $PATH 解决方案1:先看看是不是 ...

  2. scp报错 -bash: scp: command not found

    环境:RHEL6.5 使用scp命令报错: [root@oradb23 media]# scp /etc/hosts oradb24:/etc/ -bash: scp: command not fou ...

  3. ENode框架单台机器在处理Command时的设计思路

    设计目标 尽量快的处理命令和事件,保证吞吐量: 处理完一个命令后不需要等待命令产生的事件持久化完成就能处理下一个命令,从而保证领域内的业务逻辑处理不依赖于持久化IO,实现真正的in-memory: 保 ...

  4. 设计模式(六):控制台中的“命令模式”(Command Pattern)

    今天的博客中就来系统的整理一下“命令模式”.说到命令模式,我就想起了控制台(Console)中的命令.无论是Windows操作系统(cmd.exe)还是Linux操作系统(命令行式shell(Comm ...

  5. GET command找不到

    谷歌的: On running a cronjob with get command, I was getting the following error. /bin/sh: GET: command ...

  6. source /etc/profile报错-bash: id:command is not found

    由于误操作导致 source /etc/profile 报错 -bash: id:command is not found 此时,linux下很多命令到不能能用,包括vi ls 等... 可以使用 e ...

  7. Webform(七)——内置对象(Session、Application)和Repeater的Command操作

    内置对象:用于页面之间的数据交互 为什么要使用这么内置对象?因为HTTP的无状态性. 一.内置对象 (一)Session 跟Cookies一样用来存储用户数据 1.Session.Cookies对比 ...

  8. MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL

    MDK st-link下载STM32程序出现Internal command error和Error:Flash download failed. Target DLL   是因为目标板的芯片处于休眠 ...

  9. mac 修改command+q 退出

    实在受不了! 在chrome中command+w 是关闭当前页面,command+q 退出浏览器: 经常查阅资料打开了N多个窗口,关闭时不小心将command+q当command+w按: so ... ...

  10. Ubuntu中配置Java环境变量时,出现command not found问题解决记录

    百度出Ubuntu中配置Java环境变量时,在利用sudo gedit /etc/profile 对profile编辑后, 在terminal中输入 sudo source /etc/profile, ...

随机推荐

  1. 【C#系列】浅谈委托和委托

    本篇文章更适合具有一定开发经验,一定功底,且对底层代码有所研究的朋友!!! 本篇文章主要采用理论和代码实例相结合方法来论述委托和事件,涉及到一些边界技术,如软件架构的OCP原则(开-闭原则), 软件架 ...

  2. SQLAlchemy框架用法详解

    介绍 SQLAlchemy是一个基于Python实现的ORM框架.该框架建立在 DBAPI之上,使用关系对象映射进行数据库操作,简言之便是:将类和对象转换成SQL,然后使用数据API执行SQL并获取执 ...

  3. Django----->一周后的重温

    Django   一 什么是web框架? 框架,即framework,特指为解决一个开放性问题而设计的具有一定约束性的支撑结构,使用框架可以帮你快速开发特定的系统,简单地说,就是你用别人搭建好的舞台来 ...

  4. isdigit函数

    isdigit是计算机应用C语言中的一个函数,主要用于检查参数c是否为阿拉伯数字0到9. 相关函数 isdigit 表头文件 #include <ctype.h>(C语言),#includ ...

  5. enum与typedef enum

    enum与typedef enum的用法 在程序中,可能需要为某些整数定义一个别名,我们可以利用预处理指令#define来完成这项工作,您的代码可能是: #define MON  1#define T ...

  6. 支付宝当面付开发(java)

    支付宝当面付开发(java) 业务流程:       接入准备:   直接下载demo: https://doc.open.alipay.com/doc2/detail.htm?spm=a219a.7 ...

  7. 【搬运】Tea算法Java实现工具类

    最近在做数据加密,目标是实现平台app的数据安全性,所以准备使用AES+Base64进行加密,适逢一个特长的json串AES加密不了,于是在谷歌了各种算法,判断是否合用,参见 各种加密算法比较 一文中 ...

  8. Windows7下设置定时启动(关闭)虚拟机

    曾记否,忆当年,开启或者关闭虚拟机,度秒如年~ ⒈石头,剪刀,布,C.D.E盘随便找一个,然后在里面找个静谧的墙角, 新建一个文件:vmstart.bat 添加:"C:\Program Fi ...

  9. Solr学习笔记1(V7.2)

    下载压缩包http://archive.apache.org/dist/lucene/,解压后放到某一盘符下面 Windows下启动命令 :\solr-7.2.0>bin\solr.cmd st ...

  10. IIS、nginx、apache只允许域名访问配置

    您开启WAF后,攻击者只能看到WAF的IP,不能看到您的IP,攻击者通过域名访问您的网站时,就会根据规则拦截. 但是如果您的网站可以输入IP地址直接访问,是无法达到防御效果的.比如(http://42 ...