Shell命令¶
- 远程修改时间
sshpass -p 123 ssh root@1.2.3.4 "echo 123 | sudo -S sh -c 'date -s \"$(date "+%Y-%m-%d %H:%M:%S")\"'"
- tar打包时不带目录(-C)
tar -czvf /opt/1/2/1.tgz -C /opt/1/2 2025-07-10-09-26-22.log
- 遍历文件
find ./ -type f -name "*.txt" | sort | while read file; do echo "$file" done