linux下如何快速学习新命令之man命令完美解释

来源:互联网 发布:网络危机管理 编辑:程序博客网 时间:2024/06/05 19:45

场景

如何通过查看manunal手册学习一个新的命令


问题

manual 手册的语法细节


分析

一、共分为9个章节

manual手册按照命令的特性将其分在不同的9个章节里。


Man Page Sections名称例子备注1、Applicationsls

list directory contents
查看目录的内容
任何用户都可以使用
2、System Callschown
#include <sys/types.h> 
#include <unistd.h>
int chown(const char *path, uid_t owner, gid_t group); 

改变一个文件的属主或者属组
3、Library (Functions)abs
#include <stdlib.h>
int abs(int j);
求一个整数的绝对值
4、Hardware (d evices)tty
 controlling terminal 
终端控制台
5、Configuration (Files) inittabDescribes which processes are started at bootup and during normal operation (e.g. /etc/init.d/boot, /etc/init.d/rc, gettys...). 6、Gamesxboard 羡慕具体怎么玩不清楚7、OverviewsipLinux IPv4 protocol implementation8、System Adminuseradd                       Create a new user
or update default new user information
























第9章应该是一些杂项,包括关键字什么的,eg: if 、for ; file


二、语法细节

  • NAME:命令名称及功能简要说明
  • SYNOPSIS:用法说明,包括可用的选项
  • DESCRIPTION:命令功能的详尽说明,可能包括每一个选项的意义
  • OPTIONS:说明每一个选项的意义
  • FILES:此命令相关的配置文件
  • BUGS:
  • EXAMPLES:使用示例
  • SEE ALSO:另外参照
  •         <> ::必选 
  •         [ ] :可选 
  •         ...:可以出现多次
  •         | : 多选一
  •         { } : 分组
说明:命令格式 # command  options...  arguments...
其中 选项 包括短选项 与  长选项 。短项可以组合,长选项可以接参数;短、长选项可混合使用;参数 即为命令的作用对象。

实验


这里以 man ls 命令为例, 以 命令 ls -lh --color=always --author 的执行结果说明
  • man ls 



  • ls -lh --color=always --author 


参考文献

  • http://linux.about.com/od/commands/l/blcmdl_3a.htm
  • 马哥linux视频教程之运维基础


0 0