Thanks to everyone who took the time to reply to my posting last week.
Here's the results.
MY ORIGINAL QUESTION:
I would like to clear all files from /tmp on bootup. The
command in /etc/rc,
(cd /tmp; rm -f - *)
doesn't remove the files whose names begin with a ".".
How can I clear /tmp of all files on bootup? I would like
to put the command in /etc/rc or /etc/rc.local so that it's executed
each time the system is booted. Thanks.
SEVERAL OF THE MANY SOLUTIONS I RECEIVED:
1. (cd /tmp; rm -f - * .[a-zA-Z]*)
2. (cd /tmp; rm -f - *)
(cd /tmp; rm -f .*)
3. rm -f /tmp/* /tmp/.??*
4. cd /tmp && {
find . ! -type d -exec rm -f '{}' ';' # remove files
find . -type d ! -name . -depth -exec rmdir '{}' ';' # remove dirs
}
5. find /tmp -exec rm {} \;
6. find /tmp -type f -exec rm {} \;
7. (cd /tmp; rm -f - * .*)
8. Use the tmpfs filesystem, this is in memory ans is cleared on boot time
(fast but restricted in space)
9. rm -rf /tmp; mkdir /tmp; chmod 777 /tmp
10. A slightly less brutal approach would be
rm -f - * .*
which should generate error messages saying
rm: cannot remove `.' or `..'
rm: cannot remove `.' or `..'
so
rm -f - * .* > /dev/null 2>&1
would probably be required.
11. (cd /tmp; rm -fr - * .* 2>/dev/null)
12. (cd /tmp ; find . -type f -exec rm -f {} \; ; find . -type d ! -name . -exec rmdir {} \;)
-- ============================================================================= CCCCCC EEEEEE RRRRRR CCCCCC Rebecca Littleton CC EE RR RR CC Systems Administrator CC EEEE RR RR CC Concurrent Engineering Research Center CC EEEE RRRR CC West Virginia University CC EE RR R CC Morgantown, West Virginia 26506 CCCCCC EEEEEE RR RR CCCCCC ral@cerc.wvu.wvnet.edu =============================================================================
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:44 CDT