- Các tùy chọn hay dùng:
-name
: Tìm kiếm theo tên file/folder-type
: Theo kiểu,f
: Folder;d
: Directory-mtime N
: Thời gian tạo/chỉnh sửa.N
: là số ngày-exec
: Thực thi gì đó với các file tìm được-perm
: Tìm theo quyền truy cập (RWX)-user
: Tìm file thuộc sở hữu của user nào đó-group
: Tìm file sở hữu của group nào đó- Tham khảo thêm:
man find
find /var/lib/docker/containers/ -size +1G -iname '*json.log*' -type f -exec truncate -s 0 {} \;
find . -type f -size +100M -exec ls -sh {} \;
Chú ý: Nếu muốn tìm dung lượng nhỏ hơn -100M
find ./folder -print | grep -e '<tên-file>'
find ./folder -executable
find / -atime -1
find / -type f -size +100M -atime -1 -exec du -sh {} \;
find /data/logs/ -type f -mtime +15 -exec rm -rf {} \;
find /data/logs/ -type f -mtime -15 -exec ls -l {} \;
find . -type f | wc -l
find . -type d | wc -l
find . -print| wc -l
find /tmp -type f ! -perm 644 -exec chmod 644 {} \;