How to remove all useless file from /tmp folder in Linux.

There are many files could be stored in /tmp folder which are needed by running software on your Linux system. Removing them could cause you data loss.

However there is a safe way to do this.

Use the following command:

TMPTIME=0

This will remove all files from tmp folder.

However there is more elegant solution, but possible less stable. Use TMPFS for /tmp folder. That means that everytime you reboot, you get clean /tmp folder, as all file are stored in RAM of your system.

To see how setup TMPFS follow this link: TMPFS

Leave a Comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.