cd 冷却时间 cool down
cd 和 pwd
[root@oldboyedu59 ~]# pwd
/root
[root@oldboyedu59 ~]# cd /tmp/
[root@oldboyedu59 tmp]# pwd
/tmp
[root@oldboyedu59 tmp]# cd /etc/sysconfig/network-scripts/
[root@oldboyedu59 network-scripts]# pwd
/etc/sysconfig/network-scripts
~ 当前用户家目录
[root@oldboyedu59 network-scripts]# cd ~
[root@oldboyedu59 ~]# pwd
/root
cd ~ === cd
cd .. 进入当前目录的上一级目录
cd . 进入当前目录
[root@oldboyedu59 etc]# cd /etc/sysconfig/network-scripts/
[root@oldboyedu59 network-scripts]# cd /tmp/
[root@oldboyedu59 tmp]# cd -
/etc/sysconfig/network-scripts
.lck #lock
删除xxxxx.lck目录
[root@oldboyedu59 ~]# mkdir /oldboy
[root@oldboyedu59 ~]# ls /oldboy/
[root@oldboyedu59 ~]# ls -l /oldboy/
total 0
pwd cd mkdir ls 练习题: 根据描述进行操作(发出操作过程)
创建/data 和 /你的名字 (拼音的目录)
进入到/data目录,然后再进入 /你名字的目录
进入到上一次所在目录
回老家
[root@oldboyedu59 ~]# mkdir /data/ /lidao
[root@oldboyedu59 ~]# ls -l /data /lidao/
/data:
total 0
/lidao/:
total 0
[root@oldboyedu59 ~]# cd /data/
[root@oldboyedu59 data]# cd /lidao/
[root@oldboyedu59 lidao]# cd -
/data
[root@oldboyedu59 data]# cd
路径:
一切从根开始
绝对路径: 从根开始的路径 √
/data
/oldboy
/etc/sysconfig/network-scripts
相对路径: 不是从根开始的路径
data
oldboy
[root@oldboyedu59 ~]# mkdir /data/oldboy/lidao/a/b/c/d/e
mkdir: cannot create directory ‘/data/oldboy/lidao/a/b/c/d/e’: No such file or directory
mkdir 命令默认只能创建1层目录 创建多层报错
[root@oldboyedu59 ~]# mkdir /data/oldboy/lidao/a/b/c/d/e
mkdir: cannot create directory ‘/data/oldboy/lidao/a/b/c/d/e’: No such file or directory
[root@oldboyedu59 ~]# mkdir -p /data/oldboy/lidao/a/b/c/d/e
[root@oldboyedu59 ~]# ls -l /data/oldboy/lidao/a/b/c/d/e/
total 0
[root@oldboyedu59 ~]# touch /oldboy/oldboy.txt
[root@oldboyedu59 ~]# ls -l /oldboy/
total 0
-rw-r--r--. 1 root root 0 Mar 28 11:46 oldboy.txt
#mkdir与touch题目:
#创建 /oldboy/alex/lidao 和 /data/alex/lidao 两个目录
#在/oldboy/alex/lidao 和 /data/alex/lidao 都创建一个叫oldboy.txt文件
[root@oldboyedu59 ~]# mkdir -p /oldboy/alex/lidao /data/alex/lidao
[root@oldboyedu59 ~]# touch /oldboy/alex/lidao/oldboy.txt /data/alex/lidao/oldboy.txt
[root@oldboyedu59 ~]# ls -l /oldboy/alex/lidao/ /data/alex/lidao/
/data/alex/lidao/:
total 0
-rw-r--r--. 1 root root 0 Mar 28 11:58 oldboy.txt
/oldboy/alex/lidao/:
total 0
-rw-r--r--. 1 root root 0 Mar 28 11:58 oldboy.txt
echo
{} 生成序列
[root@oldboyedu59 ~]# echo oldboy
oldboy
[root@oldboyedu59 ~]# echo {1..10}
1 2 3 4 5 6 7 8 9 10
[root@oldboyedu59 ~]# echo {a..z}
a b c d e f g h i j k l m n o p q r s t u v w x y z
[root@oldboyedu59 ~]# echo oldboy{1..10}
oldboy1 oldboy2 oldboy3 oldboy4 oldboy5 oldboy6 oldboy7 oldboy8 oldboy9 oldboy10
特殊:
[root@oldboyedu59 ~]# echo {01..10}
01 02 03 04 05 06 07 08 09 10
显示出 oldboy01.txt oldboy02.txt oldboy03.txt ..... oldboy10.txt
[root@oldboyedu59 ~]# echo oldboy{01..10}.txt
oldboy01.txt oldboy02.txt oldboy03.txt oldboy04.txt oldboy05.txt oldboy06.txt oldboy07.txt oldboy08.txt oldboy09.txt oldboy10.txt
[root@oldboyedu59 ~]# touch oldboy{01..10}.txt
[root@oldboyedu59 ~]# touch oldboy{01..10}.txt
[root@oldboyedu59 ~]# ls -l
total 16
-rw-------. 1 root root 1341 Mar 26 11:46 anaconda-ks.cfg
-rw-r--r--. 1 root root 10213 Mar 28 10:28 grep.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy01.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy02.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy03.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy04.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy05.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy06.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy07.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy08.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy09.txt
-rw-r--r--. 1 root root 0 Mar 28 12:16 oldboy10.txt
drwxr-xr-x. 2 root root 6 Mar 27 20:31 oldgirl
drwxr-xr-x. 2 root root 6 Mar 27 20:33 oldman
cp
[root@oldboyedu59 ~]# cp /oldboy/oldboy.txt /tmp/
[root@oldboyedu59 ~]# cp /oldboy /tmp/
cp: omitting directory ‘/oldboy’
忽略 目录
cp命令默认无法复制目录
-r 递归复制 复制目录和目录的内容
[root@oldboyedu59 ~]# cp -r /oldboy/ /tmp/
[root@oldboyedu59 ~]# ls -l /tmp/
total 4
-rwx------. 1 root root 836 Mar 26 11:46 ks-script-pzO18O
drwxr-xr-x. 3 root root 36 Mar 28 12:32 oldboy
drwxr-xr-x. 2 root root 6 Mar 27 20:30 oldboy59
-rw-r--r--. 1 root root 0 Mar 28 12:24 oldboy.txt
drwx------. 2 root root 6 Mar 26 11:56 vmware-root_6737-3853947227
drwx------. 2 root root 6 Mar 27 08:37 vmware-root_6762-2864843553
-rw-------. 1 root root 0 Mar 26 11:37 yum.log
[root@oldboyedu59 ~]# ls -l /oldboy/oldboy.txt
-rw-r--r--. 1 root root 0 Mar 28 11:47 /oldboy/oldboy.txt
[root@oldboyedu59 ~]# cp /oldboy/oldboy.txt /oldboy/oldboy.txt.bak
[root@oldboyedu59 ~]# ls -l /oldboy/
total 0
drwxr-xr-x. 3 root root 19 Mar 28 11:57 alex
-rw-r--r--. 1 root root 0 Mar 28 11:47 oldboy.txt
-rw-r--r--. 1 root root 0 Mar 28 12:38 oldboy.txt.bak
提前安装(需要你虚拟机可以上网)
yum install -y tree vim bash-completion