Linux的目录处理命令上

一 建立目录

1、语法
mkdir -p [目录名]
-p 递归创建
命令英文含义:make directories
2、实战
  1. [root@localhost ~]# ls
  2. anaconda-ks.cfg gobin Music
  3. ChangeLog-2.6.0 goc2p Pictures
  4. Desktop golib Public
  5. Documents goproject Templates
  6. Downloads initial-setup-ks.cfg Videos
  7. go1.8.3.linux-amd64.tar.gz linux-2.6.39.tar.bz2
  8. [root@localhost ~]# mkdir test
  9. [root@localhost ~]# ls
  10. anaconda-ks.cfg gobin Music
  11. ChangeLog-2.6.0 goc2p Pictures
  12. Desktop golib Public
  13. Documents goproject Templates
  14. Downloads initial-setup-ks.cfg test
  15. go1.8.3.linux-amd64.tar.gz linux-2.6.39.tar.bz2 Videos
  16. [root@localhost ~]# mkdir -p japan/cang
  17. [root@localhost ~]# mkdir japan/cang1
  18. [root@localhost ~]# ls japan
  19. cang cang1
二 切换所在目录
1、语法
cd [目录]
命名英文含义:change dirctories
2、简化操作
cd ~ 进入当前用户的家目录
cd     进入当前用户的家目录
cd -  进入上次目录
cd .. 进入上一级目录
cd .  进入当前目录 
3、小技巧
清屏:Ctcl+L
命令补全和目录补全:Tab键
4、实战
  1. [root@localhost ~]# cd japan
  2. [root@localhost japan]# ls
  3. cang cang1
  4. [root@localhost japan]# cd /root
  5. [root@localhost ~]# pwd
  6. /root
  7. [root@localhost ~]# ls
  8. anaconda-ks.cfg goc2p Pictures
  9. ChangeLog-2.6.0 golib Public
  10. Desktop goproject Templates
  11. Documents initial-setup-ks.cfg test
  12. Downloads japan Videos
  13. go1.8.3.linux-amd64.tar.gz linux-2.6.39.tar.bz2
  14. gobin Music
  15. [root@localhost ~]# cd test
  16. [root@localhost test]# cd
  17. [root@localhost ~]# cd test
  18. [root@localhost test]# cd ~
  19. [root@localhost ~]# cd -
  20. /root/test
  21. [root@localhost test]# cd -
  22. /root
  23. [root@localhost ~]# cd ..
  24. [root@localhost /]# cd .
三 查询所在目录的位置
1、语法
pwd
命令英文含义:print work direct ory
2、实战
  1. [root@localhost ~]# cd test
  2. [root@localhost test]# pwd
  3. /root/test
四 相对路径和绝对路径


 

猜你喜欢

转载自cakin24.iteye.com/blog/2391208
今日推荐