en
  English
Phone :  +370 (5) 204-1903
Email: sales@1gbits.com
  1. Dedicated server
  2. Blog
  3. Complete guide on using apt get command

Complete guide on using apt get command

APT (Advanced Package Tool) is the most effective user interface that allows users to install and remove software applications in various popular Linux distributions, including Ubuntu, Debian. It can be used for simple interaction with the dpkg packaging framework. Also, APT efficiently manages dependencies, retains huge configuration files, and upgrades/downgrades packages to ensure the reliability of the system.

Linux Tutorial May 18, 21 by Nisal N 8 min Read
Complete guide on using apt get command

Application of apt-get Commands

The apt-get command allows dealing with various software packages on a Linux distro. By using different apt-get commands, one can find, install, upgrade, and uninstall a package on their system. It is extremely important to keep packages up-to-date because outdated packages can lead to security problems on the system and apt-get commands can help do that quite conveniently.

Apt-get requires administrator (super-user) access since it covers key device elements, so prefix most commands with "sudo" in Ubuntu or Ubuntu-based Linux distributions.

Apt-get Command Syntax

In Linux, apt-get is a command-line utility that assists with package management. Its primary function is to download information and packages from trusted sources in order to add, update, and remove packages and their dependencies. The Advanced Package Tool is abbreviated as APT.

Syntax:

apt-get [option] command

or

apt-get [options] install|remove package1 [package2 ...]

or

apt-get [options] source package1 [package2 ...]

Most Commonly Used apt-get Commands

  • Update

This command is used to restore synchronization with the index files of the package and their origins. Prior to the upgrade or dist-upgrade, you must first execute an update.

apt-get update

  • Upgrade

Updates the user's computer with the most updated versions of the modules currently installed from the mentioned sources in /etc/apt/sources.list. The module that is already loaded and has new upgrades available is recovered and installed. Until upgrading, you must run an update to let apt-get know that new versions of modules are accessible.

apt-get upgrade

  • Dist-upgrade

This command executes an update and even manages the change in dependencies due to new package versions. The apt-get command may attempt to update critical packages at the cost of less important packages, if possible. While executing this command, it's possible that certain packages will get removed.

apt-get dist-upgrade

  • Dselect-upgrade

This is used in conjunction with the dselect Debian packaging tool. It monitors dselect's modifications to the status area of available packages and takes any actions required to achieve that condition.

apt-get dselect-upgrade

  • Install

This command is used to install new packages on the system. It's accompanied by the names of one or more packages that users need to install. Also, users can specify a particular version of the package to be installed by adding an equals sign after the package name followed by the version number. A forward slash after the package name and the version or folder name (e.g. ‘stable', ‘testing', or ‘unstable') allows the user to pick a certain distribution. Both of these methods of version collection have the ability to downgrade packages, so they should be used with caution.

apt-get install [...PACKAGES]

  • Purge

This command uninstalls the packages as well as any registry files associated with them.

apt-get purge [...PACKAGES]

  • Remove

This is equivalent to install, with the exception that instead of downloading, it removes the packages. It does not necessarily delete all of the package's setup files.

apt-get remove [...PACKAGES]

  • Check

This apt-get command scans for damaged dependencies and updates the module cache.

apt-get check

  • Clean

This command is used to exclude all recovered package files from the local registry. It deletes everything from /var/cache/apt/archives/partial/ and /var/cache/apt/archives/ except the lock file.

apt-get clean

  • Download

The required binary module is downloaded into the root folder with this instruction.

apt-get download [...PACKAGES]

  • Autoremove

When packages that are installed manually to fulfill the requirements of other modules are no longer required, the autoremove function is used to uninstall them.

apt-get autoremove

  • Install suggests

By executing this command, the user instructs apt-get to accept suggested modules as installation requirements.

apt-get --install-suggests  [...COMMAND]

  • No install recommends

The user tells apt-get not to accept suggested packages as a prerequisite to installation by using this command.

apt-get --no-install-recommends [...COMMANDS]

  • Download-only

This command tells system assigns that apt-get can only download the files and does not have the authority to unpack or install them.

apt-get -d [...COMMAND]

  • Fix-broken

The user defines that apt-get can seek to fix the code with failed dependency by executing this command.

apt-get -f [...COMMAND]

  • No-download

By executing this command, the user deactivates the download for apt-get. It can just use the .deb files that are already downloaded on the system.

apt-get  [...COMMAND]

  • Ignore-missing or fix-missing

With this command, the user defines that apt-get can disregard lacking modules (packages that can't be recovered or fail the validation process) and manage the consequence.

apt-get -m [...COMMAND]

  • Quiet:

When you use this command, apt-get generates output that is appropriate for logging.

apt-get -q [...COMMAND]

  • Yes or assume-yes

Occasionally, the apt-get command will ask the user for a yes or no answer. This command allows apt-get to presume ‘yes' for all requests and operate without user intervention.

apt-get -y [...COMMAND]

  • Simulate or just-print or dry-run or recon or no-act 

This apt-get command states that no action be taken and that a simulation of events that will arise depending on the existing system should be run, except that the system should not be changed.

apt-get -s [...COMMAND]

  • Assume-no 

Apt-get presumes ‘no' for all suggestions after this command is executed.

apt-get --assume-no [...COMMAND]

  • No-show-upgraded

This command prevents apt-get from displaying a list of all modules that need to be updated.

apt-get --no-show-upgraded [...COMMAND]

  • V or verbose versions

Apt-get can display complete versions of updated and activated packages if this command is run.

apt-get -V [...COMMAND]

  • Show-progress

As modules are added, disabled, or updated, apt-get can display user-friendly progression in the terminal window with this command.

apt-get --show-progress [...COMMAND]

  • Compile or build

Apt-get can compile/build the root modules it installs if this choice is selected.

apt-get -b [...COMMAND]

  • Only-upgrade

This command causes apt-get to just update the programs that are already loaded, rather than installing new ones.

apt-get --only-upgrade [...COMMAND]

  • No-upgrade

If you use this option, apt-get will not update modules that have already been loaded.

apt-get --no-upgrade [...COMMAND]

  • Reinstall

This command forces apt-get to reinstall all previously installed modules for their most recent versions.

apt-get --reinstall [...COMMAND]

  • Auto-remove

This command is similar to getting the autoremove function while using apt-get with the update or delete option.

apt-get install/remove --autoremove [...PACKAGES]

Conclusion

The apt-get command in Linux is a utility management package whose job is to download packages from sites that are trusted to the operating system. The Advance Package tools come with a number of commands and utilities which may help to perform the required task. Hence knowing the function of each and every command is an important factor to have a command over apt-get.

author img

Nisal N

Computers has always fascinated me since I was a kid and here we are. I love travelling for 2 reasons: the first one to see a new part of the world and second (the most important one) to experience the rich culture hidden among the country and people. I'm pretty good at cooking but very poor when it comes to baking.

Leave A Comment