2

Any command that starts with $ returns

command not found

How can I fix this?

I am using 16.10 Ubuntu.

  • 4
    can you please give a couple of examples for such commands you are trying to execute? – Yaron Mar 30 '17 at 8:52
  • That's doesn't like the full error message either, you should post that, too – ilkkachu Mar 30 '17 at 9:25
13

Presumably you are copying and pasting commands from somewhere that look like this:

$ sudo apt update

The $ sign is not part of the command at all - it is a commonly used way to indicate that the text following it is a command. Typically here on Ask Ubuntu we use it when we want to indicate "I entered this command, and the output was this". It is an abbreviation of the full prompt we actually see:

zanna@monster:~$ $ sudo apt update
$: command not found

It can also be used to mean (on Ubuntu Forums for example) "run the command as a normal user", not root, because when you switch to root the prompt changes:

zanna@monster:~$ sudo -i
[sudo] password for zanna: 
root@monster:~#

The $ is not meant to be entered. The actual command would be

sudo apt update
2

$ is actually the prompt. It is not included at the start of any command. Try writing the command without $. Good luck..

1

Unless you are using the output of one command as an input variable of another e.g echo $(history) the use of $ should be avoided.Generally in bash scripting the character $ is used to delineate a variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.