Linux檔案操作命令

2021-06-22 13:54:04 字數 1241 閱讀 9566

檔案路徑操作

[root@localhosttest]#ls顯示當前目錄下的所有檔案及資料夾

[root@localhosttest]#ll以詳細方式顯示所有檔案與資料夾。(相當於

ls -l

命令)

[root@localhosttest]#cd/user   

開啟user

資料夾

[root@localhosttest]#cd ..(後面空格加兩點)返回上一級目錄

[root@localhosttest]#pwd顯示當前目錄路徑

檔案的增、刪、查、移

[root@localhost test]# mkdir  test                     建立資料夾

[root@localhost test]# touch  test.txt                建立檔案

[root@localhost test]# cp test.txt  test2.txt     把test.txt檔案當前資料夾下複製出個test2.txt

[root@localhost test]# cp test.txt  /hzh/test    將test.txt 複製到/hzh/test  目錄下 

[root@localhost test]# rm  aa.txt                        刪除aa.txt檔案

[root@localhost test]# rm  -r  bb                        刪除bb目錄(包括目錄下的所有檔案)

[root@localhost test]# rm  -rf bb                       刪除bb目錄(不對目錄下的每個檔案提醒刪除) 

[root@localhost test]# mv dd.txt ..                     將dd.txt檔案移動上一級目錄(注意尾部的兩個點)

[root@localhost test]# mv bb.txt  /hzh/test/    將bb.txt檔案移動到hzh/test/目錄下

[root@localhost test]# mv  dd.txt  dd2.txt        將dd.txt改名為dd2.txt

linux檔案操作命令

1.建立檔案 touch test.txt 建立檔案 echo this is a test test.txt 建立檔案並寫入內容 2.檢視檔案內容 cat cat test test.txt 檢視內容 cat n test test.txt 檢視內容並顯示行號 cat a test test.tx...

linux檔案操作命令

檔案操作命令 ls 顯示 ls a 顯示所有 包括隱藏 ls l 顯示詳細資訊 ls lh 同上,人性化顯示 ls ld etc 目錄的詳細資訊 ls i 檔案號 cd 切換到根目錄 cd.回到上一目錄 mkdir 建立空目錄 p 遞迴建立子目錄 cp r 原始檔或目錄 目的目錄 複製檔案或目錄 p...

Linux檔案操作命令

檔案查詢ls l 查詢檔案並且顯示檔案所有資訊 ls lh 查詢檔案並且人性化顯示檔案所有資訊 ls i 檢視檔案i節點資訊 cat 檢視檔案 cat n 檢視檔案並且查詢出來的文字帶上行號 tac 倒著顯示你要檢視的文字,與cat功能類類似,不支援 n more 檢視檔案,分頁顯示,按空格翻頁,回...