PQ
PQ.Hosting

Currency

apt-get command not found: Causes and How to Fix It

Author
PQ
March 16, 2026
4 min read
14 views

apt-get: command not found — one of the few errors where the underlying problem can be completely different depending on the situation. Sometimes it is simply the wrong distribution. Sometimes the PATH environment variable is broken. Sometimes the package was genuinely removed. Here is how to work through it.

Step 1: Confirm This Is a Debian-Based System

apt-get only exists on Debian-based distributions: Ubuntu, Mint, Pop!_OS, Kali, Raspberry Pi OS. On everything else it simply does not exist — those systems use different package managers.

Check the distribution:

cat /etc/os-release

If the ID_LIKE line does not contain debianapt-get is not available here. The correct package manager for other systems:

Distribution Package Manager
RHEL, CentOS, Rocky, AlmaLinux dnf or yum
Fedora dnf
Arch Linux, Manjaro pacman
openSUSE zypper
Alpine Linux apk

Step 2: Check If the File Exists

Even on Ubuntu — apt-get could have been accidentally removed or corrupted. Check:

ls -la /usr/bin/apt-get

Three possible outcomes:

File exists with correct permissions (-rwxr-xr-x) — the problem is in PATH, go to step 3.

File exists but missing the x flag — permissions are broken. Fix:

sudo chmod +x /usr/bin/apt-get

File is missing — the package was removed. Go to step 4.

Step 3: Check the PATH Variable

PATH is the list of directories where the system looks for executables. If /usr/bin dropped out of it, the system will not find apt-get even if it is there.

View current PATH:

echo $PATH

The output must include /usr/bin. If it does not — add it for the current session:

export PATH=$PATH:/usr/bin

Verify it works:

which apt-get

Should return /usr/bin/apt-get.

To persist across reboots — add to ~/.bashrc or ~/.profile:

echo 'export PATH=$PATH:/usr/bin' >> ~/.bashrc
source ~/.bashrc

If PATH broke after editing /etc/environment or /etc/profile — open that file and restore the standard PATH line:

sudo nano /etc/environment

Standard PATH value:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Step 4: Reinstall apt If the File Is Gone

If ls /usr/bin/apt-get returns No such file or directory — the package needs to be restored. Without apt-get this is trickier than usual.

Option 1 — if apt (without -get) still works:

sudo apt install --reinstall apt

Option 2 — download the .deb directly via wget and install with dpkg.

For Ubuntu 22.04:

wget http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_2.4.12_amd64.deb
sudo dpkg -i apt_2.4.12_amd64.deb

For Ubuntu 24.04:

wget http://archive.ubuntu.com/ubuntu/pool/main/a/apt/apt_2.7.14build2_amd64.deb
sudo dpkg -i apt_2.7.14build2_amd64.deb

Find the current link for your version at packages.ubuntu.com — search for the apt package.

apt vs apt-get: The Difference

If apt-get errors but apt works — the right command may just be apt.

apt — the modern interface introduced in Ubuntu 16.04. Does everything apt-get does, but with a progress bar and colored output. Recommended for interactive use.

apt-get — the older, more stable interface. Recommended in scripts — its output format does not change between versions.

On systems older than Ubuntu 14.04 the apt command may not exist — only apt-get.

Quick Reference

Situation What to Do
Not Ubuntu/Debian Use the native package manager
Identify the distribution cat /etc/os-release
Check if file exists ls -la /usr/bin/apt-get
Fix file permissions sudo chmod +x /usr/bin/apt-get
Check PATH echo $PATH
Add /usr/bin to PATH export PATH=$PATH:/usr/bin
Reinstall apt (if apt works) sudo apt install --reinstall apt
Reinstall via dpkg wget <link to .deb> && sudo dpkg -i apt*.deb
apt works but apt-get does not Just use apt

Share this article

Related Articles