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
Table of contents 1. What is an event? 2. Enable ...
Virtual hosts use special software and hardware t...
1. Javascript returns to the previous page history...
Note: This method is only applicable to webkit-ba...
If you are not committed to becoming an artist, t...
Write configuration files in server.xml and conte...
This article mainly introduces how to implement l...
reason: MySQL 5.7.5 and up implements detection o...
This article shares the specific code of Node.js+...
Table of contents Discover: Application of displa...
This article shares the specific code of jQuery t...
1. When inserting, updating, or removing DOM elem...
letter-spacing property : Increase or decrease th...
Installing XML extension in PHP Linux 1. Enter th...
Table of contents 1. Prototype 2. Prototype chain...