linux学习笔记二:man命令

作用:查找linux命令的man page及用法。

root@ubuntu:/# man date
DATE(1)        User Commands                                         DATE(1)

NAME
       date - print or set the system date and time

SYNOPSIS
       date [OPTION]... [+FORMAT]
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

DESCRIPTION
       Display the current time in the given FORMAT, or set the system date.

       Mandatory arguments to long options are mandatory for short options too.

       -d, --date=STRING
              display time described by STRING, not 'now'

       -f, --file=DATEFILE
              like --date; once for each line of DATEFILE

       -I[FMT], --iso-8601[=FMT]
              output  date/time  in ISO 8601 format.  FMT='date' for date only (the default), 'hours', 'minutes', 'seconds', or 'ns' for date and time to the indicated preci‐
              sion.  Example: 2006-08-14T02:34:56-0600

       -R, --rfc-2822
              output date and time in RFC 2822 format.  Example: Mon, 14 Aug 2006 02:34:56 -0600

       --rfc-3339=FMT
              output date/time in RFC 3339 format.  FMT='date', 'seconds', or 'ns' for date and time to the indicated precision.  Example: 2006-08-14 02:34:56-06:00

       -r, --reference=FILE
              display the last modification time of FILE

       -s, --set=STRING
              set time described by STRING

       -u, --utc, --universal
              print or set Coordinated Universal Time (UTC)

       --help display this help and exit

       --version
              output version information and exit

1、上图命令DATE(1)中括号中的1代表是一般用户可使用命令,常见的几个数字意义如下:

代号含义
1用户在shell环境中可以操作的命令或可执行文件
2系统内核可调用的函数与工具等
3一些常用的函数与函数库,大部分为C的函数库
4设备文件的说明,通常在/dev下的文件
5配置文件或者是某些文件的格式
6游戏
7惯例与协议等,例如linux文件系统、网络协议、ASCII code等
8系统管理员可用的管理命令
9跟内核kernel有关的文件

man null,将会出现NULL(4)代表null是一个“设备文件”

2、man命令常用的按键

按键含义
空格键向下翻一页
Page Down向下翻一页
Page Up向上翻一页
Home首页
End尾页
/string向下查找string字符串,如查找date,可输入/date
?string向上查找string字符串
n,N利用/或?查询字符串时,可以用n来继续下一个查询,可以用N来进行反向查询
q退出man page

3、man读取数据的目录,一般是放在/usr/share/man/,不过也可以通过修改/etc/man.config(或man.conf或manpath.config)

man -f 相当于whatis命令,用于显示命令是干什么用的,如:

root@ubuntu:/# man -f date
date (1)             - print or set the system date and time

man -k相当于apropos命令,用于查找与关键字有关的命令。如:

root@ubuntu:/# man -k date
updatedb.conf (5)    - a configuration file for updatedb(8)
asctime (3)          - transform date and time to broken-down time or ASCII
asctime_r (3)        - transform date and time to broken-down time or ASCII
cal (1)              - displays a calendar and the date of Easter
catman (8)           - create or update the pre-formatted manual pages
chgpasswd (8)        - update group passwords in batch mode
chpasswd (8)         - update passwords in batch mode
ctime (3)            - transform date and time to broken-down time or ASCII
ctime_r (3)          - transform date and time to broken-down time or ASCII
date (1)             - print or set the system date and time
...省略

whatis和apropos命令要正常使用,需要创建whatis数据库才行,用root用户执行makewhatis

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值