Linux чем отличается apt от apt get

Difference Between apt and apt-get Explained

This article explains the difference between apt and apt-get commands of Linux. It also lists some of the most commonly used apt commands that replace the older apt-get commands.

One of the noticeable features introduced on Ubuntu 16.04 was the ‘introduction’ of apt command. The reality is that the first stable version of apt was released in the year 2014, but people started noticing it in 2016 with the release of Ubuntu 16.04. It became common to see apt install package instead of the usual apt-get install package . Eventually, many other distributions followed Ubuntu’s footsteps and started to encourage users to use apt instead of apt-get. You might be wondering what’s the difference between apt-get and apt? And if they have a similar command structure, what was the need for the new apt command? You might also be thinking, if apt is better than apt-get, should you use the new apt command or stick with the good old apt-get commands? I’ll explain all these questions in this article and I hope that by the end of this article, you’ll have a clearer picture.

Just a quick word for Linux Mint users. A few years ago, Linux Mint implemented a Python wrapper called apt that actually uses apt-get but provides more friendly options. This apt which we are discussing here is not the same as the one in Linux Mint.

Before we see the difference between apt and apt-get, let’s go into these commands’ backdrop and what they try to achieve.

Why was apt introduced in the first place?

Debian, the mother of distributions like Ubuntu, Linux Mint, elementary OS etc., has a robust packaging system; every component and application is built into a package installed on your system. Debian uses a set of tools called Advanced Packaging Tool (APT) to manage this packaging system. Don’t confuse it with the command apt, it’s different. Various tools interact with APT and allow you to install, remove and manage packages in Debian based Linux distributions. apt-get is one such command-line tool that is widely popular. Another popular tool is Aptitude with both GUI and command-line options. If you have read my guide on apt-get commands, you might have come across several similar commands, such as apt-cache. And this is where the problem arises. You see, these commands are way too «low-level», and they have so many functionalities which are perhaps never used by an average Linux user. On the other hand, the most commonly used package management commands are scattered across apt-get and apt-cache. The apt commands have been introduced to solve this problem. apt consists of some of the most widely used features from apt-get and apt-cache, leaving aside obscure and seldom-used features. It can also manage apt.conf file. With apt, you don’t have to fiddle your way from apt-get commands to apt-cache. apt is more structured and provides the user with the necessary options needed to manage packages.

Читайте также:  Linux find files by regex

Difference between apt and apt-get

So with apt, you get all the necessary tools in one place. You won’t be lost under tons of command options. The main aim of apt is to provide an efficient way of handling package in a way “pleasant for end users”. When Debian says “pleasant for end users”, it actually means that. It has fewer but sufficient command options but in a more organized way. On top of that, it enables a few options by default that are actually helpful for the end users.

Progress bar

apt command has a progress bar

For example, you see the progress bar while installing or removing a program with apt command.

Listing upgradable packages by default

apt also prompts you with the number of packages that can be upgraded when you update the repository database. You can achieve the same with apt-get as well if you use additional command options. apt enables them by default and takes the pain away.

Kernel upgrades

Another difference is how the ‘upgrade’ option behaves in the two commands. In apt-get, the upgrade option cannot install new packages on its own:

under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed

New packages will be installed if required to satisfy dependencies, but existing packages will never be removed

apt-get upgrade doesn

What’s the big deal you ask? Well, it means that when you run apt upgrade , it can upgrade the Linux kernel. apt-get upgrade cannot do that. Why? Because even though you are upgrading an installed Linux kernel version, you actually install a new Linux kernel (whose package name is different). And thus to the system, it is like installing a new package that was not already installed. As I stated from the man page of apt-get command, the upgrade option cannot install a new package and hence it cannot upgrade the kernel version. To upgrade the kernel with apt-get, you’ll have to use the dist-upgrade option. This is another example of the user-friendliness of the apt command over the apt-get command.

Difference between apt and apt-get commands

While apt does have some similar command options as apt-get, it’s not backward compatible with apt-get. That means it won’t always work if you just replace the apt-get part of an apt-get command with apt. Let’s see which apt command replaces which apt-get and apt-cache command options.

apt command The command it replaces Function of the command
apt install apt-get install Installs a package
apt remove apt-get remove Removes a package
apt update apt-get update Refreshes repository index
apt upgrade apt-get upgrade Upgrades all upgradable packages
apt autoremove apt-get autoremove Removes unwanted packages
apt full-upgrade apt-get dist-upgrade Updates packages with auto-handling of dependencies
apt search apt-cache search Searches for the program
apt show apt-cache show Show package details

apt has a few commands of its own as well.

New apt command Function of the command
apt list List packages woth criteria (Installed, upgradable, etc.)
apt edit-sources Edit sources list

One point to note here is that apt is under continuous development. So you may see a few new options added to the command in the future versions. If you are interested in learning more, I recommend reading my guide that shows how to use apt commands with examples.

