[Fixed] Apt-get Command Not Found in Linux and Windows

Are you trying to run the apt-get command but getting “apt-get command not found” as a result? It may be because apt-get is not installed on your Linux or Windows device.

If you’re new to Linux commands and you’re getting errors while running them, it feels frustrating. Especially when you want to install new things, it happens the most.

So what to do if you get these “command not found” errors? Why are you getting such errors? And how to overcome these problems? That’s what we’re going to cover in this post.

Let’s get started!

What is the apt-get Command?

apt-get is a package management tool used by Debian and its derivative distributions such as Ubuntu. It’s used for installing, removing, and updating software packages on a Linux system.

With the “apt-get” command, you can search for packages by name, install packages and their dependencies, remove packages and their configuration files, and update the package lists on your system.

You can go and read the manual page to learn more about this command.

Since apt-get is specifically for the Debian distro and the ones that came from it, it’s not available for other distros by default. Therefore, the process of getting apt-get on the two different systems won’t be the same. We will show you how to overcome this problem in both situations.

How to Fix apt-get Command Not Found in Linux?

We will cover 3 different Linux distros—Ubuntu, CentOS, and Fedora.

Ubuntu

The apt-get command should work in Ubuntu by default since it’s from the Debian family. But if it doesn’t then there could be a few reasons.

  • Package Not Available
  • Package outdated or not compatible with current OS version
  • Got deleted accidentally
  • Didn’t come by default with the fresh installation

The first thing you should do is check whether you have apt-get or not. To do that, run this command:

$ apt-get

Output:

apt-get output

You should get a similar output stating the version number and usage of the command.

Another way to test this is to see the list of paths of ap-get. For that, run the below command:

$ which apt-get

Output:

version of apt-get

This shows the path where the command is located.

No matter the case, you can install the apt-get utility by yourself. This webpage contains a huge list of .deb packages of the APT tool. Scroll through the page and find the suitable version for your system. Tap on the package to download it.

Alternatively, you can use the wget command to download it. To do that, run the command in this format:

$ wget <URL/package name>
$ wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_2.6.0_i386.deb

This will download the DEB file in the current directory of your terminal. Now to install it, use this command:

$ sudo dpkg -i apt_2.6.0_i386.deb

Now you can try out the apt-get command again or combine it with the which command to see if it’s been installed properly. If so, try installing something using it. To install software with apt-get, use the command like this:

$ sudo apt-get install <software>
$ sudo apt-get install postgresql # For example

Output:

Install app by apt-get

We are installing postgresql as an example but you can install any app in the APT repository and see if the installation works this time.

Read Also: How to fix Bad Archive Mirror issue on Kali Linux

CentOS

CentOS is a Red Hat Enterprise Linux(RHEL) based OS. The default package management tool for CentOS is yum. So if you’re using CentOS, use yum to install software and package. To use yum for installations, run it like this:

$ yum install <application>
$ yum install httpd24

Learn more about yum on this page.

Another way to install new packages is to use the rpm command. The syntax is as follows:

$ rpm {-i|--install} [install-options] <package name>
$ rpm -ivh kernel-2.4.21-15.0.3.EL.i686.rpm

This command can be used for installing RPM packages. This manual page will let you know more about this command.

If you’d like to use apt-get in CentOS, you can use a bash script for that. Download the script using this command:

$ curl https://raw.githubusercontent.com/dvershinin/apt-get-centos/master/apt-get.sh -o /usr/local/bin/apt-get

Then change the file permission of the script with this command:

$ chmod 0755 /usr/local/bin/apt-get

Now you can use the apt-get command as if you’re using it on Ubuntu. To use it, run it like this:

$ apt-get install nginx
$ apt-get remove nginx
$ apt-get purge nginx

Behind the scenes, it just calls yum and gets the work done. So how is this helpful? If you jumped to CentOS from Ubuntu or a similar distro, this allows you to conveniently keep using apt-get until you get used to the new commands.

This doc is a good reference to go to for this bash script.

Related: Ubuntu Software Center Not Loading [Fixed]

Fedora

Fedora is another RHEL-based OS. So you can’t use APT to install software in Fedora. Instead, you use the DNF command. Also known as Dandified YUM, it’s the successor to YUM (Yellow-Dog Updater Modified).

To use DNF to install packages and do other activities, you use it like this:

$ dnf search <package name>
$ dnf install <package name>
$ dnf remove <package name>

Other usages include autoremove, check-update, downgrade, reinstall, upgrade, and more.

Before Fedora 32, the apt command was known as APT-RPM. It worked with Fedora’s RPM package management system. But due to its insecurity, brokenness, and not being maintained, it got removed and replace with APT.

Note that, you can’t manage Fedora packages using APT. It’s only used by developers to create DEB packages on a Fedora device.

This is where to go to learn more about DNF.

How to Fix apt-get Command Not Found in Windows 10 and 11?

apt-get Command Not Found in Windows

The Windows equivalent of apt-get is the Chocolatey package manager. If you’re familiar with Linux package managers(like apt-get) and you always wanted the same in Windows, then Chocolatey, or Choco for short, can make that possible.

To install Chocolatey, open your CMD and run this command:

> @"%SystemRoot%System32WindowsPowerShellv1.0powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%chocolateybin"

After the installation, see if it works properly. Run choco or choco -? in the CMD. To use Chocolatey for installing packages or doing other tasks, run it in this format:

> choco install nodejs -y
> choco install notepadplusplus 

Another popular Windows package manager is Winget from Microsoft. It’s free and open-source. The code is available on GitHub. It comes with the App Installer tool on Microsoft Store.

After installing, run winget on CMD to see if it works. It’s used in a similar way as apt-get. This is the syntax:

> winget search <appname>
> winget install <appname>
> winget install powertoys

The last command-line installer tool for Windows we’d like to show is Scoop. To install it, open up Powershell and run this command:

> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
> irm get.scoop.sh | iex

After installing it, you can start using it right away. The syntax is as below:

> scoop search <appname>
> scoop install <appname>
> scoop install python
> scoop create https://example.com/foobar/1.2.3/foobar-package.zip

Scoop allows you to get rid of permission popup windows and GUI wizard-style installers. It’s also very scriptable.

Final Thoughts

This guide shows you how to solve the issue where you get “apt-get command not found”. We’ve covered 3 different Linux distros and Windows 10 and 11.

For both Linux and Windows, you have multiple options to choose from. So the final decision is yours. Check out each and pick a suitable one.

If you face any problems while following this tutorial, let us know in the comments below.

If any of the above solutions did not fix the Windows PC issues, we recommend downloading the below PC repair tool to identify and solve any PC Issues.

Dinesh is the founder of Sysprobs and written more than 400 articles. Enthusiast in Microsoft and cloud technologies with more than 15 years of IT experience.