I've deleted all of the files in /tmp. Why is it still taking up space?

Linode Staff

I've deleted all of the files in /tmp, but I'm still seeing that /tmp is taking up space. How do I delete the files in /tmp so that space is released?

2 Replies

When you delete files from /tmp, they will remain on the disk for as long as an application is still using them. To reclaim the space, you can quit the application. Rebooting may also help to reclaim the space, since it will result in the application quitting and releasing the files. You can use a command like the following to verify whether the files are still in use:

sudo lsof -n | grep /tmp | grep deleted

There are several hidden directories that get created in /tmp by the system when you boot it up:

drwxrwxrwt   2 root  root   2 Jul  5 19:04 .ICE-unix
drwxrwxrwt   2 root  root   2 Jul  5 19:04 .X11-unix
drwxrwxrwt   2 root  root   2 Jul  5 19:04 .XIM-unix
drwxrwxrwt   2 root  root   2 Jul  5 19:04 .font-unix

These are all related to the X Window System and are omnipresent in /tmp … whether you use X or not (the directories are there to hold socket files for IPC and other things). On my system the directories are all empty and take up about 27K. I don't use X.

You can delete them but they just get re-created the next time you reboot your system.

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct