🖥️apt

➡️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 command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                 █████╗ ██████╗ ████████╗
#                ██╔══██╗██╔══██╗╚══██╔══╝
#                ███████║██████╔╝   ██║   
#                ██╔══██║██╔═══╝    ██║   
#                ██║  ██║██║        ██║   
#                ╚═╝  ╚═╝╚═╝        ╚═╝   
                                         
                                         

# To search a package:
apt search package

# To show package informations:
apt show package

# To fetch package list:
apt update

# To download and install updates without installing new package:
apt upgrade

# To download and install the updates AND install new necessary packages:
apt dist-upgrade

# Full command:
apt update && apt dist-upgrade

# To install a new package(s):
apt install package(s)

# To uninstall package(s)
apt remove package(s)

# Packete liegen unter
/var/cache/apt/archives

#==============================##==============================#
# CMD APT                                                      #
#==============================##==============================#

# 15 Examples of How to Use New Advanced Package Tool (APT) in Ubuntu/Debian
################################################################################

# Find Location of Installed Package
apt content glances

# Check All Dependencies of a Package - This will help you to display raw information about dependencies of a particular package that you specify.
apt depends glances

# Search for a Package - The search option searches for the given package name and show all the matching packages.
apt search apache2

# View Information About Package - This will help you display information about package or packages, run the command below by specifying all the packages that you want to display information about.
apt show firefox

# Verify a Package for any Broken Dependencies - Sometimes during package installation, you may get errors concerning broken package dependencies, to check that you do not have these problems run the command below with the package name.
apt check firefox

# List Recommended Missing Packages of Given Package
apt recommends apache2

# Check Installed Package Version - The ‘version’ option will show you the installed package version.
apt version firefox

# Remove Unused Packages - When you install a new package on your system, it’s dependencies are also installed and they use some system libraries with other packages. The after removing that particular package, it’s dependencies will remain on the system, therefore to remove them use autoremove as follows:
apt autoremove

# Clean Old Repository of Downloaded Packages - The option ‘clean’ or ‘autoclean’ remove all old local repository of downloaded package files.
apt autoclean 
    or
apt clean

# Remove Packages with its Configuration Files - When you run apt with remove, it only removes the package files but configuration files remain on the system. Therefore to remove a package and it’s configuration files, you will have to use purge.
apt purge glances

# Install .Deb Package - To install a .deb file, run the command below with the filename as an argument as follows:
apt deb atom-amd64.deb

# Full upgrade
apt full-upgrade

#Using a single sudo to run multiple && arguments - Bashs here string
sudo -s <<< 'apt update -y && apt upgrade -y'

#Using a single sudo to run multiple && arguments
#This will also work with bash instead of sh shell sudo bash -c 'apt update -y && apt upgrade -y'
sudo sh -c 'apt update -y && apt upgrade -y'

# Get all upgradable deb packages in a single line - Works for debian and ubuntu based distros.
apt list --upgradable | grep -v 'Listing...' | cut -d/ -f1 | tr '\r\n' ' ' | sed '$s/ $/\n/'
    # Sample output
              # git-man git google-chrome-beta google-chrome-stable libnvidia-cfg1-430 libnvidia-common-430 libnvidia-compute-430 libnvidia-compute-430 libnvidia-decode-430 libnvidia-decode-430 libnvidia-encode-430 libnvidia-encode-430 libnvidia-fbc1-430 libnvidia-fbc1-430 libnvidia-gl-430 libnvidia-gl-430 libnvidia-ifr1-430 libnvidia-ifr1-430 libsmbclient libssh-4 libssh-gcrypt-4 libvulkan1 libvulkan1 libwbclient0 nvidia-compute-utils-430 nvidia-dkms-430 nvidia-driver-430
                #  nvidia-kernel-common-430 nvidia-kernel-source-430 nvidia-utils-430 opera-stable python3-samba samba-common-bin samba-common samba-libs smbclient thunderbird-gnome-support thunderbird-locale-en-us thunderbird-locale-en thunderbird winbind xserver-xorg-video-nvidia-430

# Using a single sudo to run multiple && arguments
sudo -s <<< 'apt update -y && apt upgrade -y'

# Using a single sudo to run multiple && arguments - Bash is here string
sudo -s <<< 'apt autoremove -y && apt autoclean -y'

# Write shell script without opening an editor - In this example, I’m creating a wrapper for apt-get that assumes yes every time — but the command could be anything.
sudo su -c "echo -e \"\x23\x21/usr/bin/sudo /bin/bash\napt-get -y \x24\x40\" > /usr/bin/apt-yes"

# Using a single sudo to run multiple && arguments - This will also work with bash instead of sh shell sudo bash -c 'apt update -y && apt upgrade -y'
sudo sh -c 'apt update -y && apt upgrade -y'

###########################
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░