• 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. What is umask in UNIX/Linux
  2. a2disconf Command Examples in Linux
  3. wall: command not found
  4. gdebi: command not found
  5. efibootmgr Command Examples in Linux
  6. How to Disable user list on GNOME login screen in CentOS/RHEL 8
  7. How to use the “screen” command in Linux
  8. resolveip Command Examples in Linux
  9. rtcwake Command Examples in Linux
  10. pvs Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • ctags: Generates an index (or tag) file of language objects found in source files for many popular programming languages
  • csvtool: Utility to filter and extract data from CSV formatted sources
  • csvstat: Print descriptive statistics for all columns in a CSV file
  • csvsql: Generate SQL statements for a CSV file or execute those statements directly on a database

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright