From owner-freebsd-questions@FreeBSD.ORG Wed Jun 3 09:10:05 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 290871065673 for ; Wed, 3 Jun 2009 09:10:05 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [IPv6:2001:4070:101:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 4DAD88FC13 for ; Wed, 3 Jun 2009 09:10:03 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (localhost [IPv6:::1]) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n5399wYH050576; Wed, 3 Jun 2009 11:09:58 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3/Submit) with ESMTP id n5399waw050573; Wed, 3 Jun 2009 11:09:58 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Wed, 3 Jun 2009 11:09:58 +0200 (CEST) From: Wojciech Puchar To: Dan Naumov In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-questions@freebsd.org Subject: Re: pkg_deinstall: "delete all packages installed, except for X, Y and Z" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2009 09:10:05 -0000 > Hello list. > > I am trying to clean up a system with a LOT of cruft. Is there some > argument I could pass to pkg_deinstall that would result in "delete > all packages installed, except for X, Y and Z" (and obviously their > dependancies)? just do pkg_info |cut -f 1 -d " " >/tmp/pkglist edit pkglist and delete lines X, Y and Z do pkg_delete `cat /tmp/pkglist` rm /tmp/pkglist ignore errors about package can't be deleted because X, Y or Z requires it. it's exactly what you want.