# 成為駭客的前一哩路 ## Chapter 1 - Getting Start With The Basics ### Introductory Terms and Concepts * Binaries: 二進位執行檔 (就像在 Linux 中的 Windows 上的執行檔) ,通常是 Linux 的指令及工具。 * Case sensitivity: 在 Linux 系統中,檔案名稱和路徑的大小寫要區分好 (不然會找不到) * Directory: 資料夾 * Home: /home 資料夾,通常檔案創建儲存的地方 * Kali: 一個 for hacker 的 Linux 系統 * Root: 管理員帳號 * Script: 在終端上執行的指令、腳本 * Shell: 在 Linux 上執行指令的環境 (bash) * Terminal: 命令行介面 (Command Line Interface CLI) --- ### A Tour of Kali * /root: 管理員的主資料夾 * /etc: 包含 Linux 設定檔 (控制程序啟動) * /home: 使用者的主資料夾 * /mnt: 其他額外的檔案系統 * /media: CD 或 USB 連接或安裝到的資料夾 * /bin: 裝 *binaries* 的地方 * /lib: 裝 *libraries* 的地方 (類似 Windows 的 DLL 檔案) --- ### Basic Commands in Linux 1. 查詢當前路徑: **pwd** (print working directory)  2. 查看當前登陸的使用者: **whoami**  3. 改變當前所在位置: **cd** (change directory)  如果想要回到上一層資料夾可以用 `cd ..`  想要回到上上層可以使用 `cd ../..` 以此類推 4. 查看當前資料夾內資料: **ls** (list)  也可以用 `ls PATH` 來去查看特定資料夾內的資料  也可以加上參數 `-l` 來查看更詳細有關權限 (l 代表 long)  另外也可以加上 `-a` 來查看隱藏的資料夾或檔案  :::info `-l` 和 `-a` 都可以單獨使用或混合使用,順序也不影響 ::: 5. 查看幫助: **--help** * `--` 代表要使用單字的選擇 (`--help`) * `-` 代表要使用單字元的選擇 (`-h`)   6. 查看幫助手冊(更詳細): **man** (manual)  進入 man 的頁面後可以使用上下方向滾動菜單  如果要退出就按下 `q`,按下 `h` 可以進入指令幫助 --- ### Finding Stuff 1. 查看儲存庫中含有關鍵字的資料: **locate**  2. 找到工具的 *binaries* 和 *man* 位置: **whereis**  3. 找到工具的 *binaries* 路徑(比 `whereis` 更精確去找執行檔): **which**  4. 更強力的查找工具: **find** :::info 語法: `find directory option expression` ::: * 範例: - 顯示資料夾裡面的內容  - 退回 /home 開始找 crud.py  - 獲得找尋路徑  5. 顯示運行中的進程: **ps aux**  6. 篩選出特殊關鍵字: **grep** 我們可以搭配 `ps aux` 去使用查找特定的進程  --- ### Modifying Files and Directories 1. 查看檔案內容或創建檔案: **cat**  2. 新增檔案內容或創建檔案: **cat >>**  3. 複寫檔案內容或創建檔案: **cat >**  4. 創建檔案: **touch**  5. 創建資料夾: **mkdir**  6. 複製檔案: **cp**  7. 重新命名檔案: **mv**  8. 刪除檔案: **rm**  9. 刪除資料夾: **rmdir**  如果資料夾內有資料是不能直接刪除的,要先進入資料夾刪除檔案後才能刪除資料夾  使用 `rm -r` 即可刪除資料夾及其內容 --- ### Exercise 1. 在 root (/) 資料夾內使用 `ls` 探索 Linux 的檔案結構,利用 `cd` 改變位置和 `pwd` 查看是否真的進入該資料夾 2. 使用 `whoami` 查看登陸的使用者 3. 使用 `locate` 查找 **wordlists** (用來 Password Cracking) 4. 使用 `cat` 創建新檔案再新增內容到檔案 5. 創建新資料夾 **hackeddirectory**,在裡面創建新檔案 **hackedfile**,將其複製到 **/root** 資料夾並重命名為 **secretfile** --- <a href="https://hackmd.io/@MatchaCode/H1qPTyHma" role="button" style="display:block; text-align:right;"> 下一篇: Chapter 2</a>
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up