Following are the quick commands to clear disk space on your CentOS 6 or CentOS 7 server. First you need to install the yum-utils package: yum -y install yum-utils 1. Prune log files find /var -name "*.log" ( ( -size +50M -mtime +7 ) -o -mtime +30 ) -exec truncate {} --size 0 ; This will truncate all *.log files on the /var volume that are older than 7 days and larger than 50M or older than 30 days. 2. Clean up the YUM cache Cleaning the yum cache is simple: yum clean all Please note that the above command will not remove all the files associated with yum that have been installed. You may want to free up space occupied by orphaned data in disabled or deleted repositories: rm -rf /var/cache/yum Also, when you accidentally yum through a normal user (forget sudo), yum will create a user cache. So we remove that as well: rm -rf /var/tmp/yum-* 3. Delete orphan packages Check for existing orphan packages package-cleanup --quiet --leaves --exclude-bin Confirm deletion of orphaned packages Now, if you are happy with the suggestions given by the previous command, run: package-cleanup --quiet --leaves --exclude-bin | xargs yum remove -y 4. Delete WP CLI cached WordPress downloads Every time you set up a new WordPress site, WP CLI saves a WordPress archive. You can delete these caches with the following command: rm -rf /root/.wp-cli/cache/* rm -rf /home/*/.wp-cli/cache/* 5. Delete the old kernel Before removing the old kernel, you may want to reboot first so that you can boot from the latest kernel. Because you can't remove old kernels from the current boot system 🙂 The following command will keep only the 2 most recent kernels: package-cleanup --oldkernels --count=2 Note that with some VPS providers (such as Linode), the server defaults to using a kernel built by the provider, rather than the server's own kernel. Therefore, it makes no sense to keep more than 1 old kernel on your system. so: package-cleanup --oldkernels --count=1 6. Delete Composer Cache rm -rf /root/.composer/cache rm -rf /home/*/.composer/cache 7. Delete core dumps If you have some serious PHP glitch that causes it to segfault and enable core dumps, then chances are - you have a lot of them. find -regex ".*/core\.[0-9]+$" -delete 8. Delete the error_log file (cPanel) If you use a nasty cPanel, you will surely have dozens of error_log files scattered throughout your web directory. If you can install Citrus Stack, that's much better. A temporary solution is to delete all of these files: find /home/*/public_html/ -name error_log -delete 9. Delete Node.js cache rm -rf /root/.npm /home/*/.npm /root/.node-gyp /home/*/.node-gyp /tmp/npm-* The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: JavaScript implements simple date effects
>>: MySQL daily statistics report fills in 0 if there is no data on that day
Brotli is a new data format that can provide a co...
Table of contents 1. Browser local storage techno...
There are many tasks to be done in search engine o...
This article shares the specific implementation c...
Tomcat7.0 sets virtual directory (1) Currently, o...
Preface This article introduces a simple BAT scri...
Table of contents About G2 Chart use Complete cod...
First of all, let's talk about the execution ...
In development, it is often necessary to cache th...
Generally, the colspan attribute of the <td>...
1. Introduction This article mainly explains how ...
Effect: Code: <template> <div class=&quo...
1. System environment The system version after yu...
There are the following log files in MySQL: 1: re...
Table of contents Preface 1. Null coalescing oper...