zoukankan      html  css  js  c++  java
  • 文本、目录 空间清理问题

    1.find

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

    注意:

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

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

    [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]# 
    

      

    [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.查看文件的更新时间

    stat后是文件名
    Modify是创建时间
    Access是访问时间
    [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.查看目录下文件的大小

     查看对应文件的大小

    [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
    

     查看目录的总大小

     

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

      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
    

      

  • 相关阅读:
    机器学习面试问题7
    机器学习面试问题6
    机器学习面试问题5
    机器学习面试问题4
    机器学习面试问题3
    机器学习面试问题2
    机器学习面试问题1
    推荐算法
    机器学习面试问题8
    决策树与随机森林算法
  • 原文地址:https://www.cnblogs.com/MLing/p/15163278.html
Copyright © 2011-2022 走看看