Is it OK to delete everything in /tmp?
well I've got slackware 10.0 on my computer..
I'm pretty tight for disk space, and I noticed that the /tmp directory had about 120mb of stuff in it. Is it ok to delete EVERYTHING in the /tmp directory or is there some stuff I need to leave behind? Cheers Forrest |
Re: Is it OK to delete everything in /tmp?
Yes, you can remove everything in /tmp. A (the?) proper way to do this is to login as root, then to switch to single user mode with the init 1 command and to use the following commands to create a sane /tmp hierarchy :
Code:
# rm -rf /tmp -- LiNuCe |
Personally, I avoid the issue altogether and run a 'tmpfs', i.e: a ramdisk which is mounted under /tmp at bootup. Don't have to worry about deleting stuff this way - it goes away when I shutdown the computer.
Refer to /path/to/kernel/source/Documentation/filesystems/tmpfs.txt for more info. |
Quote:
-- LiNuCe |
Quote:
In ~ 4 years (or however long its been since tmpfs came out) I've not experienced the problems discussed in the IBM article. But then I like to load my mobos with all the RAM they can carry. |
That's not a bad idea with tmpfs... I just append to the startup script. When it cleans /var/lock, I have it wipe /tmp as well. Those required sockets seem to get created automatically.
|
Well thanks for all the help..
I'm guessing it would be OK to add something like "rm -rf /tmp" to the shutdown script? |
Oh and I don't think I'll use the tmpfs thing, I've only got 128mb ram
|
I run KDE. In my rc.local, I run two scripts:
#!/bin/bash # /usr/local/sbin/deleteoldfiles # delete old tmp files echo "Deleting old tmp files." TMPDIRS="/tmp /var/tmp" # list of directories to clean for d in $TMPDIRS; do find $d ! -type d -mtime +10 -exec rm -f {} \; find $d -type d -mtime +10 -exec rmdir {} \; done #!/bin/bash # /usr/local/sbin/cleanup # delete various tmp files echo "Deleting various tmp files." # first delete known single files rm -f /tmp/.ICE-unix/* /tmp/kio* # next delete files recursively rm -rf /tmp/kde-root/* /tmp/kde-username/* /tmp/kde-tester/* /tmp/.wine* # Delete login manager logs for easier session troubleshooting and maintenance rm -f /var/log/kdm.log >/dev/null rm -f /var/log/xdm.log >/dev/null # rm -f /var/log/gdm.log >/dev/null The ideas for the scripts are not original. I saw what some other people have done and simply adopted the ideas. I hope this helps. |
Quote:
Code:
echo "Unmounting local file systems." Code:
rm -rf /tmp LiNuCe |
Or you could have a cron script for cleaning up /tmp, something like:
Code:
#!/bin/bash |
I like that even better... I've gotten in the habit of never using /tmp to store stuff, but you never know. You could build a new mozilla package and then forget to remove it before a reboot. Then you'd have to spend another hour building the package...
Nice suggestion aliendog. |
Quote:
-- LiNuCe |
All times are GMT -5. The time now is 10:35 PM. |