1、命令 ls:查看
①参数 -l 列出文件的详细信息
[root@JSH-01 ~]# ls -l
总用量 4
-rw-------. 1 root root 1387 3月 19 23:37 anaconda-ks.cfg
|| | | | | | |
|| | 所有者 所属租 文件大小 文件创建时间 文件名
|文件权限 有多少文件使用了相同的iNode
文件类型
②参数 -i 查看文件的iNode(iNode会记录文件存在于磁盘的哪个区域哪个块上面)
[root@JSH-01 ~]# ls -i anaconda-ks.cfg
33574992 anaconda-ks.cfg
③参数 -h 将文件大小以GB\KB等已读的方式显示
④参数 -a 显示所有文件包,含隐藏文件或目录(以.开头)
⑤参数 -t 以修改时间排序
⑥参数 -d 仅列出目录本身,而不显示目录内的文件信息
[root@JSH-01 ~]# ls -lh
总用量 4.0K
-rw-------. 1 root root 1.4K 3月 19 23:37 anaconda-ks.cfg
[root@JSH-01 ~]# ls -la
总用量 32
dr-xr-x---. 2 root root 151 3月 20 20:12 .
dr-xr-xr-x. 17 root root 224 3月 19 23:35 ..
-rw-------. 1 root root 1387 3月 19 23:37 anaconda-ks.cfg
-rw-------. 1 root root 1977 3月 21 23:05 .bash_history
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
-rw-------. 1 root root 1040 3月 20 20:12 .viminfo
[root@JSH-01 ~]# ls -lat
总用量 32
-rw-------. 1 root root 1977 3月 21 23:05 .bash_history
dr-xr-x---. 2 root root 151 3月 20 20:12 .
-rw-------. 1 root root 1040 3月 20 20:12 .viminfo
-rw-------. 1 root root 1387 3月 19 23:37 anaconda-ks.cfg
dr-xr-xr-x. 17 root root 224 3月 19 23:35 ..
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
[root@JSH-01 ~]# ls -ld
dr-xr-x---. 2 root root 151 3月 20 20:12 .
2、Linux下的7中文件类型
①普通文件类型 -
②目录文件类型 d
③块设备文件 b(例如:硬盘)
④字符设备 c (例如:鼠标、键盘等)
⑤套接字文件 s
⑥链接文件 l
3、命令 alias:别名
①查看别名
[root@JSH-01 ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
②创建别名
[root@JSH-01 ~]# alias jsh='ls -lat' ##创建别名
[root@JSH-01 ~]# jsh
总用量 32
-rw-------. 1 root root 1977 3月 21 23:05 .bash_history
dr-xr-x---. 2 root root 151 3月 20 20:12 .
-rw-------. 1 root root 1040 3月 20 20:12 .viminfo
-rw-------. 1 root root 1387 3月 19 23:37 anaconda-ks.cfg
dr-xr-xr-x. 17 root root 224 3月 19 23:35 ..
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
4、命令 which:查看命令所在的路径
[root@JSH-01 ~]# which ll
alias ll='ls -l --color=auto'
/usr/bin/ls
[root@JSH-01 ~]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
[root@JSH-01 ~]# which man
/usr/bin/man
5、命令 mkdir :创建目录
①参数 -p :创建级联目录
②参数 -v :可视化,能看见创建目录的过程
6、命令 rmdir:仅删除空目录(不常用)
7、命令 touch:创建空白文件
8、命令 rm:删除目录或文件
①参数 -f:强制删除
②参数 -r:将指定目录下的所有文件及子目录一并删除