目錄
1- ls(查看當前目錄下的內容)
2- pwd? (查看當前所在的文件夾)
3- cd [目錄名](切換文件夾)
4- touch [文件名] (如果文件不存在,新建文件)
5- mkdir[目錄名] (創建目錄)
6-rm[文件名](刪除指定的文件)
7-clear(清屏)????????
1- ls(查看當前目錄下的內容)
[admin@localhost /]$ ls
bin ?boot ?dev ?etc ?home ?lib ?lib64 ?media ?mnt ?opt ?proc ?root ?run ?sbin ?srv ?sys ?tmp ?usr ?var
2- pwd? (查看當前所在的文件夾)
[admin@localhost /]$ pwd
/
3- cd [目錄名](切換文件夾)
[admin@localhost /]$ cd home?
[admin@localhost home]$ pwd
/home
4- touch [文件名] (如果文件不存在,新建文件)
使用時需要注意:touch指令在某些文件夾中可能需要當前賬號需要有權限,否則無法創建
[admin@localhost home]$ touch aa.txt
touch: 無法創建"aa.txt": 權限不夠
使用touch創建文件
[admin@localhost ~]$ ls
1.txt ?aa.txt ?公共 ?模板 ?視頻 ?圖片 ?文檔 ?下載 ?音樂 ?桌面
[admin@localhost ~]$ touch 2.txt
[admin@localhost ~]$ ls
1.txt ?2.txt ?aa.txt ?公共 ?模板 ?視頻 ?圖片 ?文檔 ?下載 ?音樂 ?桌面
[admin@localhost ~]$?
5- mkdir[目錄名] (創建目錄)
就是創建一個目錄(用于存放文件的地方)
[admin@localhost ~]$ ls
1.txt ?2.txt ?aa.txt ?公共 ?模板 ?視頻 ?圖片 ?文檔 ?下載 ?音樂 ?桌面
[admin@localhost ~]$ mkdir linuxCommand
[admin@localhost ~]$ ls
1.txt ?2.txt ?aa.txt ?linuxCommand ?公共 ?模板 ?視頻 ?圖片 ?文檔 ?下載 ?音樂 ?桌面
[admin@localhost ~]$?
mkdir -p a/b/c?遞歸創建文件目錄
6-rm[文件名](刪除指定的文件)
- rm?文件名:刪除一個文件
- rm -f? 文件名:直接刪除(無確認)
- rm -r?目錄:遞歸刪除一個目錄以及里面的內容(需要手動確認)
- rm -rf?目錄:遞歸刪除一個目錄,不確認
- rm -rf * :?清空當前的文件夾
- rm -rf /* :?這個不要嘗試,會刪除所有的文件(這個本質是從根目錄中刪除的)
- 不要使用管理員賬號,使用非管理員賬號刪除效果(權限不夠)如下
- 我這里使用的是vm虛擬機(可以使用快照恢復,前提需要手動保存快照)管理員賬號不要嘗試
[admin@localhost ~]$ ls
1.txt ?2.txt ?aa.txt ?linuxCommand ?公共 ?模板 ?視頻 ?圖片 ?文檔 ?下載 ?音樂 ?桌面
[admin@localhost ~]$ rm 1.txt
[admin@localhost ~]$ ls
2.txt ?aa.txt ?linuxCommand ?公共 ?模板 ?視頻 ?圖片 ?文檔 ?下載 ?音樂 ?桌面
[admin@localhost ~]$?
7-clear(清屏)????????
這個時清理屏幕信息,本質是向上翻頁