单选题
管理员小王发现 /var/log 分区使用率已达 95%,需找出该目录下大于 100MB 的普通文件以便清理。下列 find 命令中哪一条能正确实现该需求?
A. find /var/log -type d -size +100M
B. find /var/log -type f -mtime +100
C. find /var/log -type f -size -100M
D. find /var/log -type f -size +100M
正确答案:D
依据 find(1) 手册,-type f 匹配普通文件,-size +100M 表示大于 100MB;-type d 匹配目录,-size -100M 表示小于 100MB,-mtime +100 按修改天数而非大小筛选。
单选题
管理员小陈在RHEL 9上发现/var/log目录占用空间过大,需要查找该目录下大于100MB的普通文件。下列find命令正确的是?
A. find /var/log -type f -size +100M
B. find /var/log -type f -size 100M
C. find /var/log -type d -size +100M
D. find /var/log -type f -size -100M
正确答案:A
依据 find(1) 手册,-type f 匹配普通文件,-size +100M 表示大于 100MB;-type d 匹配目录,-size -100M 表示小于 100MB,-size 100M 表示恰好 100MB,均不符合查找大文件的需求。
单选题
运维小赵发现RHEL 9服务器磁盘使用率告警,需定位/var/log下大于100MiB的普通文件并列出大小。下列find命令中能正确实现的是哪一项?
A. find /var/log -type f -size -100M -exec ls -lh {} \;
B. find /var/log -type d -size +100M -exec ls -lh {} \;
C. find /var/log -type f -size +100k -exec ls -lh {} \;
D. find /var/log -type f -size +100M -exec ls -lh {} \;
正确答案:D
依据find(1),-type f限定普通文件,-size +100M表示大于100MiB。选项B限定目录,选项A的-100M表示小于100MiB,选项C的+100k表示大于100KiB,均不符合定位大日志文件的需求。