SHELL tips

时间:Feb. 17, 2020 分类:

目录:

vi中文乱码

:set encoding=utf-8

curl显示时间

$ curl -o /dev/null -s -w time_namelookup:"\t"%{time_namelookup}"\n"time_connect:"\t\t"%{time_connect}"\n"time_appconnect:"\t"%{time_appconnect}"\n"time_pretransfer:"\t"%{time_pretransfer}"\n"time_starttransfer:"\t"%{time_starttransfer}"\n"time_total:"\t\t"%{time_total}"\n"time_redirect:"\t\t"%{time_redirect}"\n" https://www.baidu.com
time_namelookup:    0.004
time_connect:        0.010
time_appconnect:    0.068
time_pretransfer:    0.068
time_starttransfer:    0.075
time_total:        0.075
time_redirect:        0.000

简单http服务

python -m SimpleHTTPServer 6789 
python3 -m http.server 6789

split

压缩包分片

[root@whysdomain ~]# ls -alh test.tar.gz
-rw-r--r-- 1 root root 7.5G May 18 10:24 test.tar.gz
[root@whysdomain ~]# split -b 700M test.tar.gz test.tar.gz. --verbose
creating file ‘test.tar.gz.aa’
creating file ‘test.tar.gz.ab’
creating file ‘test.tar.gz.ac’
creating file ‘test.tar.gz.ad’
creating file ‘test.tar.gz.ae’
creating file ‘test.tar.gz.af’
creating file ‘test.tar.gz.ag’
creating file ‘test.tar.gz.ah’
creating file ‘test.tar.gz.ai’
creating file ‘test.tar.gz.aj’
creating file ‘test.tar.gz.ak’

压缩包合并

[root@whysdomain ~]# cat test.tar.gz.a* |tar -zxv 
test/
test/test1.tar
test/test2.tar
test/test3.tar
test/test4.tar
test/test5.tar
[root@whysdomain ~]# ls -alh test/
total 18G
drwxr-xr-x 2 root root  284 May 18 10:05 .
drwxr-xr-x 4 root root 4.0K May 18 17:49 ..
-rw------- 1 root root 6.1G May 18 09:59 test1.tar
-rw------- 1 root root 2.3G May 18 10:00 test2.tar
-rw------- 1 root root 516M May 18 10:05 test3.tar
-rw------- 1 root root 2.3G May 18 10:02 test4.tar
-rw------- 1 root root 6.1G May 18 10:04 test5.tar