工具类
htop
取代top,界面更加用户友好。
ag
急速文件内容搜索。类似:1
find . -type f|xargs grep 'foo'
seq
test.sh执行50次1
seq 50|xargs -i ./test.sh
ab
apache bench tool,用于测试http服务器性能。1
2 测试5000次,并发200
ab -n 5000 -c 200 http://localhost/api/predict
tac
与cat行为相反,从后往前输出。
命令类
批量杀死进程
1 | ps -ef|grep your_kill_target_name |grep -v 'grep'| awk '{print \$2}'|xargs kill -9 |
删除除最新文件以外的所有文件
1 | 删除log目录下的所有旧文件 |
删除指定文件之外的其他所有文件
1 | 删除当前目录下spec.file之外其他所有文件 |
禁用GPU CUDA
1 | CUDA_VISIBLE_DEVICES="" python train.py |
git clone with submodule
1 | git clone --recursive git://github.com/foo/bar.git |
发送文件到远端系统
1 | scp foo.bar user@remote:/data/ |
组合字符串
1 | cat train.txt |xargs -i echo `pwd`/{} 0 >train.lst |