接下來我們就來看幾個常見的處理目錄的命令吧:
例項:請到/tmp底下嘗試建立數個新目錄看看:
[root@www ~]#cd /tmp[root@www tmp]#mkdir test <==建立一名為test 的新目錄[root@www tmp]#mkdir test1/test2/test3/test4
mkdir:cannot create directory `test1/test2/test3/test4':
no such file or directory <== 沒辦法直接建立此目錄啊!
[root@www tmp]# mkdir -p test1/test2/test3/test4
cp 即拷貝檔案和目錄。
語法:
[root@www ~]#cp [-adfilprsu]**檔(source)目標檔(destination)[root@www ~]#cp [options]source1 source2 source3 ....directory選項與引數:
-f:為強制(force)的意思,若目標檔案已經存在且無法開啟,則移除後再嘗試一次;
-i:若目標檔(destination)已經存在時,在覆蓋時會先詢問動作的進行(常用)
-l:進行硬式鏈結(hard link)的鏈結檔建立,而非複製檔案本身;
-p:連同檔案的屬性一起複製過去,而非使用預設屬性(備份常用);
-r:遞迴持續複製,用於目錄的複製行為;(常用)
-s:複製成為符號鏈結檔 (symbolic link),亦即『捷徑』檔案;
-u:若 destination 比 source 舊才公升級 destination !
linux 檔案內容檢視
cat [-abentv]選項與引數:
Linux筆記 7(檔案與目錄管理)
linux筆記 7 標籤 空格分隔 linux 1.複製 刪除與移動 cp,rm,mv 1 cp複製檔案或目錄 選項 引數 a dr preserve all d若source屬性為link file,則複製link file屬性而非檔案本身 f為強制 force 的意思,若目標檔案已存在且無法開放...
linux基礎筆記 7 檔案與目錄管理
1.ls full time 以完整時間模式 包括年 月 日 時 分 輸出 time 輸出訪問時間或改變許可權屬性時間 ctime 而非內容更改時間 modification time 2.basename 取得最後的檔名 dirname 取得目錄名 3.cat abentv a 相當於 vet的整...
別人的Linux私房菜(7)檔案與目錄管理
代表上乙個工作目錄 username代表使用者所在的家目錄 cd切換目錄 配合之上的引數 name change directory pwd顯示當前目錄 可選引數 p 顯示真正的路徑而不是鏈結路徑 print working directory mkdir建立新的目錄 m設定新建目錄的許可權,p建立...