What does ~$
stand for? For example:
user@ubuntu:~$
So far I know that the $
sign is a symbol for a regular user. If I'm not mistaken root
have #
at the end.
I also found a lot of commands in the forums that begin with $
:
$ sudo apt-get update
So for what does $
actually stand for?
EDIT (28.01.2014) :
Today I came across this video that totally answers my question from 8 months ago and decided to share it here 🙂
BASH Basics – https://www.youtube.com/watch?v=x73WTEltyHU
Best Answer
The
~
and$
are elements of the command line prompt. This indicates that your computer (or more exactly, I guess, the shell you are running) is waiting for user input. It is prompting you to input a command.The
$
is merely a separator or divider. It separates the command prompt from the command which follows it. When people write such things as$ sudo apt-get update
(your example), they are simply telling you that the command, in this casesudo apt-get update
, needs to be entered at a command prompt. Strictly speaking, perhaps, the$
is redundant in this context.Other separators may be used in other situations. For example,
#
is used for a root shell.The
~
(called 'tilde') is shorthand for your home directory. When it appears in a command prompt, e.g.,user@hostame:~$
, it indicates that the current working directory is your home directory. Thus if you run the list command,ls
, without specifying any particular directory, it will list the contents of your home directory.(By the way,
$HOME
, is not a command, as you suggest, but rather an environment variable. It determines the location of your home directory. You can see its value by running$ echo $HOME
.)