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.
apt-get [option] command
apt-get [options] install|remove package1 [package2 ...]
apt-get [options] source package1 [package2 ...]
Most Commonly Used apt-get Commands
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.
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.
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.
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.
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]
This command uninstalls the packages as well as any registry files associated with them.
apt-get purge [...PACKAGES]
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]
This apt-get command scans for damaged dependencies and updates the module cache.
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.
The required binary module is downloaded into the root folder with this instruction.
apt-get download [...PACKAGES]
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.
- 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]
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]
The user defines that apt-get can seek to fix the code with failed dependency by executing this command.
apt-get -f [...COMMAND]
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.
- 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]
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]
Apt-get presumes ‘no' for all suggestions after this command is executed.
apt-get --assume-no [...COMMAND]
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]
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]
This command causes apt-get to just update the programs that are already loaded, rather than installing new ones.
apt-get --only-upgrade [...COMMAND]
If you use this option, apt-get will not update modules that have already been loaded.
apt-get --no-upgrade [...COMMAND]
This command forces apt-get to reinstall all previously installed modules for their most recent versions.
apt-get --reinstall [...COMMAND]
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]
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.