How To Use apt-mark Command In Linux?
 

How To Use apt-mark Command In Linux?

 

On different distributions of Linux that use apt as the default package manager, apt-mark can be used to show, set, unset various settings of a package.

The apt-mark can be used to perform various advanced administrative tasks such as it can mark a package as it is being automatically or manually installed.

It can also be used to change the dpkg selection states such as hold, install, deinstall, or purge a package. In this article, we will see more about the apt-mark and its usage with examples.

Different mark on a package

The apt-mark can be used to change various settings of a software package on a system. These settings are also known as “marks” and fall into three given categories –

auto

When you request to install a package some other packages also get downloaded and installed to satisfy the dependencies of that package. The packages that get downloaded when you request to install a package will be marked as automatically installed packages.

manual

The requested package will be marked as a manually installed package. The apt and aptitude will start suggesting to remove automatically installed packages when you remove this package.

hold

No operations can be performed on a package if it is marked hold. The package can not be installed, removed, or upgraded unless you remove the hold mark.

Package selection states

A package in Linux can have the following selection states –

install – The package is marked for installation.

deinstall – The package is marked for removal.

purge – The package is marked for removal along with the dependencies

hold – The package can not be installed, removed, or upgraded until the hold mark is removed.

Examples of using apt-mark

A few examples and usages of apt-mark command in Linux is given below –

Disable or lock a package

The apt-mark command can be used with option hold to prevent a package from installation, removal, or up-gradation. For example to mark the package nginx-core hold, use the following command in your terminal –

apt-mark hold nginx-core

To make this package available for installation, removal, or up-gradation, use –

apt-mark unhold nginx-core

Display the list of manually installed packages

To display the list of manually installed packages on a system, use the following command –

apt-mark showmanual

Display the list of automatically installed package packages

It is similar to the showmanaul option but it prints the list of automatically installed packages on a system, Now to display the list of automatically installed packages use the following command in your system –

apt-mark showauto

Conclusion

Ok, that’s all for now. I hope this gives you an understanding of how to manipulate packages using the apt-mark command in Linux. Now if you have questions on this you can leave in the comments below.

Previous [ubuntu] Can't connect USB drive to VM
Next How To Find IP Address In Linux Using Terminal?
 

About author

You might also like

Linux Terminal 0 Comments

How To Change Username In Linux/Unix From The Terminal?

This post was last updated on August 1st, 2020 at 03:04 pmIn a Linux/Unix system sometimes you may need to change the username or User ID (UID) of a user

Linux Topics 0 Comments

How To Find IP Address From Domain Name In Linux/Unix?

This post was last updated on August 1st, 2020 at 03:35 pmBefore we start running a command to find the IP addresses from the domain name. First, we will discuss

Linux Topics 0 Comments

How To Setup FTP Server In Linux/Unix?

This post was last updated on August 2nd, 2020 at 08:10 pmFTP is the short form of File Transfer Protocol. It is a standard networking protocol used to transfer files

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply