Daily maintenance

Derek Broughton news at pointerstop.ca
Thu Jun 19 16:14:27 UTC 2008


David Vincent wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Derek Broughton wrote:
>> I run this weekly:
>> 
>> aptitude search '~i !~M' | tr -s ' ' | cut -f 2 -d ' '
>> /etc/apt/installed.txt

You lost the ">" redirection in there...

aptitude search '~i !~M' | tr -s ' ' | \
   cut -f 2 -d ' ' > /etc/apt/installed.txt

>> 
>> (all on one line, of course) which gives me a convenient list of
>> currently installed packages so that I can duplicate this setup on a new
>> install.
> 
> hrm, that gives me an empty file.
> 
> sudo aptitude search '~i !~M' | tr -s ' ' | cut -f 2 -d ' '
>  > /home/dvincent/installed.txt
> 
> do i need the sudo?  i've been wondering how to get a list of packages
> like this.

LOL.  I never even thought about it.  This runs from /etc/cron.weekly, so it
runs as root, and wouldn't need sudo anyway!  It _does_ have to be able to
write (in my case) into /etc, which is probably why there's a "sudo" in it. 
otoh, ime, "sudo" never worked for redirecting output.
-- 
derek





More information about the ubuntu-users mailing list