Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 01-23-2007, 08:27 AM   #1
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
/TMP Directory

OK - So I was told that the /tmp directory was a place I can throw stuff that is just kind of like a Recycle Bin and that Linux will auto flush this directory at some point. My question is if I move something into /tmp as "root", how long will it remain in /tmp? Does it get flushed automatically by how long it remains in /tmp or does /tmp have a size limit and once exceeded, it flushes the files?

Also can you set parameters for /tmp like auto flush every 30 days or even every 1 day?

Old 01-23-2007, 08:57 AM   #2
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
On most Linux systems there is an entry in the daily crontab, that every day look for files which have not accessed for a period of time (using tmpwatch) and remove them.
Old 01-23-2007, 09:02 AM   #3
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,128
Blog Entries: 14

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
To amplify on that response. /tmp itself is just a directory (or sometimes a filesystem). As such it doesn't automatically delete anything.

On Linux as the above poster said by default many distros have the tmpwatch to do cleaning. On UNIX systems some people add cron jobs to do such cleaning or startup jobs. (Years ago on AT&T UNIX the default job actually blew away the directory on reboot then recreated it.) The idea is NOT to use it for permanent storage as most admins know it is fair game and will not hesitate to blow away files there if space becomes an issue. It's a good to periodically blow things away by such a cron job as at it teacher users not to store things there the hard way.

Note there also is a /var/tmp and on some older systems a /usr/tmp.
Old 01-23-2007, 10:28 AM   #4
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,731

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Be aware that /tmp is sometimes mounted as tmpfs, i.e. a filesystem backed by virtual memory instead of directly a disk partition.

This is very good for performance, as you'll have memory access time vs disk drive access time for the temporary data placed there.

The drawback are:
- everything is lost when the system shutdowns
- very big files living in /tmp can dramatically slow down the system because of pagination.

Another point: /var/tmp is a filesystem designed to store persistant data. Only the application that create files or directory there are allowed to remove them.
You should't remove files present there (or have a daemon that do it) without knowing what you are removing.
Old 01-23-2007, 02:02 PM   #5
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Thanks all!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
/tmp directory is full? Moses420ca Linux - Newbie 13 01-21-2005 08:48 PM
Can I delete everything in the /tmp directory? BajaNick Linux - General 5 07-04-2004 02:35 PM
permissions in /tmp directory linux_pioneer Linux - Software 1 08-30-2003 11:43 PM
/tmp directory Bobmeister Linux - General 3 06-01-2003 05:32 PM
/tmp directory too small??? kazi Linux - Newbie 9 03-29-2003 01:46 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration