Linux command on Linode terminal is not working?

When i am writing a command below

apt-get update

It is showing me an error

-bash: apt-get: command not found

2 Replies

We typically this type of error when calling on package managers that are incompatible with a distribution - plenty of users are running a multitude of servers and utilizing various distros, so it’s easy to mix up.

To provide some examples below, here are the commands you would run to update various distribution packages:

Debian & Ubuntu:

sudo apt-get update 

CentOS:

sudo yum update

Fedora:

sudo dnf upgrade

More examples are listed in our Getting Started guide, under the Install Software Updates section.

While @jtoscani's answer is helpful, it doesn't answers the OPs question. First, since apt-get(1) is the package manager on Debian/Ubuntu, one can assume the OPs distro is one of those two.

The message

-bash: apt-get: command not found

is what you get when bash(1) can't find a command. Typically, this means that the directory where apt-get(1) lives (/usr/bin on Debian/Ubuntu) is not in the user's PATH.

The OP either needs to add /usr/bin to his PATH in his login .profile:

PATH=$PATH:/usr/bin

or specify the complete path name when invoking apt-get(1):

/usr/bin/apt-get …

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct