Ubuntu 常用操作命令
Find 查找文件
根据修改时间查找
# 查找修改日期为12小时内的文件夹和文件 (包含文件夹和文件)
find ./img_file/ -mtime -0.5
# 查找修改日期为12小时内的文件 (只包含文件)
find ./img_file/ -mtime -0.5 -type f
# 查找修改日期为12小时内的文件 并复制到其他目录
find ./img_file/ -mtime -0.5 -type f -exec cp {} /tmp/img_file/ \;
# 其他常用查询条件.
-mtime -1 查询 24 小时内有修改的文件.
-mtime -0.5 查询 12 小时内有修改的文件.
-mtime +90 查询 三个月内 有修改的文件.
统计目录下文件数
统计目录下文件数 (不包含子目录)
ls -l|grep "^-"| wc -l
统计目录下文件数 (包含子目录)
ls -lR|grep "^-"| wc -l
后台运行 Python 脚本
nohup python -u start_detection_server.py > logs.out 2>&1 &