iT邦幫忙

0

Cyber security -4 Module3 Linux commands in the Bash shell

  • 分享至 

  • xImage
  •  

Learning Objectives

  • Navigate the file system using Linux commands via the Bash shell.
  • Manage the file system using Linux commands via the Bash shell.
  • Describe how Linux handles file permissions.
  • Use Linux commands via the Bash shell to authenticate and authorize users.
  • Use sudo to provide root user permissions.
  • Access resources that provide support on using Linux commands.

The Filesystem Hierarchy Standard(FHS)

  • 檔案系統階層標準 the components of the Linux architecture.
  • Filesystem Hierarchy Standard 是Linux操作系統中的重要概念,指的是一個規範,確定各種檔案在系統中的組織方式和位置。
  • 這個標準設計的目的是為了讓不同的Linux發行版在檔案系統結構上保持一致性,這樣使用者和開發者都能更方便地找到和管理檔案,理解檔案之間的關係。
  • Root directory (/) 是最高層目錄,所有子目錄都從這裡分支。
  • 標準目錄包括:
    /home:每個使用者的家目錄
    /bin:執行檔與二進位檔案
    /etc:系統設定檔
    /tmp:暫存檔案(任何人都可修改,常被攻擊者利用)
    /mnt:掛載外部媒體(如 USB、硬碟)

Core commands for navigation and reading files

標題 內容
引言 學習如何與Linux OS溝通,重點在於導航檔案系統。
檔案系統的概念 想像一棵樹,根部是Linux檔案系統的根目錄,根目錄是最高層目錄。
檔案系統的組織 提到Filesystem Hierarchy Standard(FHS),組織數據,所有操作都基於檔案。
常用命令 pwd:顯示當前工作目錄,ls:列出檔案和目錄,cd:在目錄間導航。
示範命令的使用 使用pwd確認當前目錄,使用ls顯示目錄內容,使用cd logs進入logs目錄。
閱讀檔案內容 cat:顯示檔案全部內容,head:顯示檔案前十行。
示範檔案的閱讀 使用cat access.txt查看全文,使用head access.txt查看前十行。
指令 功能說明 範例
pwd 顯示目前所在目錄(Print Working Directory) pwd/home/analyst
ls 列出目錄下的檔案與資料夾(List) ls projects
cd 切換目錄(Change Directory),可用絕對或相對路徑 cd ..(上一層)cd /home/analyst/projects
cat 顯示整個檔案內 cat updates.txt
head 顯示檔案開頭(預設 10 行,可用 -n 指定行數 head -n 5 updates.txt(顯示前 5 行)
tail 顯示檔案結尾(預設 10 行) `tail updates.txt
`
less 分頁顯示檔案內容,可用快捷鍵操作(如空白鍵、b、上下鍵、q) less updates.txt
Space bar 下翻一頁
b 上翻一頁
Down arrow 下移一行
Up arrow 上移一行
q 退出

圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言