crontab-e
编辑定时任务
*/1 * * * * bash /root/test/test.sh 每分钟执行一次test.sh 脚本
在test.sh 中 我们可以如下编辑:
echo ‘hello’>>1.txt 输出hello到1.txt文件
crontab-l 展示当前的定时任务
crontab-r 删除定时任务
find ./ -name ‘*erty’ -d 查找文件夹
find ./ -name ‘*erty’ -f 查找文件
find ./ -name ‘*erty’ -f -mtime -1 查找一天之内的文件
find ./ -name ‘*erty’ -f -ntime +30 查找30天之前的
find ./ -name ‘*erty’ -f -size -8k 查找小于8k的文件
find ./ -name ‘4.txt’ -exec rm -rf {} ; 把查出的结果作为输入传给rm -rf
grep ‘echo’ -n --color test.sh -n 显示行号 --color 彩色显示
grep ‘echo’ -n --color test.sh
awk ‘{print $1}’ test.sh 输出空格分隔后的第一列
crontab定时任务
最新推荐文章于 2023-06-08 23:36:07 发布