IMOK
    • 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

      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
    • Make a copy
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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

    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
    --- type: slide --- <style> .command { display: inline-block; font-size: 24px; color: black; background-color: white; padding: 7px; border-radius: 10px; margin: 5px; } </style> ## 計算機概論Lab-10 ### LINUX ![image](https://hackmd.io/_uploads/rJHBJjlQkx.png) <p>https://hackmd.io/@IMOK/Lab10</p> --- <img src="https://hackmd.io/_uploads/ryUSIqnJT.jpg" width=400 style="border-radius:1000px;"/> 講師: 賴昱有 --- <img src="https://hackmd.io/_uploads/BJqae3xX1e.png" width=400 /> --- ### OS <style> ul { padding-left: 35px; /* 調整縮排 */ } li { font-size: 30px; /* 調整標點大小 */ } </style> <ul> <li>Windows</li> <li>Unix <ul> <li>Unix-like <ul> <li>BSD <ul> <li>FreeBSD</li> <li>Darwin <ul> <li>MacOS</li> <li>iOS</li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> <li>Linux <ul> <li>Ubuntu</li> <li>Arch</li> <li>Android</li> </ul> </li> </ul> --- ### UNIX <font size = 5>20 世紀 70 年代由 AT&T 的貝爾實驗室開發多使用者、多任務的作業系統</font> <br> ### UNIX LIKE <font size = 5>模仿了 Unix 的設計與概念的衍生系統其中 BSD 系列與 MacOS 較為知名</font> --- ### GNU <font size = 5> GNU's Not Unix!</font> <font size = 5>推動自由、開源軟體的組織</font> <font size = 5>最初的目標是建立一個完整的作業系統替代Unix</font> <font size = 5>其提供工具包含GCC、Bash、glibc等</font> <font size = 5>原使用GNU Hurd後使用Linux kernel作為核心</font> <font size = 5>如 Debian、Ubuntu、Red Hat皆為GNU/Linux系統</font> --- ### Terminal <font size = 5>Terminal or Console為用戶與主機進行互動的硬體裝置 </font> <font size = 5>如今多數情況下,通常指的是 CMD(命令提示字元)等虛擬介面。</font> ---- ### Shell <font size = 4>使用者與作業系統之間的接口</font> <font size = 4>將使用者指令解析後,與作業系統內核(Kernel)進行溝通</font> ![image](https://hackmd.io/_uploads/rJ_H02eQyg.png) ---- ### 常見的Shell種類 + <font size = 4>Bourne Shell(sh):最早期的 SHELL,由 UNIX 開發。</font> + <font size = 4>Bash(Bourne Again Shell):基於 Bourne Shell,加入許多新功能。</font> + <font size = 4>C Shell(csh):以 C 語言語法為基礎,適合熟悉 C 語言的使用者。</font> + <font size = 4>Korn Shell(ksh):結合 Bourne Shell 和 C Shell 的優點,適用於高效能腳本需求。</font> + <font size = 4>Z Shell(zsh):功能非常強大,兼容 Bash,但在腳本撰寫、介面美化及插件支援方面表現更佳。</font> + <font size = 4>Windows powershell : 內建於Windows系統,僅限於 Windows 作業系統使用。</font> --- ### ssh(secure shell) <font size = 5>是一種遠端連線的協定</font> <font size = 5>不過是文字介面的</font> <font size = 5>使用非對稱式加密 相比 telnet 更安全</font> <font size = 5>用法 : <span class="command">ssh {user}@{host}</span></font> <font size = 5>e.g. <span class="command">ssh b0135XXXX@linux.aclab.cool</span></font> <font size = 5>or 使用 GUI (Bitvise SSh Client)</font> ---- ### SFTP (Secure File Transfer Protocol) <font size = 5>基於 SSH 的檔案傳輸協議,提供類似於 FTP 的功能,但所有通信都經過加密。 提供了文件操作的完整功能,如檔案上傳、下載、刪除、檔案權限修改等。)</font> ### SCP (Secure Copy Protocol) <font size = 5>基於 SSH 的檔案傳輸工具,用於快速、安全地傳輸檔案。 它的功能比 SFTP 簡單,主要專注於檔案的上傳和下載。)</font> --- ### 檔案系統結構 <div style="float: left;margin : 0px 0px px 20px"> <img src= "https://hackmd.io/_uploads/S1KM36xmJl.png" width=650 style="margin : 20px 0px 0px 0px"/> </div> <div style="margin : 0px 0px 0px 0px"> <img src= "https://hackmd.io/_uploads/S12x3plQJx.png" width=300 style="margin : 20px 0px 0px 0px"/> </div> --- ### 檔案權限 <font size = 5 > 列出檔案 <span class="command">ls -l</span></font> ![image](https://hackmd.io/_uploads/rkflJAxm1g.png) <font size = 5 ><span class="command">- rwx r- - r- -</span></font> <style> table { width: 50%; border-collapse: collapse; line-height: 1; /* 行距 */ } th, td { font-size: 24px; /* 字體大小 */ } </style> | permission |count | description | | ----------- | ---------------------------------- | ----- | | r | 4 | 讀取 | | w | 2 | 輸入 | | x | 1 | 執行 | ---- <style> table { width: 60%; border-collapse: collapse; line-height: 1.5; /* 行距 */ } th, td { font-size: 28px; /* 字體大小 */ } </style> | permission |count | description | | ----------- | ---------------------------------- | ----- | | r | 4 | 讀取 | | w | 2 | 輸入 | | x | 1 | 執行 | | permission |add up | | ----------- | ---------------------------------- | | r w x| 4+2+1=7 | | r w - | 4+2=6 | | r - x | 4+1=5 | |- - x|1| ---- <font size = 5 ><span class="command">chmod 666 example.txt</span></font> ![image](https://hackmd.io/_uploads/SJqhWAemye.png) --- ### COMMANDS <font size = 5 >如果不知道指令怎麼用 請參考</font> <font size = 5 ><span class="command">command --help</span></font> <font size = 5 ><span class="command">man command</span></font> --- ### Quick search table ---- <style> table { width: 80%; border-collapse: collapse; line-height: 1.5; /* 行距 */ } th, td { font-size: 28px; /* 字體大小 */ } </style> | command | usage | description | | ------- | ----- | ----------- | | chsh | chsh /bin/tcsh | 修改預設登入 shell | | passwd | passwd | 修改密碼 | | chmod | chmod 664 file | 修改檔案權限 | | ls | ls -l | 列出當前目錄下的檔案 | | cd | cd directory | 進入資料夾 | | pwd | pwd | 顯示目前的目錄位置 | | echo |echo "hello world" | 輸出文字 | | cat | cat file | 檢視檔案內容 | ---- <style> table { width: 80%; border-collapse: collapse; line-height: 1.5; /* 行距 */ } th, td { font-size: 28px; /* 字體大小 */ } </style> | command | usage | description | | ------- | --------------- | ---------------- | | head | head -n 10 file | 檢視檔案前10行 | | tail | tail -n 10 file | 檢視檔案最後10行 | | grep | grep "apple" example.txt | 擷取有關鍵字的那一行 | | cp | cp file file_copy | 複製檔案 | | mv | mv file file_moved | 移動、重新命名檔案 | | mkdir | mkdir directory | 創建資料夾 | | touch | touch file | 創建檔案 | | vim | vim file | 使用 vim 編輯檔案 | ---- <style> table { width: 80%; border-collapse: collapse; line-height: 1.5; /* 行距 */ } th, td { font-size: 28px; /* 字體大小 */ } </style> | command | usage | description | | -------- | ------------------------ | -------------------- | | chsh |chsh /bin/tcsh | 修改預設登入 shell | | ypchsh | ypchsh /bin/tcsh | 在 NIS 機器上修改預設登入 shell | | passwd | passwd | 修改密碼 | | yppasswd | yppasswd | 在 NIS 機器上修改密碼 | --- #### CHSH (YPCHSH) <font size = 5 >修改預設登入 shell</font> <font size = 5 >e.g.<span class="command">chsh /bin/tcsh</span></font> #### PASSWD (YPPASSWD) <font size = 5 >修改密碼</font> <font size = 5 >e.g.<span class="command"> passwd</span></font> #### CHMOD <font size = 5 >修改檔案權限</font> <font size = 5 >e.g. <span class="command">chmod 777 file</span></font> ---- #### LS <font size = 5 >列出目錄中的檔案與目錄列表</font> <font size = 5 >常用參數 <span class="command">-l -h -a</span></font> <font size = 5 >e.g. <span class="command">ls -alh</span></font> #### CD <font size = 5 >進入資料夾</font> <font size = 5 >e.g. <span class="command">cd Documents</span></font> #### PWD <font size = 5 >顯示目前的目錄位置</font> ---- #### ECHO <font size = 5 >輸出文字</font> <font size = 5 >e.g. <span class="command">echo "Hello World!!!"</span></font> <font size = 5 >輸入檔案用法:</font> <font size = 5 >e.g. <span class="command">echo "Hello World!!!" > file</span></font> #### CAT <font size = 5 >~~叫貓貓去看一下檔案~~</font> <font size = 5 >檢視檔案內容</font> <font size = 5 >e.g. <span class="command">cat file</span></font> ---- #### HEAD <font size = 5 >檢視檔案前x行</font> <font size = 5 >常用參數 <span class="command">-n</span></font> <font size = 5 >e.g. <span class="command">head -n 10 file</span></font> #### TAIL <font size = 5 >檢視檔案最後x行</font> <font size = 5 >常用參數 <span class="command">-n</span></font> <font size = 5 >e.g. <span class="command">tail -n 10 file</span></font> ---- #### GREP <font size = 5 ><span class="command">g/re/p</span>(globally search a regular expression and print)</font> <font size = 5 >e.g.<span class="command"> grep "apple" example.txt</span></font> <img src= "https://hackmd.io/_uploads/ByFmACg7kg.png" width=300 style="margin : 0px 0px 0px 0px"/> <font size = 5 ><span class="command">grep -i "apple" example.txt for case-insensitive</span></font> ---- #### CP <font size = 5 >複製</font> <font size = 5 >e.g.<span class="command"> cp hello hello-copy</span></font> #### MV <font size = 5 >移動、更名</font> <font size = 5 >e.g. <span class="command">mv hello ../hello</span></font> #### MKDIR <font size = 5 >創建資料夾</font> <font size = 5 >e.g.<span class="command"> mkdir my-dir</span></font> --- ## VIM <font size = 6 >文字介面編輯器</font> ---- <div style="text-align: center;"> <font size =7 style="margin : 0px 0px 0px 40px">分成三種模式</font> <br> <br> <ul> <li>normal mode</li> <li>edit mode</li> <li>visual mode</li> </ul> </div> <br> <font size = 6 >一開始是 normal mode 按 <span class="command">i</span> 進入 edit mode</font> <font size = 6 >按 <span class="command">ESC</span> 回到 normal mode</font> ---- <font size = 6 >在 normal mode 打冒號可以輸入指令</font> <style> table { width: 80%; border-collapse: collapse; line-height: 1.5; /* 行距 */ } th, td { font-size: 28px; /* 字體大小 */ } </style> | Command | Description | | ------- | ----------- | | :w | 儲存 | | :wq | 儲存並退出 | | :q! |不儲存退出 | ---- <font size = 5 >vim 是個很強大的編輯器</font> <font size = 5 >在 normal mode 可以用的指令還有連技超多</font> <font size = 5 >如果想了解的可以看看 這個[Vim](https://mropengate.blogspot.com/2015/07/vim-ch2.html)</font> <font size = 5 >推薦要學 只能用文字介面的時候非常好用</font> --- ### JOE <font size = 5 >另一個文字介面編輯器</font> <font size = 5 ><span class="command">joe filename.txt</span></font> <style> table { width: 80%; border-collapse: collapse; line-height: 1.5; /* 行距 */ } th, td { font-size: 28px; /* 字體大小 */ } </style> | operation | description | | --------- | ---------------- | | Ctrl+K,H | show help | | Ctrl+K,F | search text | | Ctrl+K,L | go to line | | Ctrl+K,S | save file | | Ctrl+K,X | save file and exit editor | | Ctrl+Y| delete a line | --- ## 作業網站 作業做完請上傳到 http://140.121.197.13/tutorial 並且注意上傳時間限制、檔名、其他規範 上課時提前做完可以直接給助教 demo 登記 就不需要上傳 demo 過的部分 ---- ## Question 1 <font size=6> Create a directory named <span class="command">www</span>. </font> ---- ## Question 2 <font size=6>Change the permission of the directory <span class="command">www</span> to <span class="command">drwxr-xr-x</span>, and explain what does this mean. </font> ---- ## Question 3 <font size=6>From the previous exercises, upload your personal web page to the www directory. Use http://linux.aclab.cool/~b0135XXXX/ to view the page. </font> ---- ## Question 4 <font size=6>Copy the file <span class="command">/proc/cpuinfo</span> to your directory, and rename the file to <span class="command">CPU</span> (case sensitive).</font> ---- ## Question 5 <font size=6>Dump (show) the content of the file CPU and isolate (using Linux commands) the CPU model.</font> <img src= "https://hackmd.io/_uploads/H1dH2kWQJg.png" width=500 style="margin : 0px 0px 0px 0px"/>

    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