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