man
代号 | 代表内容 |
---|---|
1 | 用户在 shell 中可以操作的命令或可执行文件 |
2 | 系统核心可呼叫的函数与工具等 |
3 | 一些常用的函数(function)与函数库(library),大部分是C的函数库(libc) |
4 | 装置档案的说明,通常在 /dev 下的档案 |
5 | 设定档或者是某些档案的格式 |
6 | 游戏(games) |
7 | 惯例与协定等,例如 Linux 档案系统、网络协定、ASCII code 等等的说明 |
8 | 系统管理员可用的管理命令 |
9 | 跟 kernel 有关的文件 |
下载中文
sudo apt install manpages-zh
cd
echo "alias cman='man -M /usr/share/man/zh_CN' " >> .bash_aliases
source .bash_aliases
然后用 cman
查看就行。
默认没有 C 语言函数的说明文档,需要手动安装:
sudo apt install manpages-dev
为你的程序书写 Manual
推荐在 /usr/local/man
放置你的 Manual,可以通过 /etc/man.config
文件指定其他搜索位置,如:
MANPATH /usr/man
MANPATH /usr/share/man
MANPATH /usr/local/man
MANPATH /usr/local/share/man
MANPATH /usr/X11R6/man
一般格式为:
NAME
The name of the command or function, followed by a one-line description of what it does.
SYNOPSIS(概要)
In the case of a command, you get a formal description of how to run it and what command line options it takes.
DESCRIPTION
A textual description of the functioning of the command or function.
EXAMPLES
Some examples of common usage.
SEE ALSO
A list of related commands or functions.
BUGS
List known bugs.
AUTHOR
Specify your contact information.
COPYRIGHT
Specify your copyright information.
groff(GNU Troff)是一个排版软件,可以用它生成 man page。编辑 nuseradd
文件,粘贴以下内容:
.\" Manpage for nuseradd.
.\" Contact vivek@nixcraft.net.in to correct errors or typos.
.TH man 8 "06 May 2010" "1.0" "nuseradd man page"
.SH NAME
nuseradd \- create a new LDAP user
.SH SYNOPSIS
nuseradd [USERNAME]
.SH DESCRIPTION
nuseradd is high level shell program for adding users to LDAP server. On Debian, administrators should usually use nuseradd.debian(8) instead.
.SH OPTIONS
The nuseradd does not take any options. However, you can supply username.
.SH SEE ALSO
useradd(8), passwd(5), nuseradd.debian(8)
.SH BUGS
No known bugs.
.SH AUTHOR
Vivek Gite (vivek@nixcraft.net.in)
查看:
man ./nuseradd
把它放到 /usr/local/man/man8/nuseradd.8
然后用 gzip
压缩就可以用 man nuseradd
查看了。