今天讀完 鳥哥的 Linux 私房菜 -- 第 3 堂課:檔案管理與 vim 初探
學會cd目錄也可以按tab
鍵可以自動補齊 (死菜鳥XD)
備註 : 空白字元的檔名會自動在前加上\
test@test:~$ mkdir "demo folder"
test@test:~$ cd de #這時候按tab
test@test:~$ cd demo\ folder/ #自動展成這樣
如何刪除目錄,只需要在rm
之後加上-rf
test@test:~$ rm demo
rm: cannot remove 'demo': Is a directory
test@test:~$ rm -rf demo
學會除了ls
外,還可以使用ll
查看目錄下文件,可以額外看到建立時間、大小
test@test:~$ cd demo\ folder/
test@test:~/demo folder$ touch a1.md
test@test:~/demo folder$ touch a2.md
test@test:~/demo folder$ touch b1.md
test@test:~/demo folder$ touch b2.md
test@test:~/demo folder$ ls
a1.md a2.md b1.md b2.md
test@test:~/demo folder$ ll
total 8
drwxrwxr-x 2 test test 4096 Sep 13 11:42 ./
drwxr-xr-x 6 test test 4096 Sep 13 11:38 ../
-rw-rw-r-- 1 test test 0 Sep 13 11:42 a1.md
-rw-rw-r-- 1 test test 0 Sep 13 11:42 a2.md
-rw-rw-r-- 1 test test 0 Sep 13 11:42 b1.md
-rw-rw-r-- 1 test test 0 Sep 13 11:42 b2.md
快速創建100個文件,好爽!
test@test:~/demo$ touch test{1..100}.md
test@test:~/demo$ ls
test100.md test25.md test40.md test56.md test71.md test87.md
test10.md test26.md test41.md test57.md test72.md test88.md
test11.md test27.md test42.md test58.md test73.md test89.md
test12.md test28.md test43.md test59.md test74.md test8.md
test13.md test29.md test44.md test5.md test75.md test90.md
test14.md test2.md test45.md test60.md test76.md test91.md
test15.md test30.md test46.md test61.md test77.md test92.md
test16.md test31.md test47.md test62.md test78.md test93.md
test17.md test32.md test48.md test63.md test79.md test94.md
test18.md test33.md test49.md test64.md test7.md test95.md
test19.md test34.md test4.md test65.md test80.md test96.md
test1.md test35.md test50.md test66.md test81.md test97.md
test20.md test36.md test51.md test67.md test82.md test98.md
test21.md test37.md test52.md test68.md test83.md test99.md
test22.md test38.md test53.md test69.md test84.md test9.md
test23.md test39.md test54.md test6.md test85.md
test24.md test3.md test55.md test70.md test86.md
批量刪除目錄底下文件
test@test:~/demo$ touch test{1..100}.md
test@test:~/demo$ rm *
test@test:~/demo$ ls
顯示檔案內容
test@test:~/demo$ vi test.md
test@test:~/demo$ cat test.md # 全顯示
#1,2,3...20
test@test:~/demo$ head test.md # 只列出檔案最前面 10 行
#1,2,3...20
查看檔案的類型
test@test:~/demo$ file test.md
test.md: ASCII text
移動檔案mv
test@test:~/demo$ mkdir demo2
test@test:~/demo$ ls
demo2 test.md
test@test:~/demo$ mv test.md demo2
test@test:~/demo$ ls
demo2
test@test:~/demo$ ll demo2
total 12
drwxrwxr-x 2 test test 4096 Sep 13 12:06 ./
drwxrwxr-x 3 test test 4096 Sep 13 12:06 ../
-rw-rw-r-- 1 test test 58 Sep 13 11:59 test.md
阿~~~ 又是水的一天,大家周末快樂