常用的一些 Linux 上的 Shell 命令汇总:
通过 ngrep 捕获 http 请求
捕获本机的 Http
请求
1
2
3
yum install ngrep
ngrep -q -d eth1 -W byline 'POST /login.jsp' host jira.livenaked.com
ngrep -q -d eth1 -W byline 'POST /nakedhub/api/auth/checkVersion' host app.nakedhub.cn
清除 history 历史
1
history -cw
格式化 curl 输出
1
2
3
4
5
6
curl -o /dev/null -s -w \
"%{time_namelookup} \
%{time_connect} \
%{time_starttransfer} \
%{time_total}\n" \
http://app.nakedhub.cn/nakedhub//api/user/open/calculationUserIdentity?mobile=18618391779
- time_namelookup - DNS解析时间
- time_connect - 客户端与服务端TCP建立连接时间
- time_starttransfer - 响应的第一个字节的时间
- time_total - 总共消耗的时间
注意:单位都是按秒计算,精确到小数点后三位,并且后项的时间基本包括前项的时间.
参考链接
http://neoyin.github.io/curl-request-response-time.html http://www.cnblogs.com/ruiy/p/curl.html
Centos 时区
查看当前时间与时区情况
1
timedatectl
查看全部时区
1
timedatectl list-timezones
时区设置
1
timedatectl set-timezone Asia/Shanghai
注意:不考虑发行版的话,
Linux
通用的修改时区的做法一般是:cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
远程同步设置
1
2
3
4
yum install -y ntp
systemctl enable ntpd
systemctl start ntpd
timedatectl set-ntp true
参考资料
鸟哥Linux私房菜NTP
服务
http://cn.linux.vbird.org/linux_server/0440ntp.php#client