• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

apt-mark Command Examples in Linux

by admin

apt-mark is a command-line utility that is part of the apt package manager in Linux distributions that use the Debian package management system, such as Ubuntu and Debian itself. It allows you to mark packages as manually installed or automatically installed, and to list the packages that are currently marked as manually installed.

The apt package manager is responsible for installing, updating, and removing packages on a Debian-based system. When you install a package with apt, it is marked as automatically installed. This means that if you later decide to remove the package with apt, the package manager will also remove any other packages that were installed as dependencies of that package, even if they are no longer needed by any other installed packages.

The apt-mark command can be used to override this behavior and mark a package as manually installed. This can be useful if you have installed a package that is not available in the default repositories, or if you have removed a package that was installed as a dependency of another package but you want to keep it on the system. When a package is marked as manually installed, apt will not automatically remove it when you remove the package that depends on it.

apt-mark Command Examples

1. Mark a package as automatically installed:

# apt-mark auto {{package_name}}

2. Hold a package at its current version and prevent updates to it:

# apt-mark hold {{package_name}}

3. Allow a package to be updated again:

# apt-mark unhold {{package_name}}

4. Show manually installed packages:

# apt-mark showmanual

5. Show held packages that aren’t being updated:

# apt-mark showhold

6. To mark a package as manually installed:

# apt-mark markmanual package-name

7. To check if a particular package is marked as manually installed:

# apt-mark showmanual package-name
Note: Note that apt-mark only works with installed packages. If you try to mark a package that is not installed as manually installed, it will not have any effect.

Filed Under: Linux

Some more articles you might also be interested in …

  1. mpg123 Command Examples in Linux
  2. dig Command Examples in Linux
  3. How to Find the Original Installation OS Version in CentOS/RHEL
  4. How to grep with color output
  5. bat Command Examples in Linux
  6. How to use compress, zip, gzip commands under Linux
  7. How to enable md5 Hashing in Linux
  8. a2dismod: command not found
  9. CentOS / RHEL : How to disable BASH shell history
  10. How to use auditd to monitor a file deletion in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright