Is it Safe to Delete Files From /var/tmp?

The root filesystem ran out of space, so I'm deleting all the extraneous junk. I already deleted everything in /var/log and /var/cache/apt/archives and did sudo apt autoremove.

This /var/tmp is using 18.5 GiB. What is it used for? Is it safe to delete the contents?

UPDATE

I found these 2 swap files:

474M 10112015.tgz.swp
19G 10022015.tgz.swp

Those swap files were generated by opening tar files in vi.

Is there a way to limit the amount of storage space used by /var/tmp?

2

1 Answer

Filesystem Hierarchy Standard

5.15 /var/tmp : Temporary files preserved between system reboots

5.15.1 Purpose

The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.

Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.


Yes, you can remove all files in /var/tmp/.

But 18Gb is far too much. Before deleting these files do have a look at what it holds and see if you can find a culprit. Otherwise you will have it at 18Gb again soon.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like