Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Unix / Linux commonly used to clean up disk space command     - Android application simulates the phone keypad (Programming)

- Python system default encoding (Programming)

- CentOS 6.6 install rsync server (Server)

- MySQL separation Amoeba achieve literacy (Database)

- Linux file compression and archiving (Linux)

- How to install CentOS 7.x in OpenERP (Odoo) (Linux)

- A list of the basics of Python, Ganso, Dictionary (Programming)

- Video editing captions under Linux (Linux)

- ActiveMQ5.10.2 version configuration JMX (Linux)

- Linux more efficient than select a model epoll (Linux)

- Use LKM change the default linux security level (Linux)

- Redis Linux system installation guide (Database)

- Thinking in Java study notes - initialization and cleanup (Programming)

- Oracle table Access Control (Database)

- Execute command sentence can result in equipment permanently bricked in Linux laptop (Linux)

- Upgrading KDE Plasma 5.3 in Ubuntu 15.04 (Linux)

- To configure Samba to share files with Windows under CentOS (Linux)

- Oracle 11g maintenance partitions (eight) - Renaming Partitions (Database)

- Linux LVM - File system extension (Linux)

- Spring-depth understanding of the various annotations (Programming)

 
         
  Unix / Linux commonly used to clean up disk space command
     
  Add Date : 2018-11-21      
         
         
         
  It is recommended several Unix / Linux commonly used method for cleaning up disk space:

The first method:

find ./ -name "* .log *" -exec echo ">" {} \; | sh

The meaning of this command is to search the current directory to ".log" the end of the file and empty it, this is suitable for long-term presence of the log and delete inconvenient time of use. Use ">" flush operation performed when

Back to add "| sh".

The second method:

find ./ -name "* .log" -mtime +1 -exec compress {} \;
find ./ -name "* .log" -mtime +1 -exec rm {} \;

The meaning of this command is to search the current directory to ".log" files ending, -mtime +1 means that the file was last modified more than one day, and to meet these two conditions compress files or delete operation

Make.

The third method:

. Ls TRACE _ * log | perl -lne '@ a = stat ($ _); if ((time () - $ a [9]) / 3600> 6) {print "rm $ _";}' | sh

. Ls ULOG * [0-9] | perl -lne '@ a = stat ($ _); if ((time () - $ a [9]) / 3600> 24) {print "compress $ _";} '| sh

ls everyone is familiar with, is to list the files under the current folder, the latter is perl perl -lne useful command-line arguments, stat is a function which can be obtained various documents state, "$ _" is filename wild card by the foregoing ls function listed, time () function is the system to get the current system time, "$ a [9]" is from the front of the stat function to get the status of a file in the ninth parameter, that is time of the file, "if ((time () - $ a [9]) / 3600> 6)" means the obvious, is that the current system time minus file time if more than 6 hours, then it is executed later operating.

The second command is similar.

In general, the system can find the log directory of each program, and agreed to the need to retain log each time, choose the appropriate command, written in clean scripts, and then configure the crontab system on a regular basis, thus achieving a disk automatic maintenance of space, so there is no excessive because the log and the system disk space is filled making the program unable to perform the normal problems.
     
         
         
         
  More:      
 
- How open source code libraries hosted on Github (Linux)
- To share Linux script automatically change passwords (Linux)
- Linear table with a Java implementation of the iterator (Programming)
- Iptables command in detail (Linux)
- Selection sort, insertion sort, and Shell sort (Programming)
- Talking about the implementation and the JVM garbage collection mechanism (Programming)
- Java NIO in the world (Programming)
- Linux shell string interception and stitching (Linux)
- Remote database using RMAN recovery test (RAC return to single-instance database) (Database)
- Python programmers most often committed ten errors (Programming)
- Ubuntu 14.04 / 13.10 users how to install Ubuntu Touch core applications (Linux)
- GitLab installation configuration notes (Linux)
- Python image processing library (PIL) to install and simple to use (Linux)
- MariaDB 10 Multi-source replication (Database)
- Change all child files and subdirectories in the owner permissions Ubuntu (Linux)
- Linux System Getting Started Learning: The Linux command line burn ISO or NRG image to DVD (Linux)
- To configure linux transparent firewall (Linux)
- How UTorrent download the ISO image from the command line (Linux)
- Nginx + uWSGI + Django + Python Application Architecture Deployment (Server)
- Zabbix installation and configuration process (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.