文本、目录 空间清理问题

1.find

查询文件夹下依照什么命名的文件,并删除,

注意:

1)当前文件的话 可以用find .

2)-ok和{}后的空格不能少

1
2
3
4
5
6
7
8
[root@test11.bj.sm log]# find /mnt/work/engine/be-counter/counter-9802/log  -type f -name "counter-9802.*.INFO" -ok  rm {} \;
< rm ... /mnt/work/engine/be-counter/counter-9802/log/counter-9802.1.INFO > ? y
[root@test11.bj.sm log]#
[root@test11.bj.sm log]#
[root@test11.bj.sm log]# ll
总用量 152180
-rw-rw-r-- 1 work work 155670230 3月   4 20:31 counter-9802.INFO
[root@test11.bj.sm log]#

  

 

1
2
3
4
5
6
7
8
9
10
[root@test11.bj.sm log]# vim counter-9802.1.INFO
[root@test11.bj.sm log]# ll
总用量 152184
-rw-r--r-- 1 root root         6 8月  19 17:34 counter-9802.1.INFO
-rw-rw-r-- 1 work work 155670230 3月   4 20:31 counter-9802.INFO
[root@test11.bj.sm log]# find .  -type f -name "counter-9802.*.INFO" -ok  rm {} \;
< rm ... ./counter-9802.1.INFO > ? y
[root@test11.bj.sm log]# ll
总用量 152180
-rw-rw-r-- 1 work work 155670230 3月   4 20:31 counter-9802.INFO

  2.查看文件的更新时间

1
stat后是文件名
1
Modify是创建时间
1
Access是访问时间
1
2
3
4
5
6
7
8
[root@test11.bj.sm counter-9802]# stat .
  File: "."
  Size: 4096        Blocks: 8          IO Block: 4096   目录
Device: fc01h/64513d    Inode: 5439509     Links: 7
Access: (0775/drwxrwxr-x)  Uid: (  503/    work)   Gid: (  504/    work)
Access: 2018-07-13 17:23:17.000000000 +0800
Modify: 2020-12-03 19:22:53.000000000 +0800
Change: 2020-12-03 19:22:53.000000000 +0800

  3.查看目录下文件的大小

 查看对应文件的大小

1
2
3
4
5
6
7
8
[root@test11.bj.sm be-counter]# du -sh ./*
4.0K    ./bushu-9803.sh
4.0K    ./bushu.sh
361M    ./counter-9800
2.2G    ./counter-9802
510M    ./counter-9803
797M    ./counter-9805
471M    ./counter-9806

 查看目录的总大小

 

1
2
[root@test11.bj.sm be-counter]# du -sh
4.3G    .

  4.磁盘空间占用情况

1
2
3
4
[root@test11.bj.sm be-counter]# df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       296G  132G  150G  47% /
tmpfs           2.0G  624M  1.4G  31% /dev/shm

  

 

posted @   MLing  阅读(38)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
点击右上角即可分享
微信分享提示