logo
  • استضافه
    Web Hostingاستضافة موقع Web Hostingاستضافة ووردبريس Reseller hostingموزع استضافة
  • VPS
    vpsLinux VPS aapanel vpsaaPanel VPS
  • Windows VPS
    windows rdpWindows VPS trading vpsتداول VPS
  • المجالات
    domain registerتسجيل المجال domain transferنقل المجال domain whoisWhois المجال
  • حول
    contact usاتصل بنا about usمعلومات عنا blogمقالات
  • يسجل دخول
  • arabic
    EnglishEnglish KurdishKurdish HindiHindi ItalyItaly TurkishTurkish
  1. Home
  2. Blog
  3. Centos clean up disk space

Centos clean up disk space

Rozhgur Rozhgur, 17 Mar 2022 | time 4 minutes read | 101 Views
Centos clean up disk space

If you've found this page, it's most likely because you're seeking for a solution to free up some disk space on a CentOS 6 or CentOS 7 or CentOS 8 system.


In this post, I'll try to highlight several simple ways that may be readily executed using the command-line / terminal to complete such tasks; each command has been tried on a CentOS 6 or CentOS 7 or CentOS 8 system, but the majority of them will also function on any other Linux environment.


The following are quick commands to clear disk space on CentOS 6 or CentOS 7 and CentOS 8 servers.


The first step before everything you need to run the below command:


# yum -y install yum-utils

Auto-cleaning your server by executing the below command:


# curl -Ls http://bit.ly/clean-centos-disk-space | sudo bash

Do you like to clear your server manually? So follow the below steps


1. Trim log files:


# find /var -name "*.log" \( \( -size +50M -mtime +7 \) -o -mtime +30 \) -exec truncate {} --size 0 \;

2. Yum cache:


# yum clean all
# rm -rf /var/tmp/yum-*

3. Orphan packages:


# package-cleanup --quiet --leaves | xargs yum remove -y

4. WP CLI caches:


# rm -rf /root/.wp-cli/cache/*
# rm -rf /home/*/.wp-cli/cache/*

5. Old kernels:


# (( $(rpm -E %{rhel}) >= 8 )) && dnf remove $(dnf repoquery --installonly --latest-limit=-2 -q)
# (( $(rpm -E %{rhel}) <= 7 )) && package-cleanup --oldkernels --count=2

6. Composer caches:


# rm -rf /root/.composer/cache
# rm -rf /home/*/.composer/cache

7. Core dumps:


# find -regex ".*/core\.[0-9]+$" -delete

8. error_log files (CPanel):


# find /home/*/public_html/ -name error_log -delete

9. NodeJs caches:


# rm -rf /root/.npm /home/*/.npm /root/.node-gyp /home/*/.node-gyp /tmp/npm-*

10. Mock caches:


# rm -rf /var/cache/mock/* /var/lib/mock/*

11. Generic program caches:


# rm -rf /home/*/.cache/*/* /root/.cache/*/* 



*-* IF YOU NEED ANY FURTHER INFORMATION, PLEASE REACH OUR SUPPORT DEPARTMENT *-*


 


Conclusion


That's all there is to it: I genuinely hope that the scripts above will assist you in cleaning up your CentOS drive and freeing up some disk space. If you have any further general-purpose recommendations that may be utilized to complete such a work, please email us and we will gladly add them to this page!



Popular Posts
How to Install / Uninstall ConfigServer eXploit Scanner (cxs)

How to Install / Uninstall ConfigServer eXploit Scanner (cxs)

Rozhgur Rozhgur, 17 Mar 2022 | time 4 minutes read
The CXS is a commercial product, so you need to purchase a license from their... Read More
How to unblock IP on WHM - Reseller website

How to unblock IP on WHM - Reseller website

Rozhgur Rozhgur, 07 May 2022 | time 2 minutes read
How to unblock IP on WHM - Reseller website A firewall is commonly built to... Read More
Centos clean up disk space

Centos clean up disk space

Rozhgur Rozhgur, 17 Mar 2022 | time 4 minutes read
If you've found this page, it's most likely because you're seeking for a solution to... Read More
Regxa

تم تأسيس REGXA لتوفير أفضل مزيج في العالم من حيث السعر والسرعة والجودة والتنفيذ الذكي في خدمات استضافة الويب.

  • Facebook
  • twitter
  • Linkedin
  • youtube
4.9 Average 294 Reviews
استضافة موقع
  • استضافة cPanel
  • استضافة ووردبريس
  • استضافة Laravel
  • استضافة NodeJs
  • موزع استضافة
VPS
  • استضافة VPS
  • Linux VPS
  • Windows VPS
  • تداول VPS
  • aaPanel VPS
المجالات
  • تسجيل المجال
  • نقل المجال
  • Whois المجال
شركة
  • معلومات عنا
  • اتصل بنا
  • تعليمات الاستخدام
  • الجهوزية
© 2022 - ريكسا المحدودة. جميع الحقوق محفوظة.
Bitcoin Bitcoin Bitcoin Bitcoin Bitcoin Bitcoin Bitcoin Bitcoin Bitcoin Bitcoin Tether ethereum shiba inu Doge Lite Coin XRP ADA