【就业班作业】【第五周】查etc⽬录下⼤于1M且类型为普通
⽂件的所有⽂件
第⼀步先查/etc⽬录所有普通⽂件,并排序以便后⾯验证; find /etc -type f | xargs du | sort -n
第⼆步查/etc⽬录下⼤于1M且类型为普通⽂件的所有⽂件
find /etc -type f -size +1M
第三步验证结果
find /etc -type f -size +1M | xargs du -h
效果图:
# find /Path -name "FileName"
# find /Path -iname "FileName"
# find /Path -user root -ls
# find /Path -uid 0 -ls
# find /Path -gid 0 -ls
# find /Path -nouser -ls
# find /Path -nogroup -ls
# find /Path -type f/d/l/s/b/c
# find /Path \(-nouser -o -nogroup\) -ls 或
# find /Path -nouser -a -nogroup 与
# find /Path -not -user -a -not -name "xxx" ⾮
# find /Path -size #k/M/G
# find /Path -atime +-# [#,+-#] //天为单位
# find /Path -mtime
# find /Path -ctime
# find /Path -perm /755 ugo模糊匹配
# find /Path -perm -755 ugo精确匹配
# find /Path -print
# find /Path -ls
# find /Path -delete
# find /Path -fls /Directory 查⽂件并保存到指定⽂件夹
# find /Path -ok COMMAD 交互式执⾏
# find /Path -exec COMMAND {} \; ⽆提⽰执⾏{} \;(固定格式)
# find /Path | xargs COMMAND
排序sort
# sort -f 忽略⼤⼩写
# sort -r 逆序
# sort -k Num 指定第Num个字段排序
# sort -u 排序后去重
# sort - t 设定间隔符
# sort -n 以数值来排序
# sort -t: -k3 -n FILE 类⽐ cut -d: -f3
| xargs ls -l 将X.txt的内容当成参数
xargs -n 1 ⼀次传递1个参数
(结束)