Monday, April 29, 2024
34
rated 0 times [  34] [ 0]  / answers: 1 / hits: 14464  / 2 Years ago, thu, may 5, 2022, 5:18:27

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


More From » command-line

 Answers
3

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 case sudo 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.)


[#30877] Friday, May 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
terneive

Total Points: 329
Total Questions: 117
Total Answers: 105

Location: Denmark
Member since Tue, Oct 18, 2022
2 Years ago
;