【笔试】诺西 linux shell

本文介绍了如何查找并移动/tmp目录下超过7天未修改的日志文件至/tmp/bak目录的方法,同时给出了捕获特定主机UDP流量的tcpdump命令实例,并展示了如何在shell中进行文本替换及一些重要的shell变量说明。

【fie operation】Find all .log files which haven't been modified for more than 7 days under /tmp directory and move them to tmp/bak directory, please give the command.

mv `find /tmp -name “*.log” -mtime +7` /tmp/bak


【network】how to capture UDP traffics send/recieved by 10.1.1.1 on port 161, please give the command

tcpdump -i eth0 src host 10.1.1.1 dst host 10.1.1.1 and port 161 and udp

tcpdump -i eth0 -nnA 'port 161 and src host 10.1.1.1 and udp'

which one is right?


【shell】replace all 'abc' as 'xyz' in file a.txt

sed -e `\abc\xyz\g` a.txt


【shell】

$$: shell本身的PID

$! : shell最后运行的后台process的PID

$? :上一条命令的返回值

$# :添加到shell的参数的个数

$-: 使用sed命令设定的flag一览

$*

$@

$0: shell本身的文件名

$1 ~ $n:添加到shell的各个参数值


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值