Welcome to Webmaster HTML
 
 

Logs and Files That Can Be Removed on a Linux Server

Good Morning!

Is your HDD slow or full? Reducing the disk size of your Linux server not only frees up space, it allows your server to operate faster and more efficiently for those on a HDD drive. In addition to removing large log files, you might want to remove those small but numerous files that reside on the server disk. The reason is that the server needs to know the location of all files and the longer it takes to find the files location, the less efficient your server becomes. For SSD drive this may not hold true but still, if reducing your disk drive size is a goal because it got full, then read on.

Web Developer Resources

Resources & How Tos

These are some command lines used to find and deleted or move log and files. As I learn of more server files that can be removed, I will put them on this page or provide a link to the resources.

Resources

  • fdupes – A Comamndline Tool to Find and Delete Duplicate Files in Linux

Delete Via Shell

Remove Old Kernels

Disk Full

Web Developer Resources

Using Command Line to Find & Delete Files

As you may be finding out, it’s a never ending battle to reduce disk size on a Linux server. These below handy dandy SSH command line instructions will become useful in this endeavor. You want to remember to do your research before you remove any files. Just a note, and you might already know but some files may be useful in the future, some may be required - and some files are just plain junk that have outlived their usefulness. You should be looking for logs, backups, orphaned cache & tmps files, also older versions of the same files. You may want to be extra careful with directories - again, be careful of what you are deleting.

Remove Old Kernels Files on CentOS, Fedora

# This checks to see what kernels you have installed
rpm -q kernel
# You might see something like this
kernel-2.6.45-137.el6.x86_64
kernel-2.6.45-137.3.3.el6.x86_64
kernel-2.6.45-137.5.1.el6.x86_64
kernel-2.6.45-137.8.2.el6.x86_64

# This installs the yum-utils & deletes old kernels. Fedora, CentOS, Red Hat
yum install yum-utils

# This cleans up the package and state how many old kernels to leave on drive
package-cleanup --oldkernels --count=2

# Makes amount of installed kernels permanent
Edit /etc/yum.conf, set installonly_limit:
installonly_limit=2


Some Directories on the Server To Look At

# These are some directories to look for files you might want to delete. You may not have some of the directories and also some may be at different locations.

/var/log/

/var/cpanel/updatelogs/

/var/log/dcpumon/

/var/log/audit

/var/log/bandwidth/

/usr/local/apache/logs/archive/

/var/lib/csf/backup

/root/tmp/pear/cache/

/usr/local/cpanel/logs/update_analysis

/usr/local/cpanel/src/3rdparty/gpl

<user>/tmp/pear/cache

Look for *.tar.gz (locate *.tar.gz)

Other Ways of Reducing Files

Log into your file manager and see if there are additional files to be deleted.

Check your email accounts to see if you have mega mounts of email that have piled up. (I'm guilty)

Top