14

I noticed that when in terminal the prompt is generally in the format username@users: or I have even seen username@(none):. I get that the first part is the logged in person's user name, but what is the part after the @ symbol?

1
  • 1
    It would be more useful if you gave a more detailed title, maybe something like: "What does the name after '@' at terminal prompt means"
    – Decio Lira
    Oct 11, 2010 at 20:42

6 Answers 6

25

It's the hostname, i.e. the name that you gave your computer.

Showing this as part of the prompt is useful so you can easily tell which host a given shell is running on if you're logged into multiple computers (via ssh or telnet for example).

10

You can, of course, set this prompt to be nearly anything you want- many folks use it to display other information.

Here's a decent guide that should help you get started.

Dotfiles.org also has a bunch of other customizations you can make to your shell.

10

The Bash command prompt looks like this by default:

[USERNAME]@[HOSTNAME]:[PATH][SYMBOL]
  • [USERNAME] is the username of the currently operating user. normally this is your user, but when you run sudo su or similar commands, you get a "root shell", that means the user is "root".
  • [HOSTNAME] is your hostname. It's the name of your computer. You had to enter that during the system installation.
  • [PATH] is your current working directory, the directory you're currently operating on. When you open a new terminal, the default directory is your current user's home directory. A synonym for /home/YOURUSERNAME is ~.
  • [SYMBOL] is usually either $ if you're operating as any normal user, or # if you're operating as "root" user.

So your Bash prompt looks like this:

ganesh@ganesh:~$

That means you're logged in as user ganesh on a computer called ganesh as well, currently operating in your own home directory (~). Of course you're not "root", therefore the $.


Without looking th the Bash prompt, you find out your username, groups, hostname and current working directory with the commands below:

  • Username:

    whoami
    
  • Groups:

    groups
    
  • Username and groups, as string and number:

    id
    
  • Hostname:

    hostname
    
  • Current working directory:

    pwd
    
4

The terminal prompt displays the username of your login and the contents of whats in /etc/hostname.

e.g. My laptop is james@james-laptop

This is because my username on my laptop is james and my hostname is james-laptop

3

to expand on what sepp2k said, it is the hostname aka computer-name of the system you're logged into terminal on. most of the time, and for most users, this is going to be the one you're sitting in front of. it is very useful though in the event that you occasionally/constantly sign into remote systems for administration purposes to have the pc name right there in front of you to remind you where you are.

-1

Just use command groups to list all groups that your current user is part of. Root user is an administrator account on Windows language which you might better understand.

1
  • Please read the question properly before posting an answer. Your answer is not relevant to the OP's question, they are asking what the words after the @ symbol mean when you first open up any terminal - not which groups they belong to.
    – hazrpg
    Mar 3, 2016 at 1:17

You must log in to answer this question.

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