Setting up an alias for 'pkg info | awk'

Mike Clarke jmc-freebsd2 at milibyte.co.uk
Sat Jan 17 09:26:33 UTC 2015


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


More information about the freebsd-questions mailing list