Linux
1.查看當前路徑下指定所有包含00099的文件的總大小,單位kb
du -sk 00099 | awk '{c+=$1}END{print c}'
2.查看指定路徑下包含00099的文件的總大小
find /data/test/day -name "00099" |xargs du -ck
3.查看指定路徑下指定類型文件的包含指定內容的總行數
find 00099.dat.l | xargs grep "2019-04-07 20" | wc -l
4.查看當前進程號的所有tcp鏈接
lsof -p 11771 -nP | grep TCP
Vim
1.vim打開文件後刪除指定長度的內容(修改裏面的10)
:%s/^.{10}//
2.批量刪除指定列
:1 切換到行首
ctrl+v 這樣會啓動可視模式,按 j/k 可以發現它能夠在一列上面選中字符
按下 G 這樣可以從文本的第一行選中到最後一行
按下 x 就會把這一列刪掉
:sort 排序
Curl
1.上傳文件
[root]# curl http://127.0.0.1:18081/file/batchUpload -X POST -F "filePath=@/data/shell/1554947856915.log" -F "filePath=@/data/shell/1554947856915.log" --header "Content-Type:multipart/form-data" -v
[root]# curl http://127.0.0.1:18081/file/batchUpload -X POST -F "filePath=@/data/shell/1554947856915.log" -F "filePath=@/data/shell/1554947856915.log" --header "Content-Type:multipart/form-data" -v
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 18081 (#0)
> POST /file/batchUpload HTTP/1.1
> Host: 127.0.0.1:18081
> User-Agent: curl/7.57.0
> Accept: */*
> Content-Length: 963
> Content-Type: multipart/form-data; boundary=------------------------d426837656228ad7
>
< HTTP/1.1 200 OK
< Server: gunicorn/19.9.0
< Date: Tue, 23 Apr 2019 07:24:28 GMT
< Connection: close
< Content-Type: text/html; charset=utf-8
< Content-Length: 178
<
* Closing connection 0
{"code": "000000", "desc": "success", "data": {"1554947856915.log": "000000", "1554947856915.log": "000000"}}
Kafka
- 查看指定topic的偏移量
bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 127.0.0.1:9092 --topic test-log --time -1