- 服务器间较快速传输文件
1
2gzip -c -l ~/Downloads/select.txt| ssh root@192.168.1.2 "gunzip -c > /home/test/test.txt"
- 批量删除两个目录中同名的文件
1
for file in \<directory A>/*;do rm <directory B>/\`basename $file`; done
- 更新既有的软链
1
ln -sfn file/b_directory test
- 获取指定网站所有的链接地址
1
lynx -dump http://www.neofaster.cc |grep http|awk '{print $2}'.
- 筛选匹配的内容
1
awk '{match($0,/device\-id=([0-9|a-z|A-Z]\-?)+/,a); print a[0]}' xxxx.log | sort | uniq
- 使用nologin账号执行命令
1
2
3
4#root账户
su -s /bin/bash -c "whoami" www
#非root账户,具有sudo权限
sudo -u www whoami - 快速比对两个目录中不同的文件
1
2find directory1 -printf "%P\n" | sort > file1
find directory2 -printf "%P\n" | sort | diff file1 -
原文作者:Neo Anderson
原文链接:https://www.neofaster.cc/archives/fe92a3e0.html
发表日期:April 26th 2017, 6:12:17 pm
更新日期:August 27th 2021, 7:08:05 pm
版权声明:本文采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可