stuck in terminal as username-desktop ~ #

Asked by jlbethuram

i am stuck in the terminal as username-desktop ~ # and i need to get back to username@username.
help!

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gnome-terminal Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alexandru Guduleasa (gulyan89) said :
#1

If you type:
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
in the terminal it will get back to user@host

to make this setting stay you must edit the ~/.bashrc file
Around line 46 you must have something like this:

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi

I hope this helps you :)

Revision history for this message
jlbethuram (jlbethuram) said :
#2

cameron@cameron-desktop ~ $
this is what i see. i just need to get rid of the ~$. i need to get out of the -desktop~$ part.
i do appreciate the time.

Revision history for this message
Alexandru Guduleasa (gulyan89) said :
#3

Try PS1='\u@\h '
this will only print: username@hostname
it will not show the $ or the current directory (~) anymore
However I think your hostname is cameron-desktop. To display only cameron@cameron use:
PS1='\u@\u '

btw.. the PS1 variable contains the format of the prompt \u is your username, \h si the hostname and \w is the working directory.
I hope this helps you.

Revision history for this message
Matt Sicker (jvz) said :
#4

Well, the # means you're root (via sudo or su probably), and the username-desktop thing is your hostname for your computer.

Can you help with this problem?

Provide an answer of your own, or ask jlbethuram for more information if necessary.

To post a message you must log in.