From owner-freebsd-questions@FreeBSD.ORG Sat Jan 17 09:26:33 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD6AEF2E for ; Sat, 17 Jan 2015 09:26:33 +0000 (UTC) Received: from avasout08.plus.net (avasout08.plus.net [212.159.14.20]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client CN "Bizanga Labs SMTP Client Certificate", Issuer "Bizanga Labs CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C4C7EC3 for ; Sat, 17 Jan 2015 09:26:32 +0000 (UTC) Received: from curlew.milibyte.co.uk ([84.92.153.232]) by avasout08 with smtp id gxPL1p003516WCc01xPMdj; Sat, 17 Jan 2015 09:23:21 +0000 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=D6jJK5hj c=1 sm=1 tr=0 a=lfSX4pPLp9EkufIcToJk/A==:117 a=lfSX4pPLp9EkufIcToJk/A==:17 a=D7rCoLxHAAAA:8 a=0Bzu9jTXAAAA:8 a=cYTjFNdXV1EA:10 a=8nJEP1OIZ-IA:10 a=YNv0rlydsVwA:10 a=NIrImYtOpZO77GuylngA:9 a=wPNLvfGTeEIA:10 Received: from curlew.lan ([192.168.1.13] helo=milibyte.co.uk) by curlew.milibyte.co.uk with esmtp (Exim 4.85) (envelope-from ) id 1YCPbD-0000sW-Ta; Sat, 17 Jan 2015 09:23:20 +0000 From: Mike Clarke To: freebsd-questions@freebsd.org Date: Sat, 17 Jan 2015 09:23:19 +0000 Message-ID: <2144033.K6Q1fOgUqN@curlew.lan> User-Agent: KMail/4.14.2 (FreeBSD/10.1-RELEASE; KDE/4.14.2; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 192.168.1.13 X-SA-Exim-Mail-From: jmc-freebsd2@milibyte.co.uk X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on curlew.lan X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 Subject: Re: Setting up an alias for 'pkg info | awk' Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="iso-8859-1" X-SA-Exim-Version: 4.2 X-SA-Exim-Scanned: Yes (on curlew.milibyte.co.uk) Cc: Manish Jain X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jan 2015 09:26:33 -0000 On Saturday 17 Jan 2015 14:29:22 Manish Jain wrote: > I am trying to list out all the ports on my system with a Bash shell alias : > > alias pia="pkg info | awk '{print $1}'" > > But this alias simply prints the output of 'pkg info'. > > Is there some way to do this ? Assuming that you're just wanting to get a list of the names of all your packages you could use: pkg query -a '%n-%v' # for the full names pkg query -a %n # for just the names without version numbers pkg query -a %o # for the origins in /usr/ports -- Mike Clarke