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

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 manage your startup apps in Ubuntu

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:   Which one is the best for you?

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.


Is this article useful?

s.parentNode.insertBefore(t,s)}(window, document,’script’,
fbq(‘init’, ‘400239050508508’);
fbq(‘track’, ‘PageView’);


More Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed