D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] shrinking nohup.out

 

On Wed, 2011-04-27 at 13:17 +0100, Gordon Henderson wrote:
> On Wed, 27 Apr 2011, Philip Hudson wrote:

> Dan's solution of echoing nothing into it might work, but I'm not sure if
> that actually frees up the disk blocks...

I wondered the same thing. The bash manpage says

Redirection of output causes the  file  whose  name  results  from  the
expansion of word to be opened for writing on file descriptor n, or the
standard output (file descriptor 1) if n is not specified.  If the file
does  not exist it is created; if it does exist it is truncated to zero
size.

So the > redirection will truncate any existing file rather than unlink
and create a new one, therefore the disk blocks will be freed.

I learnt something there. Excellent.


Sophos Limited, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United 
Kingdom.
Company Reg No 2096520. VAT Reg No GB 991 2418 08.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq