Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to zero out a file in tcsh?



On Fri,  7 Feb 2003 08:58:23 -0800
dgavin at davegavin.com wrote:

> 
>  the "rm filename; touch filename" variation doesn't necessarily
>  preserve
> ownership or permissions depending on who does it and what their umask
> is. My personal favorite is "cat /dev/null > filename".
Yes, this will truncate the file, preserve permissions, and maintain the
filename as the same inode. However, there is a caveat. If the filename
is open and someone is reading or writing to the file, most likely that
read/write operation will fail. 
And yes, the rm command does not physically delete a file. If that file
has another link or if that file is open by another process, then the
rm/touch does not achieve the desired result. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.blu.org/pipermail/discuss/attachments/20030207/8429b56e/attachment.sig>



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org