Search Linux Apps without Fluff

Thought I’d try this while messing around in the repos on my PeppermintOS 7 installation of Linux, or GNU/Linux, if you prefer. I found it useful, because I was sick of browsing through the repositories only to find fluff after fluff.

Using wc -l at the end shows 9,691 which is still pretty sizable. I’m sure quite a few are being filtered out, unfortunately, but I can’t think of a way to avoid that at the moment. I’m quite happy with this many for now!

apt-cache search " " | sed '/[a-z;0-9]-/d; s/ - /£/' | column -t -s £ | sort | less

If you want to see only the package names on one column:

apt-cache search " " | sed '/[a-z;0-9]-/d; s/ - /£/' | awk -F "£" '{print $1}d' | less

This one could be a good base to use for searching. So, you could add this function to your .bashrc for more user-friendly searches:

function acs(){
read -p "Package name to search for: " package_search
apt-cache search " " | sed '/[a-z;0-9]-/d; s/ - /£ /' | awk -F "£" '{print $1}d' | grep "$package_search"
return
}

The 2nd line within that function, replace it with the following line if you want to see the descriptions as well:

apt-cache search " " | sed '/[a-z;0-9]-/d; s/ - /£/' | column -t -s "£" | grep "$package_search"

Yeah, so some of that isn’t exactly necessary, but I like playing around with this stuff and getting a layout that appeals to me.

I’m not sure what this will and won’t work on, so you’ll have to just give it a try. It probably will only work on Ubuntu-based installations, however. I’m using bash 4.3.46(1)-release, if that helps at all.

Let me know if you find this useful.

Keep up to date with Taut with Thought’s Twitter page!
https://twitter.com/tautwiththought

Advertisements