How to delete temporary and unused files from a VPS server?

Dr. McKay

Well-known member
Registered
Joined
Nov 26, 2016
Messages
565
Points
28
I have a VPS using Centos 6. I check with the command dh -f and its showing large size while I don't use more space like that, only some Wordpress sites. I wan to find out unused or temporary files on my vps and delete them to reduce disk space on my vps server. How can any one guide me?
 

UnderHost

Member
Registered
Joined
Sep 5, 2016
Messages
42
Points
8
Type the following command at the shell prompt to find out largest directories:

Code:
# du -ch -d 1 | sort -hr
tmp files are located at /tmp, keep in mind that control panel such as cPanel requires at least 4GB of space.
 

Luxin Host

Well-known member
Registered
Joined
Jun 26, 2016
Messages
543
Points
43
You can get rid of the unwanted files using:

find /var -name "*.log" \( \( -size +50M-mtime +10 \) -o -mtime +30 \) -exectruncate {} --size 0 \;

This will trim all the logs which are either larger than 50M and older than 10 days or they are older than 30 days.

Another way to clean up storage would be using yum-utils package. After installing the package you can clean up caches using the following:

yum clean all
 

Dr. McKay

Well-known member
Registered
Joined
Nov 26, 2016
Messages
565
Points
28
Type the following command at the shell prompt to find out largest directories:

Code:
# du -ch -d 1 | sort -hr
this command is great to find out largest directories i will keep it for the next uses.

tmp files are located at /tmp, keep in mind that control panel such as cPanel requires at least 4GB of space.
can I delete all files in this folder without any problems?

You can get rid of the unwanted files using:

find /var -name "*.log" \( \( -size +50M-mtime +10 \) -o -mtime +30 \) -exectruncate {} --size 0 \;

This will trim all the logs which are either larger than 50M and older than 10 days or they are older than 30 days.

Another way to clean up storage would be using yum-utils package. After installing the package you can clean up caches using the following:

yum clean all
I am afraid of deleting using files and cause damage to the system. Is there a way to delete to user interface?
 
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top