Читайте также:  Linux bash environment file

Is apt-get deprecated?

I didn’t find any information that says that apt-get will be discontinued. And it actually shouldn’t be. It still has a lot more functionalities to offer than apt. For low-level operations like scripting, developing CLI tools that deal with APT packaging etc, apt-get will still be used.

Should you use apt or apt-get?

You might be thinking if you should use apt or apt-get. And as a regular Linux user, my answer is to go with apt. apt is the command that is recommended by the Linux distributions. It provides the necessary option to manage the packages. Most important of all, it is easier to use with its fewer but easy to remember options. I see no reason to stick with apt-get unless you are going to do specific operations that utilize more features of apt-get.

Conclusion

Donate Itsfoss

I hope I was able to explain the difference between apt and apt-get. In the end, to summarize the apt vs apt-get debate:

  • apt is a subset of apt-get and apt-cache commands providing necessary commands for package management
  • While apt-get won’t be deprecated, as a regular user, you should start using apt more often

So what do you think? Are you already using apt or do you want to stick with the good old apt-get? Share your views in the comment section below.

Источник

apt vs apt-get – Advanced Package Tool

If you’ve ever used Debian Linux or one of the many Linux distributions that were derived from it, such as Ubuntu, you may have seen the apt and apt-get commands sprinkled throughout the distro’s documentation.

At surface level, these commands seem interchangeable, and a lot of documentation or online guides throw them around as if they are. However, there are some key differences between the two and we have some recommendations about which one you should be using. In this guide, we’ll explain the differences and give some examples for both commands. Read on to learn about the specific uses for each command and which one is better for you to use.

In this tutorial you will learn:

  • What distros use apt and apt-get?
  • What is the difference between apt and apt-get?
  • Command examples for apt and apt-get

apt vs apt-get

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian Linux and most derivatives
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

What distros use apt and apt-get?

Debian and Ubuntu are probably the most notable Linux distros that use APT (Advanced Package Tool) software which contains the apt and apt-get commands, among others, that you are used to seeing. There are a lot of other distros that are based on Debian, and most of those also use APT.

When describing the differences between these two commands, mileage may vary depending on which distro you’re using. For example, Linux Mint has its own variation of the apt command, which is actually just a wrapper that utilizes apt-get and includes some additional functionality. Other distro developers may come up with their own tweaks, so when we’re discussing apt and apt-get in this article, we’re specifically talking about its implementation on Debian and Ubuntu.

Читайте также:  Как обновить jre linux

What is the difference between apt and apt-get?

To put it simply, apt is the command meant for the Linux user, and apt-get is the command meant for system use. In technical terms, this means that apt provides a high level interface for package management and apt-get provides a low level interface.

The two commands basically perform the same functions, but apt is easier to use and has some user friendly features, like a status bar to show the progress as packages are installed. Since apt is designed for a Linux user, it doesn’t cause much fuss when developers update it or introduce their own implementations of it. Only the user is affected. On the other hand, apt-get receives fewer updates and needs to remain backward compatible. System functions and scripts rely on the predictability of apt-get .

So, that explains why both commands are necessary. Confusion arises because the commands look and function mostly the same, and apt was only introduced on Ubuntu in 2014. You’ll still find old documentation and guides that tell the user to execute apt-get commands to install packages, since that’s what was used. Furthermore, some users from back then are still stuck in that habit and may not have migrated over to using apt .

As an average Linux user, you should use apt when you’re installing packages or updating your system, etc. If you’re a developer, apt-get is what you’ll use in the scripts or programs you create.

Using the apt command on Ubuntu, a Debian based system

Command examples for apt and apt-get

As you can see from the table below, the two commands mostly do the same thing but have a slightly different syntax. apt combines the functions from both apt-get and apt-cache , as well as providing a more convenient user interface and additional command line options.

apt apt-get / apt-cache Description
apt install apt-get install Install a package
apt update apt-get update Update all repository info
apt upgrade apt-get upgrade Update all installed packages
apt autoremove apt-get autoremove Remove packages that are no longer needed
apt remove apt-get remove Remove an installed package
apt purge apt-get purge Remove an installed package and delete configuration files
apt search apt-cache search Seach repositories for a package
apt show apt-cache show Show details for a package

These are just the most common ones. You can see more by checking the man pages for each command:

Since apt-get is required to remain backward compatible and predictable, the commands above will likely never change. On the other hand, apt is continually developed. New options or changes may occur to apt in the future, especially as different distros add their own changes to it.

Closing Thoughts

In this guide, we learned about the differences between apt and apt-get . To summarize, apt is the user-side replacement for apt-get . Both commands are relevant and will continue to exist, since one is ideal for high level functions and the other one for low level.

Источник

Оцените статью
Adblock
detector