Andy Lee
    • 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
    # 常用Linux Shell指令 ## stat [filename]             显示指定文件的详细信息,比ls更详细 ## top 动态显示当前耗费资源最多进程信息 ## ps                显示瞬间进程状态 ps -aux ## du       查看目录大小 du -h /home带有单位显示目录信息 ## df 查看磁盘大小 df -h 带有单位显示磁盘信息 ## man 命令不会用了,找男人  如:man ls ## shutdown * -r             关机重启 *      -h             关机不重启 *      now          立刻关机 ## halt   关机 ## reboot 重启 ## | 将一个命令的**标准输出**作为另一个命令的**标准输入**。也就是把几个命令组合起来使用,后一个命令除以前一个命令的结果。 * grep -r "close" /home/* | more  在home目录下所有文件中查找,包括close的文件,并分页输出。 ## tar * tar -zcvf /home/abc.tar.gz /home/abc     打包,并用gzip压缩 * tar -zxvf /home/abc.tar.gz 用gzip解壓縮 ## chown * sudo chown \[-R\] owner\[:group\] {File|Directory} * sudo chown root:root jdk-7u21-linux-i586.tar.gz : 以jdk-7u21-linux-i586.tar.gz为例。切換用户root,组root ## iptables -L 查看防火墙设置 ## route -n 查看路由表 ## netstat * netstat -lntp 查看所有监听端口 * netstat -antp 查看所有已经建立的连接 * netstat -s 查看网络统计信息进程 ## crontab -l 查看当前用户的计划任务服务 ## chkconfig –list 列出所有系统服务 ## 文件基本權限 | R| W | X | | -------- | -------- | -------- | | 讀 | 寫 | 可執行 | | 4|2 |1| jdk-7u21-linux-i586.tar.gz文件的权限为-rw-rw-r-- #### -rw-rw-r--一共十个字符,分成四段。 * 第一个字符“-”表示普通文件;这个位置还可能会出现“l”链接;“d”表示目录 * 第二三四个字符“rw-”表示**当前所属用户**的权限。所以用数值表示为4+2=6 * 第五六七个字符“rw-”表示**当前所属组**的权限。所以用数值表示为4+2=6 * 第八九十个字符“r--”表示**其他用户**权限。所以用数值表示为2 所以操作此文件的权限用数值表示为662 例如:有一个文件filename,权限为“-rw-r----x” ,将权限值改为"-rwxrw-r-x",用数值表示为765 * sudo chmod u+x g+w o+r  filename 上面的例子可以用数值表示 * sudo chmod 765 filename ## Redirect stderr to stdout (`&1`), and then redirect stdout to a file: ``` command >out 2>&1 e.g. ls /usr/share/doc >out.txt 2>&1 ``` ## #!/bin/bash的作用 ? #!/bin/bash是shell指令碼的第一行,稱為釋伴(shebang)行。 這裏#符號叫做hash,而! 叫做 bang。它的意思是命令通過 /bin/bash 來執行。 ## 如何讓 shell 就指令碼得到來自終端的輸入? read命令可以讀取來自終端(使用鍵盤)的資料。read命令得到使用者的輸入並置於你給出的變數中。例子如下: ``` # vi /tmp/test.sh  #!/bin/bash  echo ‘Please enter your name’  read name echo 「My Name is $name」  # ./test.sh Please enter your name  LinuxTechi  My Name is LinuxTechi  ``` ## 如何執行算術運算 ? 兩種方法來執行算術運算: 1. 使用expr命令(# expr 5 + 2) 2. 用一個\$[表示式] 例如: test=\$\[16 + 4\] ## 在shell指令碼如何定義函式呢 ? 式是擁有名字的程式碼塊。當我們定義程式碼塊,我們就可以在我們的指令碼呼叫函式名字,該塊就會被執行。 ``` $ diskusage () { df -h ; }  ``` Reference: https://www.cnblogs.com/ccy1106/p/6637661.html https://itw01.com/VW7XEFX.html

    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