相对当前目录位置的路径
[root@VM_46_188_centos /]# cd /usr/ [root@VM_46_188_centos usr]# ls bin etc games include lib lib64 libexec local sbin share src tmp [root@VM_46_188_centos usr]# [root@VM_46_188_centos php]# ls bin etc include lib php
从根开始的路径
[root@VM_46_188_centos fxq]# [root@VM_46_188_centos network-scripts]# ls ifcfg-eth0 ifdown-TeamPort ifdown-ippp ifdown-ppp ifup ifup-bnep ifup-ipv6 ifup-post ifup-tunnel network-functions-ipv6 ifcfg-lo ifdown-bnep ifdown-ipv6 ifdown-routes ifup-Team ifup-eth ifup-isdn ifup-ppp ifup-wireless ifdown ifdown-eth ifdown-isdn ifdown-sit ifup-TeamPort ifup-ib ifup-plip ifup-routes init.ipv6-globalifdown-Team ifdown-ib ifdown-post ifdown-tunnel ifup-aliases ifup-ippp ifup-plusb ifup-sit network-functions [root@VM_46_188_centos network-scripts]#
[root@VM_46_188_centos usr]# cd local/php/ [root@VM_46_188_centos php]# ls bin etc include lib php [root@VM_46_188_centos php]# /usr [root@VM_46_188_centos usr]# pwd /usr [root@VM_46_188_centos usr]# cd - /usr/local/php
[root@VM_46_188_centos ~]# [root@VM_46_188_centos ~]# pwd /root [root@VM_46_188_centos ~]# [root@VM_46_188_centos ~]# pwd /root [root@VM_46_188_centos ~]#
[root@VM_46_188_centos ~]# pwd /root [root@VM_46_188_centos ~]# [root@VM_46_188_centos /]# pwd/ [root@VM_46_188_centos /]#
mkdir -p /tmp/fxq/1/2 一次创建一系列目录
[root@VM_46_188_centos /]# [root@VM_46_188_centos /]# cd /tmp/fxq [root@VM_46_188_centos fxq]# ls 1 [root@VM_46_188_centos fxq]# cd 1/ [root@VM_46_188_centos 1]# ls 2 [root@VM_46_188_centos 1]# tree /tmp/fxq/tmp/fxq `-- 1 `-- 2 2 directories, 0 files
rmdir -p /tmp/fxq/1/2 级联删除目录
[root@VM_46_188_centos 1]# ls 1.txt 2 test1 [root@VM_46_188_centos 1]# rm: remove regular empty file ‘1.txt‘? [root@VM_46_188_centos 1]# ls 2 test1 [root@VM_46_188_centos 1]#
[root@VM_46_188_centos 1]# ls 2 test1 [root@VM_46_188_centos 1]# rm: remove directory ‘/tmp/fxq/1/2/‘? [root@VM_46_188_centos 1]# ls test1 [root@VM_46_188_centos 1]#
[root@VM_46_188_centos fxq]# tree. |-- 1| |-- 1.txt | `-- test1`-- 2 3 directories, 1 file [root@VM_46_188_centos fxq]# removed directory: ‘/tmp/fxq/1/test1‘ removed ‘/tmp/fxq/1/1.txt‘ removed directory: ‘/tmp/fxq/1/‘ [root@VM_46_188_centos fxq]#
-f 加上-f选项删除不存在的文件或目录时不提示信息。
[root@VM_46_188_centos ~]# cd /tmp/fxq [root@VM_46_188_centos fxq]# rm -rfv /tmp/fxq/1 [root@VM_46_188_centos fxq]#
本文出自 “冯晓庆的博客” 博客,请务必保留此出处http://fengyunshan911.blog.51cto.com/995251/1954349
原文地址:http://fengyunshan911.blog.51cto.com/995251/1954349