During Linux system operation, periodically deleting expired files can free up space memory and avoid waste of resources. You can use commands to implement them. The following small series will introduce you how to use Linux to periodically delete expired commands. file.
code is as follows:
find /var /www /-type f -mtime +30 -exec rm -f & lsquo; {} \\; & rsquo;
The above command deletes expired files older than 30 days.
Command Description:
/var/www/is the path to find files.
-type f is the specified file type as a normal file.
-mtime +30 refers to a file that has been modified for 30 days.
-exec rm -f means to delete the matching files and not prompt, some systems need to take single quotes, and some do not.
Add the above command to the crontab to achieve regular deletion.
For example, delete at 1:30 every day, you can do this:
The code is as follows:
#crontab -e
30 1 * * * Find /var/www/-type f -mtime +30 -exec rm -f ‘{} \\;’
The above is the way to use Linux to periodically delete expired files using commands. At the time, you can choose the time to delete the expired files according to the specific situation. It is the key to choose the period.
The Apache server is the most widely used web server software, so Linux users need
LVM is a logical volume management, is a mechanism for disk partition management under Linux, I beli
PlayOnLinux is a very good software for friends who like Windows software but use L
Linux command reconfig can be used to convert configuration files, mainly used in XF86Config. The us
How to solve the problem that the WeChat public platform webpage cannot play audio under Linux?
Ubuntu install Simple Screen Recorder method
Ubuntu tips to start the deb installation package with the dpkg command
How to use the tail command guide under Linux
Ubuntu system remote boot operation example
How to use the command line to change the date and time of the Linux system
What is the role of inode nodes in Linux?
Ubuntu install vim plugin steps
Ubuntu uses Steam Music method
PPTV2013 Internet TV how to remove advertising
How is the development progress of Windows 10? Officially said that only 65% completed
How to remove the system compressed file displayed in the Win10 system disk cleaning tool
Linux one-click installation lnmp environment Raiders
What should I do if the tile application in the win8 system is necrotic? The
Win10 update 10122/10074 three patches: for IE browser vulnerability