Linux - GeneralThis 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.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.