Clean /tmp on Linux: remove old temporary files with tmpwatch
The /tmp partition on a Linux server is used to temporarily store files while various tasks are running. It is important to ensure that this partition does not become full, as it can affect system performance and cause unexpected issues.
In this tutorial, we will show you how to delete files older than 12 hours from the /tmp partition. By freeing up space in this partition, you ensure efficient server operation and help prevent potential errors or interruptions.
Follow the instructions below to clean the /tmp partition and keep your server in optimal condition. Remember to be cautious when deleting files and make sure you do not need any important data that may be stored in this partition.
Simply log in via SSH and run the following:
- tmpwatch -am 12 /tmp
This will remove all files older than 12 hours, meaning it will only keep files from the last 12 hours up to the time you run the command, and everything else will be discarded.
Caution: /tmp may contain temporary files that are currently in use. Run this cleanup preferably during periods of low activity.
Related Articles
How to delete iDrive e2 files using AWS CLI on Mac
When you need to delete large amounts of files from an iDrive e2 bucket, doing it through the web interface can take hours or even days. The most efficient solution is to use AWS CLI from your Mac terminal, as it processes multiple files in parallel ...
Using Screen on Linux: create, resume, and close terminal sessions
Screen is a command-line tool on Linux that allows you to manage multiple, persistent terminal sessions. With screen, you can run programs in the background, detach from a session without closing it, and resume it later. This is useful for ...
How to install and configure Nginx as a reverse proxy in cPanel/WHM 🚀
What is Nginx and why use it with cPanel? Nginx is a high-performance web server that can function as a reverse proxy in front of Apache on cPanel servers. This configuration allows Nginx to handle static files (images, CSS, JavaScript) while Apache ...
Basic SSH commands
FILE MANAGEMENT Copy file cp -a archivo.zip archivocopia.zip Create a 404.html file touch /home/usuario/public_html/404.html Compress directory zip -r archivo.zip /home/usuario/public_html/directorio Extract file unzip archivo.zip View contents of a ...
Emails don't appear in webmail searches
When you search for an email in Roundcube (cPanel) and it doesn't appear in the results even though it exists in your mailbox, the problem almost always stems from the server not having properly indexed the messages. For example, if you try to locate ...