LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   /tmp directory (http://www.linuxquestions.org/questions/linux-general-1/tmp-directory-62943/)

Bobmeister 05-31-2003 08:28 PM

/tmp directory
 
Hello.

I am still new to Linux and with a really stupid question, I think. I am aware that in my Red Hat 9 system CRON is being forced by ANACRON to run several maintenance functions and can read them in the crontab file with no problem. I also am aware that there is a program that runs now and then (maybe) called tmpwatch.

My question is about the /tmp directory. How safe is it to empty stuff out of there? I would only do it after a fresh reboot. There is one directory in there called /tmp/orbit/"my user account" that has a gagillion 0KB files. Now, I don't think I have a problem clearning that out now and then, but want to make sure first.

So the bottom line question is this, and I'm really sorry if others have been on the posts with the (I can't find it)...CAN I DELETE ALL OF THE STUFF IN THE /tmp DIRECTORY or should I just leave it alone?

Thanks

trickykid 05-31-2003 08:41 PM

You can safely remove all files in /tmp

At times its best to remove them like you said after a fresh reboot or put a small script to clear out the directory in your startup scripts.

markus1982 06-01-2003 02:51 AM

I would rather say add a tmp cleanup script to your cron.daily. Like you could use:
Code:

#!/bin/sh

# clean up /tmp and /var/tmp

if [ -d /tmp -a -d /var/tmp ]
then
        find /tmp -type f -atime +3 -exec rm {} \;
        find /var/tmp -type f -atime +3 -exec rm {} \;
fi

This will remove files in /tmp and /var/tmp that haven't been accessed in 4 (3+1) days.

Bobmeister 06-01-2003 04:32 PM

Thanks all...

I will take your advice....right now, I don't have a problem manually cleaning every now and then as I am interested in just kind of monitoring what goes on in there.

But I might run that script for later...or look at my CRONTAB to see what might be modified to get it to clean it more often. However, I'm not adverse to doing it manually.

I am having fun in Linux and leaned a lot today installing Java and doing some CD burning with CDroast...a pretty robust program if you ask me...


All times are GMT -5. The time now is 05:25 PM.