3

Any command that starts with $ returns

command not found

How can I fix this?

I am using 16.10 Ubuntu.

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

3 Answers 3

15

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
1
  • Am looking for a way to instruct zsh to ignore the leading dollar sign, do you know any? Jul 17, 2020 at 14:53
2

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

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .