Linux Manual

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 查看了。

引用

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值