Author Topic: Can we delete File and folders under tmp Folder ?  (Read 408 times)

0 Members and 1 Guest are viewing this topic.

Can we delete File and folders under tmp Folder ?
« on: September 01, 2023, 07:58:55 PM »

My server disk usage was increased recently no it was showing 87% So I don't know why it was like that I didn't have much website hosted under my server. I noticed there are many files under tmp Folder. In windows we mostly remove %temp% , Prefetch etc. So I need to know If there are folder or files which we can delete which will not effect our server or services. Please help me..

Re: Can we delete File and folders under tmp Folder ?
« Reply #1 on: September 02, 2023, 02:43:21 AM »
I wouldn't clear anything in /tmp -- look elsewhere for low hanging fruit. Typical offenders are log files (if you haven't enabled logrotate on them), user's IMAP trash folders, DB backups, and even daily backups if users have implemented a CMS-level (WordPress) backup solution -- so you wind up with large compressed archives in triplicate: daily, weekly, monthly).

You could search for files 100MB or larger:
Code: [Select]
sudo find / -xdev -type f -size +100M
Use your judgement to selectively delete some XL size files. And then likely you could truncate some of the log files to 0 bytes and start fresh, along with implementing logrotate:
Code: [Select]
truncate -s0 /var/log/spamd.log