9月11日任务
2.1/2.2 系统目录结构
2.3 ls命令
2.4 文件类型
2.5 alias命令
2.1.1 、系统目录结构
[root@localhost~]# ls /
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
/bin:存放普通用户常用的命令
/sbin:存放root用户命令
/boot:启动系统相关文件
/dev:系统特有的设备文件
/etc:存放所有系统管理所需要的配置文件和子目录,相当于windows的c:\windows目录
/home:用户的家目录
/lib:存放系统最基本的动态链接共享库,库文件
/media:一个媒介目录,默认空
/mnt:临时挂载目录,默认空
/opt:主机额外安装软件所设置的目录,一般为空
/proc:系统启动进程
/root:是root用户的家目录,相当于root用户的home
/run:存放一些服务的pid
/srv:存放的是服务启动之后需要提取的数据
/sys:存放硬件驱动程序相关的信息
/tmp:存放一些临时文件
/usr:类似于Windows下的program files目录
/var:存放不断扩充且经常修改的目录。包括日志文件与pid文件
2.3.1 、命令 :ls
常用选项 ls -l -列出文件详细信息
[root@localhost ~]# ls -l
总用量 4
-rw-------. 1 root root 1257 9月 5 20:11 anaconda-ks.cfg
ls -i 显示文件或者目录的inode
[root@localhost ~]# ls -i
33583011 anaconda-ks.cfg
ls -lh显示文件信息,以k为单位显示文件大小
[root@localhost ~]# ls -lh
总用量 4.0K
-rw-------. 1 root root 1.3K 9月 5 20:11 anaconda-ks.cfg
ls -la 显示目录下包括隐藏文件的信息 ,以“.”开头表示隐藏文件
[root@localhost ~]# ls -la
总用量 32
drwx------. 3 root root 163 9月 9 17:05 .
dr-xr-xr-x. 17 root root 224 9月 10 10:37 ..
-rw-------. 1 root root 1257 9月 5 20:11 anaconda-ks.cfg
-rw-------. 1 root root 2682 9月 10 15:06 .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
drwx------. 2 root root 80 9月 10 11:52 .ssh
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
-rw-------. 1 root root 727 9月 9 17:05 .viminfo
ls -ld 表示显示目录的详细信息
[root@localhost ~]# ls -ld /root/
drwx------. 3 root root 163 9月 9 17:05 /root/
ls -t 表示按时间顺序排列
[root@localhost ~]# ls -lta
总用量 32
-rw-------. 1 root root 2682 9月 10 15:06 .bash_history
drwx------. 2 root root 80 9月 10 11:52 .ssh
dr-xr-xr-x. 17 root root 224 9月 10 10:37 ..
drwx------. 3 root root 163 9月 9 17:05 .
-rw-------. 1 root root 727 9月 9 17:05 .viminfo
-rw-------. 1 root root 1257 9月 5 20:11 anaconda-ks.cfg
-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
ll=ls -lll是ls -l的别名
[root@localhost ~]# ll
总用量 4
-rw-------. 1 root root 1257 9月 5 20:11 anaconda-ks.cfg
2.4.1 、文件类型
d:目录
b:块设备
c:字符串设备
l:软链接文件
-:普通文件
s:用来通信的文件
2.5.1 、命令 :alias命令别名
[root@localhost ~]# which ls
alias ls='ls --color=auto'
/usr/bin/ls
[root@localhost ~]# which ll
alias ll='ls -l --color=auto'
/usr/bin/ls
[root@localhost ~]# which yum
/usr/bin/yum
[root@localhost ~]# 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@localhost ~]# echo $PATH环境变量, 命令在这些路径里边才可以直接运行
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
2.5.2 设置一个别名
[root@localhost ~]# alias zgx="ls -l"设置zgx别名为“ls -l”
[root@localhost ~]# zgx
总用量 4
-rw-------. 1 root root 1257 9月 5 20:11 anaconda-ks.cfg
[root@localhost ~]# unalias zgx取消别名unalias
[root@localhost ~]# zgx
-bash: zgx: 未找到命令