Linux04 目录的相关操作(mkdir、rmdir、rm、cp)

一、创建目录:mkdir

  mkdir 目录名

二、删除目录:rmdir / rm

  rmdir 目录名

  rm -r 目录名      每一级子目录都会询问是否删除

  rm -rf 目录名     慎用,给你足够权限,你就可以删除全部的系统文件,整个团队的项目可以全删除干净

三、文件和目录复制:cp

  cp 文件或目录名  目标地址

 1 keshengtao@LAPTOP-F9AFU4OK:~$ ls
 2 kkk.py
 3 keshengtao@LAPTOP-F9AFU4OK:~$
 4 keshengtao@LAPTOP-F9AFU4OK:~$ cd
 5 keshengtao@LAPTOP-F9AFU4OK:~$ ls
 6 kkk.py
 7 keshengtao@LAPTOP-F9AFU4OK:~$ mkdir test
 8 keshengtao@LAPTOP-F9AFU4OK:~$ ls
 9 kkk.py  test
10 keshengtao@LAPTOP-F9AFU4OK:~$ mkdir ./test/learn
11 keshengtao@LAPTOP-F9AFU4OK:~$ ls
12 kkk.py  test
13 keshengtao@LAPTOP-F9AFU4OK:~$ ls ./test/
14 learn
15 keshengtao@LAPTOP-F9AFU4OK:~$ ls
16 kkk.py  test
17 keshengtao@LAPTOP-F9AFU4OK:~$ rm -r test/
18 keshengtao@LAPTOP-F9AFU4OK:~$ ls
19 kkk.py
20 keshengtao@LAPTOP-F9AFU4OK:~$ mkdir test
21 keshengtao@LAPTOP-F9AFU4OK:~$ mkdir ./test/learn
22 keshengtao@LAPTOP-F9AFU4OK:~$ rm test/
23 rm: cannot remove 'test/': Is a directory
24 keshengtao@LAPTOP-F9AFU4OK:~$ ls
25 kkk.py  test
26 keshengtao@LAPTOP-F9AFU4OK:~$ cp kkk.py ./test/learn/
27 keshengtao@LAPTOP-F9AFU4OK:~$ ls
28 kkk.py  test
29 keshengtao@LAPTOP-F9AFU4OK:~$ cd test/learn/
30 keshengtao@LAPTOP-F9AFU4OK:~/test/learn$ ls
31 kkk.py
View Code

 

你可能感兴趣的:(Linux04 目录的相关操作(mkdir、rmdir、rm、cp))