【就业班作业】【第五周】查etc目录下大于1M且类型为普通文件的所有文...

【就业班作业】【第五周】查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 指定路径精确查
# 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⽣成命令参数
标准输出变成后⾯命令的标准输⼊的参数
| xargs ls -l  将X.txt的内容当成参数
xargs -n 1 ⼀次传递1个参数
(结束)

本文发布于:2024-09-20 15:40:52,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/788145.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:指定   参数   命令   排序   标准
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议