Expect Lai
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • 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
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • 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 Sharing URL Create Help
Create Create new note Create a note from template
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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • 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
    --- type: slide title: 建中資訊 Basic Linux tags: INFOR35th slideOptions: transition: slide theme: black --- # Basic Linux ### Yu-Chi Lai --- # Intro ---- ## Linux 介紹 + 由 Linus Torvalds 於 1991 年首次發布 + 自由且開放的類 Unix 系統 + 高安全性、高穩定性、高移植性 + 常用於伺服器 ---- ## 特色 + 通常無 GUI 介面,效能高 (硬體需求、耗的資源少) (? + **免費** + 有超多發行版本 ( e.g: Ubuntu、Debian、CentOS、PopOS、Mangaro... etc),自由度、架構開放穩定 ---- | Linux 的 Logo | Linus Torvald | | -------- | -------- | | ![](https://i.imgur.com/4YNpWrQ.png =350x350) | ![](https://i.imgur.com/2azTqFs.png =500x300) | ---- ## 環境設定 (方法很多) + [WSL](https://hackmd.io/@billsun/BJByCIUHf) + 到 [官網](https://ubuntu.com/download/desktop/thank-you?version=22.04.1&architecture=amd64) 下載映像檔,以 USB & Rufus安裝 + Virtual Machine --- # Commands ---- ## Command usage ```bash! $ command(指令) [Options](可選選項) Argument(必要參數) # e.g. $ ls -al ./ ``` ---- ### ls [DIR|FILE] + 列出資訊,未指定為當前資料夾 + -a: 列出全部 (包含隱藏檔案) + -l: 詳細資訊 ```bash! $ ls -a $ ls -l ``` ---- ### Tab auto complete + tab 鍵可以自動補全 + 檔案名稱 + 資料夾名稱 + 指令 ---- ### clear + 清空當前 Terminal 的文字 + 你也可以按 Ctrl+L ```bash! $ clear ``` ---- ### cd [DIR] + 切換資料夾 + ./: 當前資料夾 + ../: 母資料夾 + ~: 家目錄 (/home/<USER>) ```bash! expectlai@linux: ~/INFOR35th$ ls # Images Lectures 225 expectlai@linux: ~/INFOR35th$ cd Lectures expectlai@linux: ~/INFOR35th/Lectures$ ``` ---- ### pwd + 顯示當前路徑 (存於 `env` 中) ```bash! expectlai@linux: ~/INFOR35th$ pwd /home/expectlai/INFOR35th ``` ---- ### mkdir [DIR] + 創建新資料夾 + `-p`: 創建過程有不存在的資料夾,會同步創建 ```bash! $ mkdir programing $ mkdir test/dir1 # mkdir: can not create directory, ... $ mkdir -p test/dir1 ``` ---- ### cat [FILE] & FILE [file] + cat 可以抓取檔案內容 + file 可以用 File Header 查看檔案類型 ```bash! $ cat orz.txt # OOO,我好崇拜你,我是你的粉絲! $ file orz.txt # orz.txt: ASCII Text ``` ---- ### strings [FILE] + 預設抓取 4 個以上連續可視字元為一組顯示,不包含 (`\n`,`\t`,`\r`) + `-n`: 指定最短連續可視字元長度 ```bash! $ strings tmp # Hello # world # Goodbye! ``` ---- ### man help 查看指令手冊 ```bash! $ man ls ``` ![](https://i.imgur.com/aUc3KL1.png =750x430) ---- ### apt [OPTIONS] <APT> 套件管理工具 + install: 下載套件 + upgrade: 更新特定套件 + update: 更新下載資訊 ![](https://i.imgur.com/Hg4B2iu.png) ---- ### sudo [CMD] + 使用最高權限執行指令 + su: 切換至最高權限 (通常為 root) ![](https://i.imgur.com/Phb1BjG.png) ---- ### Authority ![](https://i.imgur.com/FouCh3H.png) ---- ### Authority code ![](https://i.imgur.com/9SrQEUQ.png) ---- ### chmod [DIR|FILE] + 修改檔案或是資料夾權限 + +-: 新增或移除權限 + u: 針對當前使用者修改權限 ![](https://i.imgur.com/PlyGrDE.png) ---- ### rm [DIR|FILE] + 移除檔案或資料夾 + `-r`: 移除資料夾 + `-f`: 強制移除 ![](https://i.imgur.com/7iuHbxw.png) ---- ### mv [DIR|FILE] [DIR|FILE] 移動或是重新命名 ![](https://i.imgur.com/yYiE300.png) ---- ### cp [DIR|FILE] [DIR|FILE] + 複製檔案或資料夾 + `-r`: 複製資料夾 ![](https://i.imgur.com/ckCngzv.png) ---- ### grep [STR|REGEX] [FILE] & history grep + 搜尋檔案中,符合格式的字串 + `-i`: 忽略大小寫 + `-o`: 僅輸出符合的字串 + `-P`: 使用 Regex history + 顯示指令歷史紀錄 + `-c`: 清空歷史紀錄 ---- ![](https://i.imgur.com/3YtvZMV.png) ---- ### data stream Unix 3 data stream | stdin | 標準輸入 | code: 0 | | -------- | -------- | -------- | | stdout | 標準輸出 | code: 1 | | stderr | 標準錯誤輸出 | code: 2 | ---- ### data redirect + \>: 資料導入至檔 + \>>: 資料串接至檔案內容後 + 2>&1: stderr 導向至 stdout ![](https://i.imgur.com/4uoKYmc.png) ---- ### pipeline | + 傳遞前一個指令的 stdout 至後方的 stdin ![](https://i.imgur.com/I8sxUHU.png) ---- ### Previous command + 使用上下鍵切換至使用過的指令 + `!!`: 輸出、執行最後一次執行的指令 --- # Practice ---- 練習 + [picoCTF 的 General skills](https://play.picoctf.org/practice?category=5&page=1) + 撰寫 [shell script](https://blog.techbridge.cc/2019/11/15/linux-shell-script-tutorial/) + 把 Linux 的課程整理成 .md 文件,丟上 Github ---- # The end #### Thanks for your listening!

    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