NCNU-OpenSource
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: 1091, lsa --- - Book mode https://hackmd.io/@ncnu-opensource/book # Week 02(2020/09/24) ## HW [看課綱,決定想聽老師說什麼,不想聽老師說什麼](https://moodle.ncnu.edu.tw/mod/assign/view.php?id=606753) ## Ubuntu 安裝補充說明👽 - [VirtualBox 建立新的虛擬機器設定教學](https://www.kjnotes.com/devtools/86) - [VirtualBox 虛擬機器安裝 Ubuntu Desktop 設定與使用教學](https://www.kjnotes.com/linux/29) copy on write([wiki](https://hackmd.io/@ncnu-opensource/By4H6JLNW/%2FlKenuv09Slq0ScW6awpMkg?type=book)) - 開啟後的 virtualbox 的 logo 畫面是[BIOS](https://zh.wikipedia.org/wiki/BIOS) - 硬碟檔案類型 - [VDI](https://zh.wikipedia.org/wiki/%E6%A1%8C%E9%9D%A2%E8%99%9A%E6%8B%9F%E5%8C%96) ( Virtual Desktop Infrastructure,桌面虛擬化 ) - 負責將桌面環境架設在遠端伺服器及資料儲存系統 - VDI 系統能夠提昇硬體使用效率,易於進行集中管理 - [VHD](https://en.wikipedia.org/wiki/VHD_(file_format)) ( 虛擬硬碟 ) - [VMDK](https://zh.wikipedia.org/wiki/VMDK) - 最初為VMWare開發,但其他虛擬機同樣支援此文件格式 - [VDI管理員應該掌握的四種虛擬磁碟格式](https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/546575/) - BIOS 裝在主機板上,通電後會去做開機所必要的偵測,並試著在硬碟上找出開機磁區,找到開機 kernel 就把他放進記憶體中 - 預設進行開機流程(10秒),試用介面而非直接洗掉 - Ubuntu [live usb](https://zh.wikipedia.org/wiki/Live_USB) 預設是試用的界面,可以選擇試用或者安裝 - 當 windows 中毒應該用 Ubuntu 開機去讀取資料,避免中毒擴散、拯救資料 - 若 ubuntu 系統無法開機也可以使用 live usb 進去系統修正錯誤 - 早期沒有除了英文以外的語言 - 鍵盤也有很多種,安裝時根據自己需要來選擇,如瑞典文、俄文、法文,一些特殊符號位置也有可能不同(常用是 qwerty 鍵盤 也有 dvorak 鍵盤) - [Keyboard layout](https://zh.wikipedia.org/wiki/%E9%94%AE%E7%9B%98%E5%B8%83%E5%B1%80) - [QWERTY](https://zh.wikipedia.org/wiki/QWERTY%E9%8D%B5%E7%9B%A4) - [DVORAK](https://zh.wikipedia.org/wiki/%E5%BE%B7%E6%B2%83%E5%A4%8F%E5%85%8B%E9%8D%B5%E7%9B%A4) - 安裝 Ubuntu - minimum install 大約 180mb,但是許多功能都要另外安裝 - normal install 有許多常用軟體 - About 磁碟分割 - 資料加密 - [TrueCrypt](https://zh.wikipedia.org/wiki/TrueCrypt) - 已停止開發更新 - [VeraCrypt](https://zh.wikipedia.org/wiki/VeraCrypt) - 開放原始碼的一個加密軟體,Truerypt 的一個分支 - LVM(Logical Volume Manager,邏輯捲軸管理員) = 虛擬分割機 - 不是直接在磁碟上,救資料比較麻煩 - 彈性的調整 filesystem 的容量 - Something else (手動分割) - 後「檔案系統階層」說明 - About 電腦時間 - 主機板上的 CMOS 有電池,因此時間就算關機後仍然會大致正確 - [RTC](https://zh.wikipedia.org/wiki/%E5%AF%A6%E6%99%82%E6%99%82%E9%90%98) ( Real-time clock )透過石英震盪頻率來對時 - 精準度最低 - [NTP](https://zh.wikipedia.org/wiki/%E7%B6%B2%E8%B7%AF%E6%99%82%E9%96%93%E5%8D%94%E5%AE%9A) ( Network Time Protocol )是一個網路對時的通訊協定。另有 [NTPD](https://en.wikipedia.org/wiki/Ntpd) - [GPS](https://zh.wikipedia.org/wiki/%E5%85%A8%E7%90%83%E5%AE%9A%E4%BD%8D%E7%B3%BB%E7%BB%9F) ( Global Positioning System )三點定位,發出電磁脈衝波,一秒內就可以接收,透過接收到的脈衝波時間差推算正確時間 - 精準度最高(原子鐘) - About 帳號密碼 - 若只有英文、數字,約 3~5 分鐘會被破解(暴力破解) - 密碼建議加上特殊符號(因為複雜度是次方等級) - 為了資安安全,密碼存在資料庫時不要用明碼儲存 - 測試:註冊完某網站,按下「忘記密碼」 - 直接寄給你原本的密碼:用明碼儲存(危險) - 寄重設、新token(安全) - Why 安裝完要 reboot ? - 若突然斷掉電腦電源,檔案有可能消失 - 記憶體比硬碟快非常多,因此突然關機,會來不及將記憶體中的buffer寫入。 - 數位鑑識中,有機會從關機的記憶體取出資料 - reboot 目的是重開機後,bios 將硬碟中的新資料寫入到記憶體中才可以使用新安裝的系統[來源請求] ## [檔案系統階層標準 (FHS)](https://zh.wikipedia.org/wiki/%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E5%B1%82%E6%AC%A1%E7%BB%93%E6%9E%84%E6%A0%87%E5%87%86) - 沒有像一般系統一樣分C、D槽,而是分階層 **directory tree(目錄樹結構)** :::info directory tree(目錄樹結構) 以根目錄(/)為主,向下呈現分支狀的目錄結構的一種檔案結構 ::: ![](https://i.imgur.com/hS53GKi.png) - 根據需求於目的掛到不同地方 ~~預設是根目錄(/)~~ - /boot : 掛載 kernel,通常 100mb 就足夠 - 最重要的檔案:[initrd.img](#BT補充~):包含開機所需的 - /dev : 硬體裝置檔案(EX. 印表機、滑鼠、USB) - /etc : 大部分應用程式的設定檔(EX. 各種版本 python ) - /home : 每個使用者有專屬的家目錄,且擁有全部權限 - /opt : 放置各種雜七雜八應用程式(EX. xampp ) - /tmp : 備份臨時檔案放置的地方,重啟後有可能被刪除 - /usr : 通常來說是 Unix Software Resource 的意思,user 安裝的東西 - /usr/bin : 非必要但很常用 > usr 是 user 還是 Unix Software Resource 有爭議啦有爭議[name=BlueT] - /var : 時常變動的內容 ex:系統記錄檔、誰登入登出、誰嘗試連線... - /var/mail : 放使用者收到的 mail - /var/log : 應用程式產生的 log 檔案 - swap - 常用的 cache 放在硬碟中,而不是長期佔用 memory - 待命中的電腦,為了省電,將 ram 中的資料放到 swap ,可以降低記憶體耗能 - server: 有些使用者不會一直連線,不用一直跟使用者溝通,多的記憶體空間可以拿去跟別的 client 連線 - 磁碟格式 - linux 常用 [ext4](https://zh.wikipedia.org/wiki/Ext4)格式 - multiblock allocation - delayed allocation - 相比 ext3,減少了搜索空間的時間 - 有人記得第二種嗎QAQ - 日誌檢查: 每次開機時,檢查是否有資料短少,可恢復遺失的資料 - 可以快速的檢查出哪裡有空間 (把哪裡是空的先記起來) :::info ext4(第四代擴充套件檔案系統, Fourth extended filesystem) Linux系統下的紀錄檔檔案系統 ::: > [wiki](https://zh.wikipedia.org/wiki/%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E5%B1%82%E6%AC%A1%E7%BB%93%E6%9E%84%E6%A0%87%E5%87%86#%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84) ### BT補充~ > 考試唯一的目的,就是把你當掉 [name= BlueT] > 幹,不准用網路喔 [name= 老闆] - 硬碟只是元件 - linux(類 unix ) 是從 unix 變成的,一開始是大型主機,一顆磁碟超大,所以在 unix 相關的系統中,分成什麼槽不是最重要的 - 就本質來說,只差在不同架構而已 - 根目錄(/) = 一切的源頭 - 根目錄延伸出其他所有目錄 - /boot: 核心 - [initrd](https://zh.wikipedia.org/wiki/Initrd).image 臨時檔案系統: 包含了各種開機所需的img檔,可以直接載入記憶體裡面 - 在Linux中,所有東西皆為檔案 - 目錄、硬體、檔案... - 硬體的檔案 (/dev下) - [SATA](https://zh.wikipedia.org/wiki/SATA)介面的硬碟:sda(第一顆硬碟)、sdb(第二顆硬碟)... - 所以可以直接對硬碟做一些非常低階的動作,甚至可以知道硬碟中第一個byte是什麼 - 早期 unix 是一種分類,有不同發行版本 - [Red Hat](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiUrpGd04HsAhUmG6YKHbUNB74QFjADegQIBBAB&url=https%3A%2F%2Fzh.wikipedia.org%2Fzh-tw%2FRed_Hat_Linux&usg=AOvVaw1VDa_3cIF1JE98wsnNqFlC)系列很多都還沒有遵循FHS標準 - 分區的補充 - /etc: 大部分的設定檔都會在裡面 - /home: 包含所有**使用者各自的家目錄**(集合) - /lib = library > 要念 lib 還是 lib 隨便你啦,但我都念 lib [name= BlueT] - library檔 - /media = 映射外部的媒體資料(EX:光碟機、隨身碟) - /mnt: mount(掛載) - 可以掛載新的硬碟(非要長久使用的) - 在系統壞掉後,用 ubuntu 重開機 - 伺服器硬碟數量有限,或不想放在自己機器上,但想遠端存取 - 可以掛在硬碟在任何地方,但是掛載在 /mnt 是標準作法 - /opt: 怕這個檔案玷汙系統的話,可以把東西放在這裡(雜七雜八的東東) > 但他不是垃圾桶唷[name= BlueT] - ==/proc== - 是虛擬目錄,硬碟上不存在 - 對應到 kernel 的空間 - 所有正在進行中的 process 皆在這 - 利用 process 的 id 找尋 - 可以查詢一個 process 從何來從何去、執行了甚麼 - 除非了解自己在寫甚麼,不然盡量不要去修改與寫入 - ~~進入 `proc/` 後 `ps aux` 可列出資訊~~ - 該 process 結束後資料夾依然會存在 - /root: (不是指根目錄,而是根目錄底下的分割區) - **超級使用者(su)的家目錄** - linux 系統底下還有一般使用者 > 超級使用者就是這個世界的神 [name= BlueT] - 壞了的話,那一區就壞了 - 舊時: 建議獨立分割 - 過去硬碟切割有先後順序 - 效能有差異(讀寫頭移動的時間) - 將 root 獨立放置,避免壞的時候影響其他目錄 - 新時: - 強力反對用 超級使用者(su) 的角色來做事情 - 不會獨立分割 - /sbin : 即 superbin (跟/bin類似) - 所有系統都有 bin >我說在座的各位電腦裡都有 bin [name= BlueT] - 基本指令都在 bin 裡面,超級使用者專用放在 sbin - /tmp - 重開機就會全部不見 - 有價值的東西盡量不要放在裡面 - /var - 裡面的東西時常變動 - EX. 系統記錄檔(常寫入,記錄某人登入登出、啟用哪些服務...等資訊) - 記錄檔的存在意義 : 事後可以去查驗、查看 - 任何儲存媒體都能掛在目錄裡面 - /var/log : 記錄檔就在此 - /var/mail - /var/spool - 為什麼要分割磁區? - 考量系統的效能 : - 將資料集中,有助於資料讀取的速度與效能 - 磁區位置不同會影響讀寫速度 - 考量資料的安全性 : 磁區檔案系統如果損壞,不會影響到其他磁區 - 壞處 : 分割大小難以拿捏 ## 常用指令 - 使用指令更新 - `sudo apt update` : 檢查軟體源更新 - `sudo apt upgrade` : 下載並安裝更新 - `pwd` : 顯示目前位置的完整目錄 - `cd [目錄]` : 前往指定目錄 - `cd ~` : 回到家目錄,直接使用`cd`效果也一樣,其中`~`表示家目錄 - `cd ..` : 回到上一層,例如: `/home/user` -==`cd ..`==-> `/home` - `cd -` : 回到上個目錄,例如: `/home/user` -==`cd /etc`==-> `/etc` -==`cd -`==-> `/home/user` - `cd /etc` : 切換至根目錄下的`etc`文件夾,最前面的`/`表示根目錄(絕對路徑) - `cd ./abc` : 切換至當前位置裡名稱為`abc`的文件夾中,最前面的`./`表示當前文件夾,忽略`./`也可以達到同樣效果(相對路徑) - `ls` : 看目前所在位置有的檔案 - `ls -a`: 顯示隱藏檔 - `ls -l`: 顯示詳細內容 - `a`和`l`可以並用: `ls -al` - `man`: 查詢指令內容 - `top`: 查看系統資源使用情況 > [鳥哥的 Linux 私房菜](https://linux.vbird.org/) ## 修改常用下載源 - 開啟 software & update > download from: Other... > Choose a Download Server -> Taiwan - 將軟體下載源換成 ftp.ubuntu-tw.net (該資料源在暨大) - 加快下載速度! - 關閉並 reload

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    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

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully