正文
其中,
r
表示可读,
w
表示可写,
x
表示执行的权限。
为了更加明白,对于 anaconda-ks.cfg 这个文件,这里列一个表格:
前三个字符
|
中间三个字符
|
后三个字符
|
rw-
|
—-
|
—-
|
所有者u的权限
|
所属组g的权限
|
o其他人的权限
|
可读可写
|
无权限
|
无权限
|
那么,对于 test 这个文件
rwxr-xr-x
,请读者自行判断它的权限。
在九个字符之后的点 “.”,表示ACL权限,之后的数字 1 表示引用计数,比如一个文件有一个软链接(类似windows快捷方式),那么它的引用计数就是2。
root 后面的2.7k表示文件的大小,再后面表示日期,最后是文件的名称。
目录处理命令
创建目录:mkdir
mkdir -p [目录名]
-p
: 递归创建
[root@localhost ~]# ls
anaconda-ks.cfg test
[root@localhost ~]# mkdir otherFolder
[root@localhost ~]# ls
anaconda-ks.cfg otherFolder test
[root@localhost ~]# mkdir folder_2/test_2
mkdir: 无法创建目录"folder_2/test_2": 没有那个文件或目录
[root@localhost ~]# mkdir -p folder_2/test_2
[root@localhost ~]# ls
anaconda-ks.cfg folder_2 otherFolder test
[root@localhost ~]# ls folder_2/test_2
如上所示,mkdir 不加选项 -p 时,可以创建一个空目录,但是无法递归创建一个包含子目录的目录。加上 -p 即可递归创建。
切换所在目录:cd
cd [目录]
操作:
-
cd ~
: 进入当前用户的家目录
-
cd-
: 进入上次目录
-
cd..
: 进入上一级目录
-
cd
: 回到家目录
[root@localhost ~]# ls
anaconda-ks.cfg folder_2 otherFolder test
[root@localhost ~]# cd /folder_2/test_2
[root@localhost test_2]# cd
[root@localhost ~]# cd -
/root/folder_2/test_2
[root@localhost test_2]# cd ../../otherFolder
[root@localhost otherFolder]# cd ..
[root@localhost ~]#
注意理清概念:相对路径和绝对路径
绝对路径:从根目录一级级找下去,需要写全路径
[root@localhost ~]# cd folder_2/test_2
[root@localhost test_2]#
相对路径:参照当前所在目录进行查找
[root@localhost test_2]# cd ../../otherFolder
[root@localhost otherFolder]#
查询所在目录位置:pwd
pwd