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
- 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
May be interested
- Common Terminal commands in Raspberry Piyou have a raspberry pi on hand, but not completely confident with linux? although the main desktop is easy to use, sometimes users need to rely on the command line entry in the terminal.
- Top 7 best Linux terminal emulatorsterminal is pre-installed in most linux distributions. however, you may not get as many customization options and advanced functionality with the default option.
- Instructions for using zforce command on Linuxthe gzip command is a popular tool used to compress / decompress files in linux. tipsmake.com presents the basics of this tool in the article: some basic terminal commands in linux mint 11.
- 6 ways to fix Windows Terminal not opening errorwindows terminal is a pretty effective tool as it allows you to type in a variety of command line tools for both windows 10 and 11. this sounds good as long as you can open it.
- How to Browse the Internet Using the Terminal in Linuxhave you ever wondered how to view web pages in a command line in linux? start with step one to learn how to do it, using two different tools. go to the terminal and type this command .
- How to use the history command in Linuxas you spend more and more time in terminal sessions, you will constantly find new commands that make everyday tasks more efficient. the gnu history command is one of them.
- Learn about cheat.sh: A simple Terminal tool that provides a cheatsheet for any Linux commanduse cheat.sh, a great tool that provides instant access to cheatsheets for any linux command.
- How to use Terminal on a Macterminal on mac is a command line interface that allows you to use unix commands to complete some tasks much faster than using a graphical user interface (gui). with the terminal command, you can open files, improve your mac's performance, and more. here's how to use terminal on mac, including some basic commands you can get started.
- How to use the Linux command line on Android with Termuxandroid is a very operating system 'capacity with more and more desktop accessibility applications. however, sometimes you want to make some things on android that can be as easy as desktop. fortunately, you can use the termux tool, which builds on the existing infrastructure and provides a command line environment that allows you to install real linux applications on your android device.
- How to execute Linux commands in the backgroundlinux commands are a great way to interact with the system using terminal. however, it can sometimes take a while to complete the task at hand. this forces the user to wait a significant amount of time or create a new shell entirely.