cannot remove contents of the /tmp folder
Hello,
Im trying to delete the contents of my /tmp folder, so from within /tmp I issue this command: Code:
rm -r * Quote:
The permissions on the /tmp folder are 'drwxrwxrwt', Im wondering what the 't' is ? Is there a special command to delete the contents of the /tmp folder? |
You can try the following but you should be careful as it will probably delete files that are in use:
Code:
# rm -rf -- * Use at your own risk. |
deleting files that are in use
This is legal in unix, I'm pretty sure. a "rm" command will succeed but the file will stick around UNTIL IT IS NO LONGER OPEN. THEN it will be really removed.
|
't' is denoted for sticky bit. You cannot delete files which are not owned by you if sticky bit is applied on a directory.
|
You can remove the stiky bit as root:
chmod -t /tmp if /tmp is owned by root, then he shopuld be able to remove the files anyway |
Just do a reboot. That should clear out /tmp. It seems to have done on my system. My last reboot was 8 Feb and there are no files older than that in /tmp.
|
Yes, Rich_c is right. Just wait for your next reboot and /tmp gets cleared out automatically. I don't think it's a clever idea to remove everything from /tmp on a running system. Lots of apps put stuff there until they are closed down. Removing these /tmp file would probably bring your system down. You can certainly delete specific files that you know are no longer necessary (I use /tmp as my default download folder and delete installation files all the time). Why do you want to delete everything from /tmp anyway?
cheers, jdk |
Thanks everyone.
Rebooting didnt remove the files in /tmp (slackware 12.1), but doing: Code:
# rm -rf -- * p.s jdkaye, I just wanted a clearout ;) |
Don't remove the /tmp sticky bit evar. It's for security :)
|
Quote:
There are always going to be files in /tmp for the reasons explained above. Are you sure the ones that you save in /tmp when you rebooted arent' fresh ones installed after your latest reboot? You can check the date/time of the files by doing Code:
ls -l [filename] jdk |
There are a few hidden files and directories which seem to have been created since the reboot (.xorg.conf, .X0-lock, etc), but alot fewer than there were.
I suppose Im trying to clean up a directory which by its nature is 'untidy'. |
Quote:
|
A useful command for know if some process is using any file inside /tmp folder do the following:
Code:
fuser /tmp |
All times are GMT -5. The time now is 03:21 AM. |