30

What is the difference between $ and # signs in Linux environment? As I started working on Linux and I found that both are different. I mean do they have different set of privileges?

[root@localhost ~]# and [tom@localhost ~]$.

2 Answers2

61

In short, if the screen shows a dollar sign ($) or hash (#) on the left of the blinking cursor, you are in a command-line environment.

$, #, % symbols indicate the user account type you are logged in to.

  • Dollar sign ($) means you are a normal user.
  • hash (#) means you are the system administrator (root).
  • In the C shell, the prompt ends with a percentage sign (%).

There are differences on prompts in different Unix or GNU/Linux distributions because of their default settings. For example, the prompt of Debian/Ubuntu is guest@linux:~$, the one of Fedora/CentOS/RedHat is [guest@linux ~]$ and the one of SuSE Linux/OpenSUSE is guest@linux:~>. In general, the prompt usually show the login user name, machine hostname, and current working directory and ended with a dollar ($), percentage (%), or hash (#) sign.

guest@linux:~$ 
  • guest - username: the user account you are logged in to.
  • linux - machine hostname: the machine you are operating.
  • ~ - current working directory: the directory you are in. Tilde (~) means home directory, i.e. the default directory when first logging in.
gayanw@myubuntu-host:~$ pwd
/home/gayanw

Reference: wiki.debian.org.hk/w/Basic_Command_Line

Gayan Weerakutti
  • 3,830
  • 1
  • 28
  • 39
1

In addition to Gayan Weerakutti answer here's a little mnemonic that helped me remembering the difference easily:

  • $ = This is for the simple people working for money = Normal user
  • # = This is for the wealthy, powerful people who do not need to work for money anymore, but rather work for status / likes / hashtags = Root user
Myzel394
  • 130