Today we’ll learn how to search with apt. There are any number of reasons why you’d want to do this. You can use this to find applications by name or subject. Maybe you want to find files that meet a certain criteria? It could be that you’ve forgotten the name of the application you’re thinking of? Perhaps you want to know if an application is available in the repositories before you go seeking it elsewhere?
There are all sorts of reasons, including those, why you might want to search with apt. Obviously, this requires an operating system that uses apt, so that limits you to things like Debian, Ubuntu, official Ubuntu flavors, Linux Mint, etc… So, well, it’s a pretty sizable number of distros where this will work.
This will be a pretty simple article. It will also be pretty brief. I’ve likely mentioned searching in another apt article, but it’s important that we cover it. Alas, I’m running out of things that make for longer articles (in the notes I’m working from), so this is just another article where I’m trying to make you aware that certain tools exist.
This should absolutely be a short and easy to understand article. In some recent commentary, I realized that what’s ‘simple’ to me is something that someone else has been dealing with for the past year. Even my easier articles have the chance to help people figure out their Linux problems. Good… It makes me feel better when I write an ‘easy’ article.
So, with all that said… Let’s learn how to:
Search With apt:
This article pretty much requires an open terminal, like oh so many other articles on this site. If you don’t know how to open the terminal, and you should by now – if you’ve been following along long enough, you can do so with your keyboard – just press
Now, it should go without saying, apt is how you interact with your package manager. It’s how you install, uninstall, or otherwise manage your software in the terminal. You could insist on using a GUI to install software, in which case this won’t be of much interest to you, or you could just do it all in the terminal. Either way, if you are using a different package manager then this will be of no value to you.
Me? I prefer to do this sort of stuff in the terminal because I find it easier and faster. I’ve already got a terminal open anyhow, so I might as well use it.
Anyhow, with your terminal open, go ahead and type:
apt-cache search <search_term>
apt-cache search text editor
Seriously, if you’ve never used the search function, go ahead and try the above command. You might be surprised by what you find.
Now, if you’re trying to narrow it down some, you can use the –names-only flag. Which isn’t as accurate as it could be. For example, try:
apt-cache search --names-only terminal
But, as near as I can tell, that’s searching not just the names but also searching the one-liner description. Like, if you run the above command you’ll also see ‘terminator’, which is definitely not ‘terminal’.
However ‘terminator’ includes ‘terminal’ in the description. So, I’m not sure where that’s going with that and the man pages weren’t all that helpful. You can also use RegEx (Regular Expressions, for the uninitiated). For example, you can run:
apt-cache search --names-only google.+chrome
This, of course, only works if you have Google’s Chrome repositories enabled. Otherwise, pick something else to test this with. Or, just trust me when I say RegEx works, which the man page will confirm.
Anyhow, our example command from above would (on this computer) would have an output that looks like this:
~/Downloads$ apt-cache search --names-only google.+chrome
google-chrome-beta - The web browser from Google
google-chrome-stable - The web browser from Google
google-chrome-unstable - The web browser from Google
Which, as you can see, means I have multiple versions of Chrome available. So, that’s something positive in my life! But, the point is, I did a search with apt and came away with the information I wanted. I’d normally send you to the application’s man page, but in that probably won’t make it all that much clearer.
Yeah, that’s it. You can now search with apt and find what you’re looking for. Use some of your own search terms, like
apt-cache search image editor, and see what sorta results you get. It’s not the most refined, but it’s an effective way to search with apt.
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.