man命令
当不清楚命令参数的时候,可以使用man来获取帮助
man总共有9章
操作如下
[kuan@localhost ~]# man ls
这里显示的就是ls的详细介绍
翻屏查看
向后翻一行 Enter(回车键) 向后翻一屏 Space(空格)
向前翻一行 k 向前翻一屏 b
查找关键词
/要查找的词 向后查找 下一个 n(小写)
?要查找的词 向前查找 前一个 N(大写)
退出 q
获取不同章节的帮助
man后面跟章节数
[kuan@localhost ~]# man 1 ls
help帮助命令
内部命令使用
help cd
外部命令使用
ls --help
可以使用type查看命令,区分是否为外部命令
[kuan@localhost ~]$ type cd
cd is a shell builtin #这里说明是内部命令
[kuan@localhost ~]$ type ls
ls is aliased to `ls --color=auto' #这里说明是外部命令
显示当前目录名称
pwd
[kuan@localhost ~]$ pwd
/home/kuan
更改当前操作目录
cd /path/to/... 绝对路径
cd ./path/to/... 相对路径
cd ../path/to/...相对路径
cd .. 返回上一级目录
cd / 返回根目录
cd - 可以回到上次文件地址
[root@localhost /]# cd -
/root
文件查看
ls 参数 [文件名]
[kuan@localhost /]$ ls /
bin cgroup etc lib lost+found mnt proc sbin srv tmp var
boot dev home lib64 media opt root selinux sys usr
[root@localhost ~]# ls /root
anaconda-ks.cfg install.log install.log.syslog
-l 长格式显示文件
[root@localhost ~]# ls -l /root
total 60
-rw-------. 1 root root 3327 Jun 27 2019 anaconda-ks.cfg
-rw-r--r--. 1 root root 39965 Jun 27 2019 install.log
-rw-r--r--. 1 root root 9346 Jun 27 2019 install.log.syslog
-a 显示隐藏文件
[root@localhost ~]# ls -a
. .bash_logout install.log .viminfo
.. .bash_profile install.log.syslog .xauth8jbood
anaconda-ks.cfg .bashrc .pki .xauthvMgWlv
.bash_history .cshrc .tcshrc .xauthyqVAK0
-r 逆序显示
[root@localhost ~]# ls -lr
total 60
-rw-r--r--. 1 root root 9346 Jun 27 2019 install.log.syslog
-rw-r--r--. 1 root root 39965 Jun 27 2019 install.log
-rw-------. 1 root root 3327 Jun 27 2019 anaconda-ks.cfg
-t 按照时间顺序显示
[root@localhost /]# ls -lt
total 102
dr-xr-x---. 3 root root 4096 Mar 16 18:38 root
drwxrwxrwt. 26 root root 4096 Mar 16 18:38 tmp
drwxr-xr-x. 107 root root 12288 Mar 16 18:14 etc
drwxr-xr-x. 19 root root 3800 Mar 16 18:14 dev
drwxr-xr-x. 7 root root 0 Mar 16 18:14 selinux
drwxr-xr-x 13 root root 0 Mar 16 18:14 sys
dr-xr-xr-x. 164 root root 0 Mar 16 18:14 proc
dr-xr-xr-x. 2 root root 12288 Mar 12 19:40 sbin
dr-xr-xr-x. 2 root root 4096 Mar 12 19:40 bin
dr-xr-xr-x. 9 root root 12288 Mar 12 19:40 lib64
dr-xr-xr-x. 5 root root 1024 Mar 12 18:13 boot
-R 递归显示
0条评论