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 New
    • 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 Note Insights Versions and GitHub Sync 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ###### tags: `1111` `lsa` `ncnu` # Week 03 (2022/09/29) [TOC] - Book mode: https://hackmd.io/@ncnu-opensource/book --- ## Open source 開源 - Brain: CPU - Logic: OS - Knowledge: Software - Source Code: 不用透過雜亂的程式碼就可以了解軟體背後執行的邏輯和設計(知其所以) - 好處是可以分享知識並進行知識的傳承 - Read - Rewrite - Improve - Share - Reverse Engineering: 逆向工程,指的是從二進制的檔案回推原本內容為何 > 但把微軟的軟體放到逆向工程工具會被吉 D: (版權問題咩 - Free Software Movement - Free to use (每個人都有使用的自由) - Study and Fix (Modify) - Redistribute - OpenSource Software - OSI (Open Source Instatude) - Certified Licenses (認證是否是自由軟體) ### OSS and FLOSS - OSS(Open Source Software): Better software - FLOSS(Free Libre and Open Source Software or Free Livre and Open Source Software): the Freedom of Use and Modify 自由軟體核心精神: 讓使用者自由使用 Open Source: 只是開放原始碼,不一定能夠自由運用 ![](https://i.imgur.com/Sdr38fL.png) :::info - [Linus Torvalds](https://zh.wikipedia.org/wiki/%E6%9E%97%E7%BA%B3%E6%96%AF%C2%B7%E6%89%98%E7%93%A6%E5%85%B9) - [Richard Matthew Stallman](https://zh.wikipedia.org/zh-tw/%E7%90%86%E6%9F%A5%E5%BE%B7%C2%B7%E6%96%AF%E6%89%98%E6%9B%BC) - [MINIX](https://zh.m.wikipedia.org/zh-tw/MINIX) - [GNU 定義](https://zh.wikipedia.org/zh-tw/GNU) - [GNU Hurd](https://zh.wikipedia.org/zh-tw/GNU_Hurd) - [Berkeley Software Distribution](https://zh.m.wikipedia.org/zh-tw/BSD) - [Mark Richard Shuttleworth](https://zh.wikipedia.org/zh-tw/%E9%A9%AC%E5%85%8B%C2%B7%E6%B2%99%E7%89%B9%E5%B0%94%E6%B2%83%E6%80%9D) ::: - Ubuntu 第ㄧ版本 - 2014 年 - 4.10 ## FHS 檔案系統階層標準 - FHS: FileSystem Hierarchy Standard-- - 定義 Linux 作業系統中主要目錄結構和目錄內容 - 由Linux Foundation 進行維護及協同管理 - 為什麼要有FHS? - 使用Linux來開發軟體的人越來越多 :::info ### What is FileSystem - 一種 Method(方法)、資料結構,讓作業系統可以存取資料 - 沒有FHS的話 - 所有磁區都會在一起 - 沒有起始點也沒有中止點 - 有FHS的話 - 資料會切割並進行命名 - 每一組資料都稱為`file` ::: ![](https://i.imgur.com/ODQMUf8.png) ### `/`根目錄 & 它的子目錄 - **在 Linux 系統下,萬物皆是檔案** - ex. 已登入使用者、一條網路線、CPU、硬體 - `/` 萬物之根源,稱為 root ,是系統重要的目錄 - 所有檔案都在root之下 - 避免檔案放在 root 分割區 - 如果一個檔案放在不同分割區可以分散風險 - 減少系統 crash 的機會 - 如果檔案都放在同一分割區,只要有 1 bit 壞掉,系統就會 crash 掉 ### 根目錄下需要存在的目錄 - ![](https://i.imgur.com/vRrToJM.png) - `/bin` = binary : 裡面存放一般使用者 一些基本的使用指令 - 例如: `cat` - `/sbin` = super user binaries: 需要特殊存取權限的指令 > s: superuser - `cat`: 查看檔案內容,將內容印製在terminal上 - `ls`:將目錄底下所有檔案列出來 - `which`: 查看檔案位置 - `cd + 空格 + 目的目錄`:進入目錄 - `cd ..`:回到上一層目錄(只打cd直接退回主目錄) - `ifconfig`: 查看目前已啟動網卡的相關資訊 > 需要先自行下載ㄛ :::info - 安裝指令 ```shell= sudo apt install net-tools ``` - 執行指令 `ifconfig` ![](https://i.imgur.com/huZoCfM.png) > enp0s3: 網卡名稱(根據電腦不同,名稱也可能不同) - 關閉網卡 ```shell= sudo ifconfig <網卡名稱> down ``` - 開啟網卡 ```shell= sudo ifconfig <網卡名稱> up ``` - 查看所有網卡詳細內容(已啟動+未啟動都會顯示) ```shell= ifconfig -a ``` - ![](https://i.imgur.com/zwnL0hh.png) ::: - `lib` = library (函式庫) - 放置開機時會用到的函式庫 - 放 `/bin` 或 `/sbin` 底下指令的函式庫 :::info What is library - 各種開發軟體的集合庫 - `/bin` 或 `/sbin` 放指令,`lib`放指令執行時要用到的 code > 食譜目錄 = lib目錄下目錄下目錄下目錄下目錄下目錄下目錄下目錄下 > 選擇煮麻婆豆腐 = 選擇lib中的一個開發軟體 ::: - `/boot` = bootstrap - 放開機會使用到的檔案 - 包括 Linux kernel 檔案以及開機選單與開機所需的設定檔 - `initrd.img ` - initialized ram disk - 開機時會創一個臨時的根目錄: initrd.img - ![](https://i.imgur.com/VCecqIg.png) - `/dev` = device - 存放各種硬體設備檔 - 例如: 滑鼠、鍵盤、CD - ![](https://i.imgur.com/n815Vxa.png) - `/dev/pts` - `/media` - 放置可移除的裝置(eg. USB 、印表機)自動卸載的. 載目錄 - 可移除的裝置: 光碟,DVD - 若插入 USB,系統會**自動**將檔案掛載於 `/media` :::info ### 掛載 - 一個儲存裝置安裝後,要告訴他檔案存在哪裡 - 簡單來說: 將硬碟中的檔案連接到系統的某個資源 - 若掛載的檔案是暫時性使用,就掛載到 `media` 或 `mnt` 就好 ::: - `/mnt` = mount - 放置系統管理員臨時**手動**掛載的檔案的目錄 - 很久以前,這個目錄的用途與 `/media` 相同 - 若插入 USB,系統**不會自動**將檔案掛載於 `/mnt`,要自己**手動**掛載 - 若掛載的東西是暫時使用則會放置到 `/mnt` 中,若是長期使用則會依照功能掛載到對應根目錄中 - 外部資源 - `/etc` - 放置系統主要的設定檔 - ![](https://i.imgur.com/SOkGA9n.png) - `/etc/passwd`: user 的帳號密碼檔 - 不用 `sudo` 就可以查看 - 但密碼有被加密 (`$number$`為加密方式) - ![](https://i.imgur.com/eYiw2k0.png) > 每行代表一個帳號 - `/etc/shadow`: 真正存 user 密碼的地方 - 需要 `sudo` 才能查看 - `/opt` - 存放第三方軟體之目錄 >還有另外一個目錄下也可以存放第三方軟體 `usr/local` - 怕亂七八糟的檔案污染系統的話,可以裝到這個目錄底下 - 像書桌最下面的抽屜,不知道要放哪裡的檔案都可以放這裡 :::info ### 小實作: 安裝第三方軟體 - 自己額外安裝到 Linux 中的軟體 - 只要不是 `apt install` 的軟體,都裝到 `/opt` - 例如 : Chrome - 下載 Chrome 安裝檔 ```bash= wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb ``` - 安裝 Chrome ```bash= sudo dpkg -i google-chrome-stable_current_amd64.deb ``` ::: - 複製虛擬機外的指令到虛擬機內 ![](https://i.imgur.com/Djymw9Y.png) 接著在 terminal 內左鍵與右鍵同時按會出現 Paste 的選項選取即可 > 複製:`ctrl`+`shift`+`c` > 貼上:`ctrl`+`shift`+`v` - debian 的`.deb`與 windows 的`.msi`相同 - 在ubuntu下可以直接點開安裝,也可以用指令去安裝。 >都會幫你考慮好對應的版本 - `.appimage` ... --> 在mac上的`dmg`(解壓縮後掛載成虛擬目錄) - 好處是不用擔心函式庫更新、相容性高 - 缺點是系統已經有,但你還下載一次 - 開啟的時間很慢(每次都要從那一大包解開) - `|grep` + 搜尋條件 - 尋找檔案內的字串 - 所有東西都是檔案,檔案可以去 讀取、寫入 - 但重要的檔案不會隨便給一般使用者去讀取或更改 - 因此不要隨便使用sudo(超級使用者),有可能因此改到重要的檔案 - `w`: 查看系統現在有誰登入 ![](https://i.imgur.com/rVsMpJt.png) - `sudo write <使用者1名稱> <使用者2名稱>`: 把某個訊息寫入某登入者登入的介面中 :::success ### 9/29 小作業: 1. 在 Ubuntu software 裡面選擇有興趣的軟體進行安裝 ![](https://i.imgur.com/hE1vHWq.png) 2. 查詢`dpkg` 和`apt` 指令的意思 :::

    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