curl POST請求
POST application/x-www-form-urlencoded
curl -d "param1=value1¶m2=value2" -X POST http://localhost:3000/data
相當于明確的
curl -d "param1=value1¶m2=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 -> 回到yourname這個session
screen -d yourname -> 遠程detach某個session
screen -d -r yourname -> 結束當前session并回到yourname這個session
screen -X -S 21417.scrapy_2 quit 刪除一個session 21417.scrapy_2 是session的名字 - 在screen session 里面的操作 C (即control鍵)
C-a c -> 創建一個新的運行shell的窗口并切換到該窗口
C-a d -> detach,暫時離開當前session,將目前的 screen session (可能含有多個 windows) 丟到后臺執行,并會回到還沒進 screen 時的狀態,此時在 screen session 里,每個 window 內運行的 process (無論是前臺/后臺)都在繼續執行,即使 logout 也不影響。
C-a z -> 把當前session放到后臺執行,用 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狀態
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.