linux 每天一个命令(cd) 只需要1分钟

1, cd 全名(change directory) 改变目录 linux 使用最多命令

命令参数
cd: 
    usage: cd [-L|-P] [dir]
    -L  链接目录
    -P  实际目录
    dir 要去的目录

cd 到home目录

[root@guofeng ~]# cd /usr/local/nginx-1.6.2
[root@guofeng nginx-1.6.2]# pwd
/usr/local/nginx-1.6.2
[root@guofeng nginx-1.6.2]# cd 
[root@guofeng ~]# 

cd / 到根目录

[root@guofeng ~]# cd /
[root@guofeng /]# cd 
[root@guofeng ~]# cd ..
[root@guofeng /]# pwd
/
[root@guofeng /]# cd /usr/local/nginx-1.6.2
[root@guofeng nginx-1.6.2]# cd /
[root@guofeng /]# 

cd .. 返回上一级目录

[root@guofeng nginx-1.6.2]# pwd
/usr/local/nginx-1.6.2
[root@guofeng nginx-1.6.2]# cd ..
[root@guofeng local]# pwd
/usr/local
[root@guofeng local]# cd ../../
[root@guofeng /]# pwd
/
[root@guofeng /]# cd /usr/local/
[root@guofeng local]# pwd
/usr/local
[root@guofeng local]# 

cd -L -P 到链接的文件 或者到实际目录

[root@guofeng /]# cd usr/
[root@guofeng usr]# ll
total 132
dr-xr-xr-x.   2 root root 36864 May 23 19:26 bin
drwxr-xr-x.   2 root root  4096 Sep 23  2011 etc
drwxr-xr-x.   2 root root  4096 Sep 23  2011 games
drwxr-xr-x.  35 root root  4096 May 22 04:49 include
dr-xr-xr-x.  27 root root  4096 Nov  7  2014 lib
dr-xr-xr-x.  86 root root 36864 May 23 19:26 lib64
drwxr-xr-x.  22 root root 12288 Nov  8  2014 libexec
drwxr-xr-x.  22 root root  4096 May 24 23:16 local
dr-xr-xr-x.   2 root root 12288 May 23 19:26 sbin
drwxr-xr-x. 175 root root  4096 Nov  7  2014 share
drwxr-xr-x.   4 root root  4096 Nov  8  2014 src
lrwxrwxrwx.   1 root root    10 Nov  8  2014 tmp -> ../var/tmp
[root@guofeng usr]# cd -L tmp/
[root@guofeng tmp]# ll
total 0
[root@guofeng tmp]# cd ..
[root@guofeng usr]# cd -P tmp/
[root@guofeng tmp]# cd ..
[root@guofeng var]# pwd
/var
[root@guofeng var]# 

cd - 返回进入此目录之前所在的目录

[root@guofeng /]# cd /usr/
[root@guofeng usr]# cd local/
[root@guofeng local]# cd apache-tomcat/
[root@guofeng apache-tomcat]# ll
total 8
drwxr-xr-x. 3 root root 4096 Nov  7  2014 apache-tomcat1
drwxr-xr-x. 3 root root 4096 Nov  7  2014 apache-tomcat2
[root@guofeng apache-tomcat]# cd -
/usr/local
[root@guofeng local]# 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值