(二)相对路径与绝对路

相对路径与绝对路径

绝对路径:

  写法:一定是由根目录/写起

相对路径

  写法:不是由/写起,相对路径指的是相对于目前工作目录的路径

1 [root@localhost ~]# cd /usr/share/doc  //绝对路径,进入到/usr/share/doc这个目录
2 [root@localhost doc]# cd .. /man //相对路径,从/usr/share/doc进入到/usr/share/doc
3 [root@localhost share]# 

 

 取得路径的文件名称与目录名称

1 [root@localhost ~]# basename /etc/sysconfig/network
2 network       //取得路径的文件名称
3 [root@localhost ~]# dirname /etc/sysconfig/network
4 /etc/sysconfig    //取得文件的目录名

 

posted @ 2015-08-11 12:51  花花妹子。  阅读(125)  评论(0)    收藏  举报