How to fix 'apt-get: command not found' error in Linux Terminal
Here's how to handle the "apt-get: command not found" error.
What is apt-get?
The apt-get tool is a command-line package manager for Debian distributions. It allows you to install, update and remove software. Usage of apt-get is as follows:
apt-get [tùy chọn] [lệnh]
So, to install scrot screenshot software, you would use:
apt-get install scrot
Strictly speaking, apt-get is deprecated, which means it is not used for any interactive installation (i.e. pressing Y or N or entering any other command as required). Instead, shorter apt commands (including apt-get commands) are recommended, while apt-get is approved for scripts.
However, if you just need to install some software then both will work.
But what if apt-get doesn't work?
Getting "apt-get: command not found" error on CentOS or RHEL?
The apt-get command usually works without problems, but what if it doesn't?
If you are using a distribution that does not use apt-get then it simply will not work. (For example, this is an easy mistake to make when accessing a remote web server.) To resolve this issue, you must install using the correct package manager.
This could be pacman, zypper, yum or dnf, depending on the Linux distribution.
For example, if you were on a CentOS server and wanted to install software, instead of apt-get (or apt), you would use yum:
yum install PACKAGE_NAME
(Where 'PACKAGE_NAME' refers to the package available for installation.)
TipsMake's comparison of apt, yum and dnf explains this further.
Fix 'apt-get: command not found' error on Debian, Ubuntu or Raspberry Pi OS
What if you are using a Debian family distribution like Ubuntu, Pop!_OS or Raspberry Pi OS and encounter the 'apt-get: command not found' error?
Incredibly, this can happen, but what to do to fix the error?
- Reinstall the operating system . This is the fastest, least labor-intensive way to solve the problem.
- Alternatively, download apt.deb from the Ubuntu website and install with sudo dpkg -i apt_[VERSION].deb (change the filename to match the downloaded file).
Raspberry Pi OS users may find that apt-get install (or sudo apt-get install) does not work. In this case, try apt install instead.
Additionally, if you try apt-get install and get another error (along the lines of "Temporary failure resolving" followed by the server URL) then the problem is with the connection. So, perform the following checks:
- Network connections
- System clock and date
- Use ping to confirm your computer can access any website (e.g. Google)
After making the necessary adjustments, restart your computer and try again.
Other ways to fix 'apt-get: command not found' error
3 other issues can lead to the 'apt-get: command not found' error.
First, did you spell the command correctly? Spelling errors can cause havoc in any text-centric system, from Google search to finding words or phrases on a page. Linux Terminal is no different. Please take the time to make sure you entered 'apt-get' correctly!
Second, maybe your permissions are not enough? Instead of 'apt-get' , try 'sudo apt-get' - the 'command not found' error should now be eliminated.
Finally, if you see a more specific 'sudo: command not found' error appear and you've tried everything above, the problem may actually be sudo, not apt-get.
You should read it
- 6 interesting terminal commands on Mac
- 14 interesting Linux commands in Terminal
- How to run 2 or more Terminal commands at the same time on Linux
- The Cat command in Linux
- How to use Guake Terminal in Linux
- Common Terminal commands in Raspberry Pi
- 6 ways to fix Windows Terminal not opening error
- How to use the history command in Linux
- Instructions for using zforce command on Linux
- How to Launch Programs from Command Line on Linux
- How to back up and restore Linux Terminal history
- How to use the Linux command line on Android with Termux
Maybe you are interested
Leaked images of Lenovo's first roll-up screen laptop
9 Best Tools to Analyze Laptop Battery Health
Top best mind mapping software on computers and laptops today
DeceptionAds Warning: New Malicious Ad Type Exploits Legitimate Services to Display Fake CAPTCHAs
Why should you shut down your Windows laptop every day?
Things to know before choosing between laptop and desktop