Linux 实用命令

xargs:
将一个命令输出作为另一个命令的参数,如
结合find和xargs,对文件进行分类、打包、或者查找其中字符串

查找文件中的一个字串: find -type f |xargs grep "CreateAA"
Create filellist: Find . -type f -name "*.cfg" -o -name "*.cpp" | grep -v 3690 > 2.txt
找以.conf结尾的文件并分类: find -name *.mak -type f -print | xargs file
找以.conf结尾文件并打包:find -name *.mak -type f -print | xargs tar cjf tst.tar.gz

&:
命令或者脚本后台运行

查找系统内存和CPU 使用较高进程
CPU: ps -aux | sort -rnk 3 | head -20
MEM: ps -aux | sort -rnk 4 | head -20

查看tcp链接状态:
netstat -nat | awk '{print $6}' | sort | uniq -c | sort -rn

持续将ping将结果写入日志
ping www.baidu.com | awk '{print $0 " " strftime("Y%-%m-%d %H:%M:%S",systime()) }' >> /tmp/test.log&

sed/awk  命令参考:

https://thief.one/2017/08/12/1/

https://blog.csdn.net/qq_25663723/article/details/53161646

原文地址:https://www.cnblogs.com/7star/p/12581516.html