基本命令之--ls

[root@xuegod63 ~]# ls -l
总用量 8
-rw-------. 1 root root 1680 9月  19 12:16 anaconda-ks.cfg
-rw-r--r--. 1 root root 1728 9月  19 12:55 initial-setup-ks.cfg
drwxr-xr-x. 2 root root    6 9月  19 13:05 公共
drwxr-xr-x. 2 root root    6 9月  19 13:05 模板
drwxr-xr-x. 2 root root    6 9月  19 13:05 视频

第一个字符文件类型中:
d:目录文件
l:链接文件
b:块设备文件
c:字符设备文件
p:管道文件
-: 表示普通文件


为什么有的目录文件有不同的颜色呢?

linux系统中不同的颜色代表了不同的文件类型

ls -a

-a  列出目录下所有的文件,包括以“.“开头的隐藏文件(linux下隐藏文件是以 . 开头的,如果存在2个点代表存在着父目录,1个点表示当前目录)

ls -l 和ll 这两个命令是等价的

type ll

[root@xuegod63 ~]# type ll
ll 是 `ls -l --color=auto' 的别名

别名的使用

定义一个别名:

[root@xuegod63 ~]# alias vimens33='vim /etc/sysconfig/network-scripts/ifcfg-ens33' 
[root@xuegod63 ~]# vimens33

删除别名:

[root@xuegod63 ~]# unalias vimens33

设置别名永久生效:
==》当前用户

[root@xuegod63 ~]# vim /root/.bashrc  #插入以一下内容:
8 alias vimenss33="vim /etc/sysconfig/network-scripts/ifcfg-ens33"
[root@xuegod63 ~]# source /root/.bashrc 
[root@xuegod63 ~]# vimenss33

==》全局使用

[root@xuegod63 ~]# vim /etc/bashrc   #在文件最后插入
alias vimenss33="vim /etc/sysconfig/network-scripts/ifcfg-ens33"
[root@xuegod63 ~]# su - mk
上一次登录:四 11月 16 10:22:03 CST 2017pts/1 上
[mk@xuegod63 ~]$ vimenss33

猜你喜欢

转载自blog.csdn.net/weixin_40744265/article/details/89450156