1 / 37

基本操作與基本指令

基本操作與基本指令. 系統登入與操作介面. 使用 Linux 登入方式 Virtual Terminal 切換終端機 Linux 命令. 使用 Linux. 登入 多人多工環境 多使用者同時使用不影響. 登入方式. 本機直接登入 網路登入. Virtual Terminal. Console 模擬多個 Virtual Terminal 每個 Virtual Terminal 可視為獨立且直接連線的 Console 彼此不影響 預設有 7 個終端機 VT1~6: 文字模式 VT7: 圖形. 切換終端機. 圖形模式切換 Ctrl+Alt+F7

langer
Télécharger la présentation

基本操作與基本指令

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 基本操作與基本指令

  2. 系統登入與操作介面 使用Linux 登入方式 Virtual Terminal 切換終端機 Linux命令

  3. 使用Linux 登入 多人多工環境 多使用者同時使用不影響

  4. 登入方式 本機直接登入 網路登入

  5. Virtual Terminal Console模擬多個Virtual Terminal 每個Virtual Terminal可視為獨立且直接連線的Console 彼此不影響 預設有7個終端機 VT1~6:文字模式 VT7:圖形

  6. 切換終端機 圖形模式切換 Ctrl+Alt+F7 文字模式切換 Ctrl+Alt+F1~F6

  7. Linux命令 大多數工作可用輸入命令方式完成 圖形化介面在Linux中非必要

  8. 指令操作 輸入指令方式 指令格式 基礎指令

  9. 輸入指令方式 終端機模擬器 文字終端機

  10. 指令格式 指令 [選項 ] [選項值] [參數][檔案] 指令 [選項 ] [選項值] [參數] 10

  11. 基礎指令 clear cal who tty su whoami write wall reboot poweroff LANG=C

  12. FHS目錄結構 Windows目錄結構 Linux目錄結構 兩者差異 Linux主要目錄用途 Linux檔案規則

  13. Windows目錄結構

  14. Linux目錄結構 不使用磁碟機代號 使用/根目錄作為起始點

  15. 兩者差異 Windows Linux

  16. Linux主要目錄用途 根據FHS(http://www.pathname.com/fhs/)的官方文件指出,檔案與目錄可以依據特性區分為四大類別。

  17. /bin目錄

  18. /sbin目錄

  19. 其他目錄

  20. Linux 檔案 # touch test # ls –al test

  21. Linux 檔案種類 正規檔案( regular file ) 第一個屬性為 [ - ] 純文字檔(ascii) 二進位檔(binary) 目錄 (directory): 第一個屬性為 [ d ] 連結檔 (link): 第一個屬性為 [ l ] 設備檔 (device): 區塊 (block) 設備檔,第一個屬性為 [ b ]; 字元 (character) 設備檔,第一個屬性為 [ c ]。

  22. Linux 檔案屬性

  23. 更改 Linux 檔案屬性指令 u g o a owner  = rwx  = 4+2+1 = 7 group  = rwx  = 4+2+1 = 7 others = ---  = 0+0+0 = 0 r=4,w=2,x=1 # chmod 770 test +(加入) -(除去) =(設定) r w x 檔案或目錄 chmod

  24. 更改 Linux 檔案擁有者指令 chown [ -R ] 帳號名稱 檔案或目錄 chown [ -R ] 帳號名稱:群組名稱 檔案或目錄 範例: # chown games test # ls -l test drw-r--r--    1 games     root        0 Jun 20 14:36 test # chown –R root:root tmp

  25. 更改 Linux 檔案所屬群組 chgrp 群組名稱檔案或目錄 範例: # chgrp users test # ls -l drw-r--r--    1 root     users        1 Jun 20 14:36 test

  26. 檔案與目錄 檔案檢視 常用指令

  27. 檔案檢視--ls • -a:顯示目錄內所有檔案,包含影藏檔 • -t:依據時間日期作排序 • -R:將目錄下的子目錄一併顯示 • -r:檔案的排序反向進行輸出 • -d:僅顯示目錄名稱 • -h:將檔案大小以簡易易懂的方式顯式 • -S:以檔案大小進行排序

  28. 常用指令 • cd:切換路徑 • mkdir:產生目錄 • pwd:查詢目前路徑 • cp:複製檔案 • rm:刪除檔案 • mv:搬移或更名檔案

  29. 切換目錄 查詢目前路徑 • PWD cd cd - cd /etc cd /etc/sysconfig cd ~ cd .. 29

  30. 檔案搬移 mv [選項] 來源 目的 mv /tmp/test /etc mv /tmp/* /tmp/test/ mv –f /tmp/* /tmp/test/ :強制覆蓋 mv –i /tmp/* /tmp/test/:詢問是否覆蓋 mv –u /tmp/* /tmp/test/:比較較新檔 30

  31. 觀看檔案內容 • cat由第一行開始顯示檔案內容 • tac從最後一行開始顯示,可以看出 tac 是 cat 的倒著寫 • more一頁一頁的顯示檔案內容 • less與 more 類似,可以往前翻頁 • head只看頭幾行 • tail只看尾巴幾行 • nl顯示的時候,順道輸出 行號 • od以二進位的方式讀取檔案內容

  32. 連結檔的介紹 • 連結檔的介紹: 什麼是 inode Block 是記錄『檔案內容資料』的地區,而inode 則是記錄『該檔案的屬性、及該檔案放置在哪一個 Block 之內』的資訊 • ln • hard link 不能跨 filesystem/不能 link 目錄 • symbolic link • ln [-s] [來源檔] [目的檔]

  33. 檔案與目錄權限 • chown改變檔案的擁有人 • chgrp改變檔案的所屬群組 • chmod改變檔案的可寫、可讀、可執行等屬性 • umask改變預設的建立檔案或目錄時的屬性 • chattr改變檔案的特殊屬性 • lsattr顯示檔案的特殊屬性

  34. 搜尋檔案或目錄 • which 查看可執行檔案的位置 # which ls • whereis 查看檔案的位置 # whereis [–b/-m] ls • locate 配合資料庫查看檔案位置 # locate ls #updatedb • find 尋找檔案 # find / -name “ls”

  35. 磁碟與硬體管理 • 查看硬碟或目錄的容量:df, du • 切割與格式化硬碟:fdisk, mke2fs, e2label, mknod • 檢查硬碟壞軌與資料同步化寫入:fsck, sync • 關於軟碟開機片: mkbootdisk, fdformat • 各式磁區的掛載:mount, umount • 設定開機時即掛載的方式:/etc/fstab • 虛擬記憶體 Swap:mkswap, swapon, swapoff • 磁碟效能:hdparm

  36. 指令參數說明-man • 【空白鍵】:往前捲動一個頁面 • 【b】:往後捲動一個頁面 • 【Enter】 :往下移動一行 • 【PageDown】 :往前捲動半頁 • 【PageUp】 :往後捲動半頁 • /關鍵字:往前搜尋關鍵字 • ?關鍵字:往後搜尋關鍵字 • 【q】:離開

  37. Man-章節介紹

More Related