Antonio Diaz Diaz wrote: > Enda wrote: > > I am trying to empty the contents of a file. The above works, but > > Is there any reason to read the whole "largefile" in /tmp just to > truncate it, instead of, say, doing a "rm" followed by a "touch"?
If it is a big file such as a logfile and a process might still be writing to it then removing the file won't free up the disk space until the last file handle to it has been closed. This is an often occurring question which is why I mention this. Therefore to truncate a file and to ensure that the disk space is freed immediately regardless of a process still possibly writing to it I recommend simply truncating the file using the shell. Then there is no need to create it again with touch or to need to adjust permissions afterward or anything like that. $ > largefile Bob _______________________________________________ bug-ed mailing list bug-ed@gnu.org https://lists.gnu.org/mailman/listinfo/bug-ed