How to search for packages in the terminal with Apt and Apt-Get

Linux users still want to issue terminal commands for new packages, but for starters, how is someone supposed to know the names of these packages? Once pointed out, it’s actually very simple. This tutorial will show you how to search for packages in the terminal for systems based on Ubuntu and Debian with apt and apt-get.

Ubuntu and Apt

In recent years, Ubuntu has simplified and improved some of the heaviest Debian commands. the apt-get and apt-cache commands involved unnecessary input and were shortened by apt, which performs the actions of both. To search for something in your repository, just use apt with the word search, followed by your search term. Suppose you want to search for golf games – you can search your repository just by entering:

Apt will display a list of all relevant search results, searching for both the names and descriptions of the packages. With apt, package names will be highlighted in color to help differentiate them from other descriptive texts.

Apt Ubuntu Apt Search Golf

In our research on golf, one of the available packages was kolf, so we will use it as a package for the following examples.

To install packages with apt, you simply replace the search with install, followed by the name of your package. However, installing packages requires superuser privileges, which on an Ubuntu system use sudo. The sudo command goes to the start of a terminal line, so on an Ubuntu system you would install kolf by entering:

Old Debian systems

Instead of the new simplified apt command, older versions of Debian use apt-cache to look for. It always works the same way as apt. To search for golf again, the command would be:

Apt Debian Apt Cache SearchApt Debian Apt Cache Search

However, the information provided is less complete than with apt, as shown in this screenshot.

Apt Vs Apt CacheApt Vs Apt Cache

Note that although the Debian apt-get commands work with Ubuntu, the simplified apt commands of Ubuntu may not work with Debian, depending on the age of your version. It’s worth trying the Ubuntu style apt command first, as it comes with additional color formatting and coding.

READ:   How to avoid accidental voice purchases with Amazon Alexa

If sudo is configured on your system, to install kolf, you must enter:

However, in Debian inventory, your user may not be automatically added to the sudoers list, which means that you will need to use root instead. It is however easy. If you’ve never used root before, just enter:

enter the root password, then enter your commands, minus the sudo part.

Notice the change in $ has a # – a root prompt. Do not stay at the root longer than necessary, as this allows full access to the system and you could damage something. hurry Ctrl + re or type exit to log out of root when you’re done.

Extension of your use

What if the information provided by apt search is not enough? And if you want to go into details? Once you know the name of your package, you can use apt show to give you more information, including details such as the project website or whether there are dependency conflicts. Keeping the example of kolf, the command is as follows:

Compare and contrast the output of kolf…

Apt Debian KolfApt Debian Kolf

with the release for Neverputt.

Debian Neverputt aptDebian Neverputt apt

If you choose between the two packages, neverputt would be the least likely package to cause problems for your repository system.

For the old Debian equivalent, the command is:

A very common scenario: you use an old-fashioned terminal that doesn’t allow you to scroll through an extended text list, leaving you stuck at the bottom. In this scenario, you can just use a pipe (this is the | symbol) to send the output to a text reader like less. To extend the kolf example in this way, it looks like this:

READ:   How to easily change the Grub background with Grub Customizer

You can now browse the output simply by using the arrow keys, and you can exit by pressing Q. You can also use this channel method for proper search, but be aware that you will lose all of its fancy color coding on package names.

Apt channeled outletApt channeled outlet

Now that you know how to search for packages in the terminal, are your packages out of order? Does Ubuntu generate far too many error messages? See our guide to cleaning Ubuntu.

Related:

Is this article useful?

!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=’2.0′;
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,’script’,
‘https://connect.facebook.net/en_US/fbevents.js’);
fbq(‘init’, ‘400239050508508’);
fbq(‘track’, ‘PageView’);

Leave a Reply