<p id="gwjr0"></p>

    1. 注冊 | 登錄 |
      易站導航

      shell常用下令-linux運維

      時間:2021-07-15人氣:-


      shell常用下令:Ctrl+z、fg、opensslrand-hexn、sourcehomeuserfile.name、${variable:0:5}、ssh-vvvuser@ip_address等等。

      所實用戶列表:

      getent passwd

      Mount root in read/write mode:

      mount -o remount,rw /

      掛載一個名目(這是不克不及運用鏈接的狀況):

      mount --bind /source /destination

      動態更新DNS server:

      nsupdate < 

      遞歸grep所有名目:

      grep -r "some_text" /path/to/dir

      列出前10個最大的文件:

      lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB "$9 }' | sort -n -u | tail

      顯示剩余內存(MB):

      free -m | grep cache | awk '/[0-9]/{ print $4" MB" }'

      打開Vim并跳到文件末:

      vim + some_file_name

      Git 克隆指定分支(master):

      git clone git@github.com:name/app.git -b master

      Git 切換到其它分支(develop):

      git checkout develop

      Git 刪除分支(myfeature):

      git branch -d myfeature

      Git 刪除長途分支

      git push origin :branchName

      Git 將新分支推送到長途辦事器:

      git push -u origin mynewfeature

      打印歷史記載中最后一次cat下令:

      !cat:p

      運轉歷史記載里最后一次cat下令:

      !cat

      尋出/home/user下所有空子名目:

      find /home/user -maxdepth 1 -type d -empty

      獵取test.txt文件中第50-60行內容:

      < test.txt sed -n '50,60p'

      運轉最后一個下令(要是最后一個下令是mkdir /root/test, 下面將會運轉: sudo mkdir /root/test):

      sudo !!

      新建暫時RAM文件系統 – ramdisk (先新建/tmpram名目):

      mount -t tmpfs tmpfs /tmpram -o size=512m

      Grep whole words:

      grep -w "name" test.txt

      在需要提拔權限的狀況下往一個文件里追加文本:

      echo "some text" | sudo tee -a /path/file

      列出所有kill signal參數:

      kill -l

      在bash歷史記載里制止記載最后一次會話:

      kill -9 $$

      掃描網絡尋覓開放的端口:

      nmap -p 8081 172.20.0.0/16

      設定git email:

      git config --global user.email "me@example.com"

      To sync with master if you have unpublished commits:

      git pull --rebase origin master

      將所有文件名中含有”txt”的文件移入/home/user名目:

      find -iname "*txt*" -exec mv -v {} /home/user ;

      將文件按行并列顯示:

      paste test.txt test1.txt

      shell里的進度條:

      pv data.log

      運用netcat將數據發送到Graphite server:

      echo "hosts.sampleHost 10 `date +%s`" | nc 192.168.200.2 3000

      將tabs轉換成空格:

      expand test.txt > test1.txt

      Skip bash history:

      < space >cmd

      去以前的工作名目:

      cd -

      拆分大體積的tar.gz文件(每個100MB),然后合并回去:

      split –b 100m /path/to/large/archive /path/to/output/files cat files* > archive

      運用curl獵取HTTP status code:

      curl -sL -w "%{http_code}\n" www.example.com -o /dev/null

      設定root密碼,強化MySQL平安安裝:

      /usr/bin/mysql_secure_installation

      當Ctrl + c欠好使時:

      Ctrl + 

      獵取文件owner:

      stat -c %U file.txt

      block設施列表:

      lsblk -f

      尋出文件名結尾有空格的文件:

      find . -type f -exec egrep -l " +$" {} ;

      尋出文件名有tab縮進符的文件

      find . -type f -exec egrep -l $'t' {} ;

      用”=”打印出橫線:全選復制放進條記

      printf '%100sn' | tr ' ' =

      以上就是shell常用下令的細致內容,更多請關注 站長在線 其它相干文章!


      上篇:Linux下的抓包tcpdump-linux運維

      下篇:了解LinuxCPU負載和CPU運用率-linux運維