linux下文件夾操作命令linux下的文件夾操作,包括創(chuàng)建、刪除、重命名等基本操作。
1、文件夾的創(chuàng)建,在當前test目錄下創(chuàng)建一個名為itbuluoge的文件夾
- [root@localhost test]# ls
- [root@localhost test]#
從上面我們用ls命令可以看到,當前test目錄下沒有任何內(nèi)容。
- [root@localhost test]# mkdir itbuluoge
- [root@localhost test]# ls
- itbuluoge
- [root@localhost test]#
使用mkdir可以創(chuàng)建文件夾,mkdir命令后面直接跟需要創(chuàng)建的文件夾
2、刪除文件夾
如果文件夾是空的話,直接使用rm -R 文件夾名稱就可以了。
- [root@localhost test]# rm -R itbuluoge/
- rm:是否刪除目錄 “itbuluoge”?y
- [root@localhost test]# ls
- [root@localhost test]#
如果文件夾非空的話,需要每個文件確認。
- [root@localhost test]# ls
- itbuluoge
- [root@localhost test]# ls itbuluoge/
- test.txt
- [root@localhost test]# rm -R itbuluoge/
- rm:是否進入目錄”itbuluoge”? y
- rm:是否刪除普通空文件 “itbuluoge/test.txt”?y
- rm:是否刪除目錄 “itbuluoge”?y
我們在itbuluoge中新建了一個文件test.txt,此時如果要刪除的話,就需要跟著目錄去刪除每一個文件。
|