0%

Linux Shell Cheatsheet

Shell

Logic

for

1
2
3
4
5
6
7
8
9
10
11
for file in ./*
do
if test -f $file
then
echo $file is file
fi
if test -d $file
then
echo $file is dictionary
fi
done

Network

DNS

DNS刷新缓存

1
2
3
service nscd restart
service dnsmasq restart
rndc restart

查看某个record 何时才能失效,假设你的默认dns server 不是authoritative server

1
dig +nocmd +noall +answer www.google.com

查看某个record 从authoritative server 请求一个record 时被设置的ttl

1
dig @ns1.google.com +nocmd www.google.com +noall +answer

Proxy

/etc/profile

1
2
export http_proxy=xxx
export https_proxy=xxx

tc

See linux 下使用 tc 模拟网络延迟和丢包

1
2
3
4
5
# 将 eth0 网卡的传输设置为延迟 100 毫秒发送
tc qdisc add dev eth0 root netem delay 100ms
# 删除上面配置
tc qdisc del dev eth0 root netem delay 100ms

Common

Date & Time

1
2
3
# date +%Y%m%d
20190613