cat
适合查看短文件
[root@hd ~]# cat /etc/networks
default 0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0
head
从文件头部看起,默认前10行
[root@hd ~]# head /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
#显示filename前面N行
head -n N filename
[root@hd ~]# head -n 5 /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
tail
从文件尾部看起,默认后10行
-f 监视文件尾部内容,刷新在屏幕上
[root@hd ~]# tail /etc/passwd
test91:x:1090:1090::/home/test91:/bin/bash
test92:x:1091:1091::/home/test92:/bin/bash
test93:x:1092:1092::/home/test93:/bin/bash
test94:x:1093:1093::/home/test94:/bin/bash
test95:x:1094:1094::/home/test95:/bin/bash
test96:x:1095:1095::/home/test96:/bin/bash
test97:x:1096:1096::/home/test97:/bin/bash
test98:x:1097:1097::/home/test98:/bin/bash
test99:x:1098:1098::/home/test99:/bin/bash
test100:x:1099:1099::/home/test100:/bin/bash
#显示filename最后N行
tail -n N filename
#显示/etc/passwd最后5行
[root@hd ~]# tail -n 5 /etc/passwd
test96:x:1095:1095::/home/test96:/bin/bash
test97:x:1096:1096::/home/test97:/bin/bash
test98:x:1097:1097::/home/test98:/bin/bash
test99:x:1098:1098::/home/test99:/bin/bash
test100:x:1099:1099::/home/test100:/bin/bash
more
分页浏览,看完自动退出
more filename
less
分页反复浏览,按'q'退出
less filename
命令帮助
有存储位置的命令为外部命令,没有存储位置的命令为内部命令
#type判断内外部命令
[root@hd ~]# type help
help 是 shell 内嵌 #内部命令
[root@hd ~]# type passwd
passwd 是 /usr/bin/passwd #外部命令
--help
帮助外部命令
命令字 --help
[[root@hd ~]# passwd --help
用法: passwd [选项...] <帐号名称>
-k, --keep-tokens 保持身份验证令牌不过期
-d, --delete 删除已命名帐号的密码(只有根用户才能进行此操作)
-l, --lock 锁定指名帐户的密码(仅限 root 用户)
-u, --unlock 解锁指名账户的密码(仅限 root 用户)
-e, --expire 终止指名帐户的密码(仅限 root 用户)
-f, --force 强制执行操作
-x, --maximum=DAYS 密码的最长有效时限(只有根用户才能进行此操作)
-n, --minimum=DAYS 密码的最短有效时限(只有根用户才能进行此操作)
-w, --warning=DAYS 在密码过期前多少天开始提醒用户(只有根用户才能进行此操作)
-i, --inactive=DAYS 当密码过期后经过多少天该帐号会被禁用(只有根用户才能进行此操作)
-S, --status 报告已命名帐号的密码状态(只有根用户才能进行此操作)
--stdin 从标准输入读取令牌(只有根用户才能进行此操作)
Help options:
-?, --help Show this help message
--usage Display brief usage message
help
帮助内部命令
help 命令字
[root@hd ~]# help cd
cd: cd [-L|[-P [-e]]] [dir]
Change the shell working directory.
Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.
The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins
with a slash (/), then CDPATH is not used.
If the directory is not found, and the shell option `cdable_vars' is set,
the word is assumed to be a variable name. If that variable has a value,
its value is used for DIR.
Options:
-L force symbolic links to be followed
-P use the physical directory structure without following symbolic
links
-e if the -P option is supplied, and the current working directory
cannot be determined successfully, exit with a non-zero status
The default is to follow symbolic links, as if `-L' were specified.
Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P is used; non-zero otherwise.
man
手册页
以全屏显示在线帮助,按q退出,上,下键移动
man 命令字
[root@hd ~]# man rm
info
信息页
info 命令字
[root@hd ~]# info rm