iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 4
1
自我挑戰組

Linux學習系列 第 4

Linux基本指令

  • 分享至 

  • xImage
  •  

網址
https://www.guru99.com/must-know-linux-commands.html

ls(Listing files )
顯示你現在位置的所有檔案和資料夾
資料夾藍色,檔案白色

ls –R(shows all the files not only in directories but also subdirectories)
顯示你現在位置的所有子檔案和資料夾
Documents資料夾 有test1資料夾
test1資料夾 有 test3資料夾
https://ithelp.ithome.com.tw/upload/images/20181017/20111994AiiD9uulUd.png
ls –al
顯示詳細資料,這邊先跳過內容
https://ithelp.ithome.com.tw/upload/images/20181017/20111994a9UANmTA2c.png
ls –a
可以看到隱藏的檔案(隱藏的檔案前面有.)
https://ithelp.ithome.com.tw/upload/images/20181017/20111994gmgvFkKMX6.png
創建一個文字檔
1 cat > filename
2 Add content
3 Press 'ctrl + d' to return to command prompt.
4創建完後,看檔案內容: cat filename
https://ithelp.ithome.com.tw/upload/images/20181017/20111994vmMdkDJkCu.png
cat file1 file2 > newfilename
把兩個文字檔的內容寫到另一個文字檔
https://ithelp.ithome.com.tw/upload/images/20181017/20111994pOSR1OsVi0.png
rm filename
刪除檔案
注意是刪除檔案,但是不能刪除資料夾
刪除資料夾要用:
1 rm -d :只能刪除空資料夾,如果資料夾有東西會不能刪除。
2 rm -r :recursive遞迴刪除,這個參數要小心使用,因為刪掉是整個資料夾
3 rmdir 資料夾: 只能刪除空資料夾,如果資料夾有東西會不能刪除。
例如:假設我現在有個123資料夾,123資料夾裡有1234資料夾,
rm –d不能刪掉資料夾,rm –r會把123和1234資料夾都刪掉
https://ithelp.ithome.com.tw/upload/images/20181017/20111994ADShI7UkBn.png
https://ithelp.ithome.com.tw/upload/images/20181017/20111994IbA0qbu0fB.png
https://ithelp.ithome.com.tw/upload/images/20181017/20111994zL3cInO3JL.png
rm指令網址:
https://ithelp.ithome.com.tw/articles/10159398
mv(Moving and Re-naming files)
mv指令可以用來移動檔案或是修改檔名
https://ithelp.ithome.com.tw/upload/images/20181017/20111994WmlEE20Wou.png
mkdir
創建資料夾
可以一次創建多個資料夾
https://ithelp.ithome.com.tw/upload/images/20181017/20111994GjdvLpG2K7.png
man
網址:
https://blog.gtwang.org/linux/linux-man-page-command-examples/
man 指令加上要查詢的說明主題來閱讀線上手冊(官方說明的指令用法)
先man –aw ls 看第幾章有ls的說明文件
接著再 man 1 ls 看文件
https://ithelp.ithome.com.tw/upload/images/20181017/201119942oDmzzOxow.png
Name:指令的意思
Synopsis(概要)
Description:說明如果指令只有ls,會按照字母順序印出資料夾和檔案
https://ithelp.ithome.com.tw/upload/images/20181017/20111994ludvIXNxhS.png
history
可以顯示你用過的指令
方向鍵可以一個一個找指令

Clear
可以把畫面清空

for pasting it on the Terminal, you need to use Ctrl + Shift + p. You can also try Shift + Insert or select Edit>Paste on the menu

測試:
Ctrl + Shift + p貼上的指令,不會自動執行
select Edit>Paste on the menu貼上的指令,會自動執行
Shift + Insert 不能貼上


上一篇
安裝Linux和學習路徑指令
下一篇
Linux檔案權限指令
系列文
Linux學習30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言