mimmm
    • 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
    # 資工二 111010525 林品翔 Linux筆記 # 參考自 chatgpt、CentOS 7.3建置管理與伺服器架設實戰 ## putty ![](https://hackmd.io/_uploads/HJ3C6neDh.png) ## clear ``` clear //清空畫面文字 ``` ## pwd ``` pwd //print work direting ``` ## cd ``` cd 目錄 //切換目錄 ``` ## cd ~ ``` cd ~ // ~ -> 家目錄 ``` ![](https://hackmd.io/_uploads/HkyCdjlvh.png) ## su ``` su // 變成管理者 提示符號從 $(使用者) 變成 #(管理者) (需輸入密碼) ``` ![](https://hackmd.io/_uploads/SkcRdiew3.png) ## sudo ``` sudo //變成臨時管理者 ``` ``` sudo yum install 檔案 // 下載檔案(需要管理者權限,若已su則不用sudo) ``` ![](https://hackmd.io/_uploads/rk1PYslvn.png) ## 防火牆 ``` gedit /etc/selinux/config getenforce systemctl ststus firewalld ``` ![](https://hackmd.io/_uploads/rJxMasxw3.png) ## ping 8.8.8.8與暫停繼續停止快捷鍵 ``` ping 8.8.8.8 暫停 ctrl+z 繼續 fg 停止 ctrl+c ``` ## ls -l ``` ls -l //顯示檔案的詳細資訊 ``` ## mv ``` mv aa bb // 將aa檔案改名為bb ``` ![](https://hackmd.io/_uploads/ByxmTjgDh.png) centos7 檔案系統 -> XFS ## inode inode 檔案資訊記錄檔 -> 記載檔名、更動時間、權限、儲存位置 inode都有唯一的編號 ``` ls -i // 列出inode編號 ``` ## touch ``` touch a.txt // 建立a.txt ``` ## stat ``` stat a.txt //查詢a.txt進階內容 ``` ![](https://hackmd.io/_uploads/ryVNaoev2.png) ![](https://hackmd.io/_uploads/r1qI6ixDh.png) ![](https://hackmd.io/_uploads/ryrv6sgv3.png) change time:除了內容改變會變動外,屬性變動也會變更時間 [更多內容](https://blog.51cto.com/u_13662393/2094920) ## 調整時區 ``` timedatectl set-timezone Asia/Taipei ntpdate tock.sttime.gov.tw //調整時區 ``` ## 符號連結與硬連結差距 ![](https://hackmd.io/_uploads/SyZq6ogv3.png) ## du ``` du -h // 最後一項是指總大小 ``` ![](https://hackmd.io/_uploads/SkT9TieP2.png) ``` du -h -s /etc // 查詢資料夾大小 ``` ![](https://hackmd.io/_uploads/HyfiajeDn.png) ## echo ``` echo hi > hi.txt //將hi寫入到hi.txt ``` ![](https://hackmd.io/_uploads/Bkxnaiewh.png) 0 stdin 標準輸入(鍵盤輸入) 1 stdout 標準輸出(螢幕輸出) 2 stderr 標準錯誤輸出 ![](https://hackmd.io/_uploads/HJxZHolPh.png) ## 管線 不是所有指令都能用 | (要可以讀取標準輸入才能放右邊 不然就是要經過特殊處理ex: rm) ## find ``` find -name "*.aaa" //搜尋檔案 ``` 更多find的用法 https://blog.gtwang.org/linux/unix-linux-find-command-examples/ ## echo > 與 >>差距 ``` echo "hello" | cat cat < testfifo // 先 echo "hello" > testfifo // 後 ``` ``` echo hello > a.txt //將a.txt內容替換為hello echo 00000 >> a.txt //將00000加入到a.txt > a.txt // clear a.txt ``` ![](https://hackmd.io/_uploads/SJ1c_igwn.png) ## mkdir ``` mkdir {a..d} // 建立名為a、b、c、d的資料夾 find . -type d -empty -exec rm -rf {} \; //刪除剛剛建立的資料夾 ``` ![](https://hackmd.io/_uploads/B1F9kneDn.png) ## 通配符與正則表達式 通配符 針對標題搜尋 正則表達式 針對內容 (https://bpdocs.blueprism.com/bp-7-1/zh-hans/helpWildcardsAndRegex.htm) ![](https://hackmd.io/_uploads/BywLehePn.png) ## vim ``` vim a.txt //編輯檔案 ``` ## grep grep 用法(https://blog.gtwang.org/linux/linux-grep-command-tutorial-examples/) ## grep實作 ![](https://hackmd.io/_uploads/r1vIG3gP2.png) ![](https://hackmd.io/_uploads/HJYoMhew2.png) ![](https://hackmd.io/_uploads/rJbXQ3ePh.png) ![](https://hackmd.io/_uploads/S1y_7hxwn.png) ![](https://hackmd.io/_uploads/Hk2aQ2lP2.png) ![](https://hackmd.io/_uploads/rkC4NneP2.png) ## 目錄的權限 r: 可以用ls列出該目錄內容 w: 可以寫入、建立、刪除、改變檔案與目錄名稱 x: 可以用cd進入該目錄 ## mkdir -p ``` mkdir -p 目錄名稱 //加上-p,如果資料夾不存在,則創建資料夾,如果資料夾存在,則不動作,也不會有錯誤發生 ``` ## ls -ld ``` ls -ld test ls -d test //有d看資料夾內容 沒有d看屬性 ``` ## chown 更改使用者 ``` chown 使用者帳號 檔案或目錄 chown 使用者帳號.群組 檔案或目錄 chown 使用者帳號:群組 檔案或目錄 ``` ## 前背景切換 sleep在前景執行 ctrl + z停止 bg切換到背景 jobs查看 fg 切換到前景 ![](https://hackmd.io/_uploads/rkZAY3xv3.png) ## 打包並壓縮檔案 ``` tar -czvf myfiles.tar.gz file* ``` ## 備份系統目錄 系統設定檔目錄/etc 使用者家目錄/home 使用者電子郵件資料/var/spool/ ## 產生時間的檔案 ``` touch `date %Y%m%d` ``` ![](https://hackmd.io/_uploads/SJxResnlvh.png) ## 新增使用者帳號與群組 ``` groupadd test //建立test群組 useradd -g rd -G test//-g 只要 -G 次要 ``` ![](https://hackmd.io/_uploads/ryXV3hgP2.png) id加 使用者名稱也可以查詢有無此使用者 ![](https://hackmd.io/_uploads/ryljPnheDh.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