運維常用命令(二)

curl POST請求

  • POST application/x-www-form-urlencoded
    curl -d "param1=value1&param2=value2" -X POST http://localhost:3000/data
    相當于明確的
    curl -d "param1=value1&param2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:3000/data
    用文件提交
    curl -d "@data.txt" -X POST http://localhost:3000/data

  • POST application/json
    curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost:3000/data

  • HEADER 設置

-H "Content-Type: application/x-www-form-urlencoded"
-H "Content-Type: application/json"
-H "Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryrGKCBY7qhFd3TrwA"
  • form-data 方式提交
    curl -v -F key1=value1 -F upload=@localfilename URL
    curl -X POST -F 'image=@/path/to/pictures/picture.jpg' http://domain.tld/upload

  • 查看curl請求時間
    curl -X GET -I http://54.223.142.179:8080/img/upload/www/2017/11/08/1510107926_9f857002d4f0.jpg -H 'Host: owan-img.ymapp.com' -w %{time_total}--%{http_connect}--%{time_connect}--%{time_pretransfer}

refer: http://blog.csdn.net/hqzxsc2006/article/details/50547684

DNS查詢

dig +trace @8.8.8.8 math.stackexchange.com 詳細查詢

  • 查詢其他類型解析
dig notifier.ouwan.com  txt 
# notifier.ouwan.com.   599 IN  TXT "v=spf1 ip4:106.75.166.110 ~all" 
dig notifier.ouwan.com  mx 
# notifier.ouwan.com.   484 IN  MX  5 106.75.166.110.

nslookup
nslookup -q=txt notifier.ouwan.com 8.8.8.8

git 查看拉下來的文件有那些具體的修改

git diff HEAD^

Screen 常用用法

  • 常用參數
    screen -S yourname -> 新建一個叫yourname的session
    screen -ls -> 列出當前所有的session
    screen -r yourname -> 回到y(tǒng)ourname這個session
    screen -d yourname -> 遠程detach某個session
    screen -d -r yourname -> 結束當前session并回到y(tǒng)ourname這個session
    screen -X -S 21417.scrapy_2 quit 刪除一個session 21417.scrapy_2 是session的名字
  • 在screen session 里面的操作 C (即control鍵)
    C-a c -> 創(chuàng)建一個新的運行shell的窗口并切換到該窗口
    C-a d -> detach,暫時離開當前session,將目前的 screen session (可能含有多個 windows) 丟到后臺執(zhí)行,并會回到還沒進 screen 時的狀態(tài),此時在 screen session 里,每個 window 內運行的 process (無論是前臺/后臺)都在繼續(xù)執(zhí)行,即使 logout 也不影響。
    C-a z -> 把當前session放到后臺執(zhí)行,用 shell 的 fg 命令則可回去。
    C-a w -> 顯示所有窗口列表
    Ctrl+a [Space] -> 由視窗0循序切換到視窗9

pip 強制更新

sudo pip install awscli --force-reinstall --upgrade

lsof

#  列出某個程序進程所打開的文件信息
lsof -c mysql  或者
lsof | grep mysql 

# 通過某個進程號顯示該進行打開的文件
lsof -p 1,2,3

# 列出誰在使用某個端口
lsof -i :3306
lsof -i tcp:80
lsof -i udp:55

# 列出所有tcp 網絡連接信息
lsof -i tcp
lsof -i udp

# 列出進程某個TCP狀態(tài)
lsof -a -i -s TCP:CLOSE_WAIT -p 11966

lsof lists all open file handlers for a process. Since everything in Linux is a file, you effectively get to see all open sockets, input/output streams, etc. that a process has open.
-p lists all the entries for a specific process ID
-i lists only network files open
-s lists the TCP or UDP state
-a requires all other parameters passed in to hold as true for a record to be displayed. Basically, it lets you filter based on the above properties.
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • Spring Cloud為開發(fā)人員提供了快速構建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 134,973評論 19 139
  • 大家好,我是IT修真院深圳分院第01期學員,一枚正直純潔善良的web程序員。今天給大家分享一下,修真院官網JAVA...
    老菜菜閱讀 27,957評論 0 3
  • cURL是一個利用URL語法規(guī)定來傳輸文件和數據的工具,支持很多協(xié)議和選項,如HTTP、FTP、TELNET等,能...
    司馬東陽閱讀 1,455評論 0 6
  • 花重錦官城。
    eda9bfbccad2閱讀 222評論 0 0
  • 我走在人頭攢動的機場 突然想起些年少時的記憶 擁抱和笑容都那么肆無忌憚 一回頭,我在這滿是生人的人生里有些落寞 很...
    藍胖子jxb閱讀 150評論 0 0