常用Linux命令
程序员文章站
2022-06-04 11:35:30
...
1. ping 加上客户端主机名和时间戳
> ping 192.168.7.42 | while read pong; do echo "$(hostname) $(date): $pong"; done
7_33 Mon Dec 9 13:18:52 CST 2019: PING 192.168.7.42 (10.1.7.42) 56(84) bytes of data.
7_33 Mon Dec 9 13:18:52 CST 2019: 64 bytes from 10.1.7.42: icmp_seq=1 ttl=64 time=0.108 ms
7_33 Mon Dec 9 13:18:53 CST 2019: 64 bytes from 10.1.7.42: icmp_seq=2 ttl=64 time=0.106 ms
7_33 Mon Dec 9 13:18:54 CST 2019: 64 bytes from 10.1.7.42: icmp_seq=3 ttl=64 time=0.111 ms
7_33 Mon Dec 9 13:18:55 CST 2019: 64 bytes from 10.1.7.42: icmp_seq=4 ttl=64 time=0.121 ms
7_33 Mon Dec 9 13:18:56 CST 2019: 64 bytes from 10.1.7.42: icmp_seq=5 ttl=64 time=0.137 ms
2. 查找文件夹下所有包含某个字符串的文件
> grep -iR port .
./redis_client1.json: "port": 6382,
./redis_client2.json: "port": 6382,
./redis_client3.json: "port": 6382,
上一篇: HashMap底层实现原理及面试常见问题
下一篇: 数组和判断的语句的使用