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