劉杰
    • 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
    • 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 Note Insights 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

    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
    # Command Line Windows 環境架設 以及 常用指令介紹 ----- ###### tags: `Command line` ------ 在搜尋打命令提示字元,以及它呈現的樣子 ![](https://i.imgur.com/IcCNFKp.png) Windows 跟 Mac 以及 Linus的指令是不同的,因此可以使用Cmder就可以使用一樣的指令摟! ![](https://i.imgur.com/ljJOUt7.png) 記得先下載好用的Cmder https://blog.miniasp.com/post/2015/09/27/Useful-tool-Cmder ![](https://i.imgur.com/MZNFRpg.png) 下載node.js ![](https://i.imgur.com/MhBHNBa.png) # CLI 簡介 以及 常用指令介紹 什麼是 Command Line > 命令列介面(英語:Command-Line Interface,縮寫:CLI)是在圖形使用者介面得到普及之前使用最為廣泛的使用者介面,它通常不支援滑鼠,用戶通過鍵盤輸入指令,電腦接收到指令後,予以執行。也有人稱之為文字使用者介面(character user interface, CUI)。 ## 好用學習的資源推薦: http://linuxcommand.org/lc3_learning_the_shell.php ## 1. CLI 的常用基本指令 <table><tbody><tr><td><strong>指令 (Mac OS / Linux)</strong></td><td><strong>用途</strong></td><td><strong>例子</strong></td></tr><tr><td>pwd <br>(print working directory)</td><td>印出目前路徑位置</td><td>pwd</td></tr><tr><td>ls <br>(List Segment)</td><td>列出檔案清單</td><td>ls<br>ls -a<br><em>(列出隱藏的檔案)</em><br>ls -l<br><em>(列出檔案相關資訊)</em><br>ls -al<br><em>(列出隱藏+資訊)</em></td></tr><tr><td>cd <br>(change directory)</td><td>切換資料夾</td><td>cd Desktop<br><em>(到桌面資料夾)</em><br>cd ~<br><em>(回到使用者層)</em><br>cd /<br><em>(回到根目錄)</em></td></tr><tr><td>man <br>(manual)</td><td>指令使用說明書</td><td>man la</td></tr><tr><td>clear</td><td>清空畫面</td><td>clear</td></tr></tbody></table> ## 2. CLI 的常用檔案相關指令 <table><tbody><tr><td><strong>指令 (Mac OS / Linux)</strong></td><td><strong>用途</strong></td><td><strong>例子</strong></td></tr><tr><td>touch</td><td>建立檔案 / 更改時間</td><td>touch test.txt</td></tr><tr><td>rm<br>(remove)</td><td>刪除檔案</td><td>rm test.txt<br>rm -f test.txt<br><em>(強制刪除 test.txt)</em><br>rm -r TEST<br><em>(刪除 TEST 資料夾&amp;裡面檔案)</em></td></tr><tr><td>mkdir<br>(make directory)</td><td>建立資料夾</td><td>mkdir TEST<br>rmdir TEST<br><em>(刪除 TEST 資料夾)</em></td></tr><tr><td>mv<br>(move)</td><td>移動檔案或改名</td><td>mv test.txt TEXT<br><em>(檔案 text.txt 移至 TEXT)</em><br>mv test.txt test2.txt<br><em>(檔案 text.txt 改名 test2.txt)</em></td></tr><tr><td>cp<br>(copy)</td><td>複製檔案</td><td>cp test.txt test2.txt<br><em>(檔案 text.txt 複製一份命名 text2.txt)</em><br>cp -r TEXT TEXT2<br><em>(複製資料夾 TEXT 和裡面所有檔案)</em></td></tr><tr><td>vim</td><td>文字編輯器</td><td>vim text.txt<br><em>按 i 可以打字<br>按 esc 進入普通模式 <br>:q 離開<br>:wq 存檔離開</em></td></tr><tr><td>open</td><td>打開</td><td>open test.txt<br>open .. <br><em>(打開資料夾)</em></td></tr></tbody></table> ## 3. CLI 的常用其他指令 <table><tbody><tr><td><strong>指令</strong></td><td><strong>用途</strong></td><td><strong>例子</strong></td></tr><tr><td>cat</td><td>列印出檔案內容</td><td>cat test.txt</td></tr><tr><td>less</td><td>分頁印出檔案</td><td>less test.tst</td></tr><tr><td>echo</td><td>列出出打的東西</td><td>echo 123</td></tr><tr><td>grep</td><td>抓取關鍵字 (ex: A)</td><td>grep A test.txt</td></tr><tr><td>wget</td><td>下載檔案(有可能需安裝</td><td>wget url</td></tr><tr><td>curl</td><td>送出 repuest</td><td>curl api url<br><em>(秀出 response)</em><br>curl -I url <br><em>(秀出 header 資訊)</em></td></tr><tr><td>&gt;<br>(redirection)</td><td>重新導向 input output</td><td>echo 123 &gt; test.txt</td></tr><tr><td>&gt;&gt;<br>(append)</td><td>可以新增內容進檔案</td><td>echo 123 &gt;&gt; test.txt</td></tr><tr><td>|<br>(pipe)</td><td>左邊指令的輸出變成右邊指令的輸入</td><td>cat test.txt | grep A</td></tr><tr><td>date</td><td>輸出日期</td><td>date</td></tr><tr><td>top<br>(tab of process)</td><td>查詢系統目前的工作狀態</td><td>top</td></tr></tbody></table> ### 4.CLI 應用實例 假設你想要完全不透過圖形介面,建立一個叫做 wifi 的資料夾,並且在裡面建立一個叫 afu.js 的檔案,該怎麼做? step1 – 跳到桌面:cd Desktop step2 – 建立資料夾 wifi: mkdir wifi step3 – 跳到資料夾 wifi:cd wifi step4 – 建立檔案 afu.js:touch afu.ja step5 – 查看所有位置所有檔案:ls ![](https://i.imgur.com/d8SVijV.png)

    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