[trick] search package from list of available

17 views
Skip to first unread message

Narendra Sisodiya

unread,
Dec 25, 2010, 4:56:44 AM12/25/10
to IITDLUG, schoolos
add this to your ~/.bashrc file

apt-get-search() {
aptitude search $1  | sed -e 's/^i.*//g' | sed '/^$/d'
}

close and open the terminal again [or just source ~/.bashrc]

After that you will be able to search like


apt-get-search games
apt-get-search hindi
apt-get-search graphics

this trick has been added to schoolOS bashrc bydefault..
--
┌─────────────────────────┐
│    Narendra Sisodiya
│    http://narendrasisodiya.com
└─────────────────────────┘

Narendra Sisodiya

unread,
Dec 25, 2010, 5:58:18 AM12/25/10
to IITDLUG, schoolos


On Sat, Dec 25, 2010 at 3:26 PM, Narendra Sisodiya <nare...@narendrasisodiya.com> wrote:
add this to your ~/.bashrc file

apt-get-search() {
aptitude search $1  | sed -e 's/^i.*//g' | sed '/^$/d'
}

close and open the terminal again [or just source ~/.bashrc]

After that you will be able to search like


apt-get-search games
apt-get-search hindi
apt-get-search graphics

this trick has been added to schoolOS bashrc bydefault..


OR Better in this way - because aptitude search only in package name...

apt-get-search() {
dpkg --get-selections | sed -ne 's/\t\t*install$//p' > /tmp/ListInstalled
apt-cache search $1 | cut -d" " -f1 | sort > /tmp/ListMatched
cat /tmp/ListInstalled /tmp/ListMatched | sort | uniq -d > /tmp/ListInstalledFromSearch
diff /tmp/ListInstalledFromSearch /tmp/ListMatched | grep ">" | cut -d" " -f2 > /tmp/ListAvailable
for i in $(cat /tmp/ListAvailable); do aptitude search $i; done
}

If you know any better  method to do then let us know..
Thanks


Reply all
Reply to author
Forward
0 new messages