🖥️apt-get
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the apt-get command with important options and switches using examples.
7 minute read
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# █████╗ ██████╗ ████████╗ ██████╗ ███████╗████████╗
# ██╔══██╗██╔══██╗╚══██╔══╝ ██╔════╝ ██╔════╝╚══██╔══╝
# ███████║██████╔╝ ██║█████╗██║ ███╗█████╗ ██║
# ██╔══██║██╔═══╝ ██║╚════╝██║ ██║██╔══╝ ██║
# ██║ ██║██║ ██║ ╚██████╔╝███████╗ ██║
# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝
# Desc: Allows to update the operating system
# To fetch package list
apt-get update
# To download and install updates without installing new package.
apt-get upgrade
# To download and install the updates AND install new necessary packages
apt-get dist-upgrade
# Full command:
apt-get update && apt-get dist-upgrade
# To install a new package(s)
apt-get install package(s)
# Download a package without installing it. (The package will be downloaded in your current working dir)
apt-get download modsecurity-crs
# Change Cache dir and archive dir (where .deb are stored).
apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ...
# Show apt-get installed packages.
grep 'install ' /var/log/dpkg.log
# Silently keep old configuration during batch updates
apt-get update -o DPkg::Options::='--force-confold' ...
#==============================##==============================#
# CMD APT-GET Packetverwaltung #
#==============================##==============================#
apt-get install gpm
# installieren, um auch mit der Maus arbeiten zu können.
apt-get build-dep ffmpeg
# The below command will build the dependency, automatically during the corresponding package installation. Hence the process of package installation is very much fluent and easy.
apt-get update && apt-get install -qqy --force-yes openssh-server
# Install openssh-server
apt-get update
# How to Update System Packages - The ‘update‘ command is used to resynchronize the package index files from the their sources specified in /etc/apt/sources.list file. The update command fetched the packages from their locations and update the packages to newer version.
apt-get upgrade
# How to Upgrade Software Packages - The ‘upgrade‘ command is used to upgrade all the currently installed software packages on the system. Under any circumstances currently installed packages are not removed or packages which are not already installed neither retrieved and installed to satisfy upgrade dependencies.
apt-get dist-upgrade
# However, if you want to upgrade, unconcerned of whether software packages will be added or removed to fulfill dependencies, use the ‘dist-upgrade‘ sub command.
apt-get install netcat
# How Do I Install or Upgrade Specific Packages? - The ‘install‘ sub command is tracked by one or more packages wish for installation or upgrading.
apt-get install nethogs goaccess
# How I can Install Multiple Packages? - You can add more than one package name along with the command in order to install multiple packages at the same time. For example, the following command will install packages ‘nethogs‘ and ‘goaccess‘.
apt-get install '*name*'
# How to Install Several Packages using Wildcard - With the help of regular expression you can add several packages with one string. For example, we use * wildcard to install several packages that contains the ‘*name*‘ string, name would be ‘package-name’.
apt-get install packageName --no-upgrade
# How to install Packages without Upgrading - Using sub ‘–no-upgrade‘ command will prevent already installed packages from upgrading.
apt-get install packageName --only-upgrade
# How to Upgrade Only Specific Packages - The ‘–only-upgrade‘ command do not install new packages but it only upgrade the already installed packages and disables new installation of packages.
apt-get install vsftpd=2.3.5-3ubuntu1
# How Do I Install Specific Package Version? - Let’s say you wish to install only specific version of packages, simply use the ‘=‘ with the package-name and append desired version.
apt-get remove vsftpd
# How Do I Remove Packages Without Configuration - To un-install software packages without removing their configuration files (for later re-use the same configuration). Use the ‘remove‘ command as shown.
apt-get purge vsftpd
# How Do I Completely Remove Packages - To remove software packages including their configuration files, use the ‘purge‘ sub command as shown below.
apt-get remove --purge vsftpd
# Alternatively, you can combine both the commands together as shown below.
apt-get clean
# How I Can Clean Up Disk Space - The ‘clean‘ command is used to free up the disk space by cleaning retrieved (downloaded) .deb files (packages) from the local repository.
apt-get --download-only source vsftpd
# How Do I Download Only Source Code of Package - To download only source code of particular package, use the option ‘–download-only source‘ with ‘package-name’ as shown.
apt-get source vsftpd
# How Can I Download and Unpack a Package - To download and unpack source code of a package to a specific directory, type the following command.
apt-get --compile source goaccess
# How Can I Download, Unpack and Compile a Package - You can also download, unpack and compile the source code at the same time, using option ‘–compile‘ as shown below.
apt-get download nethogs
# How Do I Download a Package Without Installing - Using ‘download‘ option, you can download any given package without installing it. For example, the following command will only download ‘nethogs‘ package to current working directory.
apt-get changelog vsftpd
# How Do I Check Change Log of Package? - The ‘changelog‘ flag downloads a package change-log and shows the package version that is installed.
apt-get check
# How Do I Check Broken Dependencies? - The ‘check‘ command is a diagnostic tool. It used to update package cache and checks for broken dependencies.
apt-get build-dep netcat
# How Do I Search and Build Dependencies? - This ‘build-dep‘ command searches the local repositories in the system and install the build dependencies for package. If the package does not exists in the local repository it will return an error code.
apt-get autoclean
# How I Can Auto clean Apt-Get Cache? - The ‘autoclean‘ command deletes all .deb files from /var/cache/apt/archives to free-up significant volume of disk space.
apt-get autoremove vsftpd
# How I Can Auto remove Installed Packages? - The ‘autoremove‘ sub command is used to auto remove packages that were certainly installed to satisfy dependencies for other packages and but they were now no longer required. For example, the following command will remove an installed package with its dependencies.
apt-get upgrade | tee upgrade-$( date +%F ).log
# Do an apt upgrade and save a copy of the output to a current dated filename.
apt-get build-dep netcat
# How Do I Search and Build Dependencies? - This ‘build-dep‘ command searches the local repositories in the system and install the build dependencies for package. If the package does not exists in the local repository it will return an error code.
apt-get autoclean
# How I Can Auto clean Apt-Get Cache? - The ‘autoclean‘ command deletes all .deb files from /var/cache/apt/archives to free-up significant volume of disk space.
apt-get autoremove vsftpd
# How I Can Auto remove Installed Packages? - The ‘autoremove‘ sub command is used to auto remove packages that were certainly installed to satisfy dependencies for other packages and but they were now no longer required. For example, the following command will remove an installed package with its dependencies.
apt-get upgrade | tee upgrade-$( date +%F ).log
# Do an apt upgrade and save a copy of the output to a current dated filename.
apt-get install ifuse
ifuse /media/iPad
cp -v /media/iPad/DCIM/100APPLE/IMG*MOV /target
# mnt iPad filesystem.
apt-get upgrade | tee upgrade-$( date +%F ).log
# Do an apt upgrade and save a copy of the output to a current dated filename.
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command apt-get in a clear format. This allows users to quickly access the needed information for apt-get without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for apt-get are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.