Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-05-2010, 05:52 PM   #1
Registered: Sep 2008
Distribution: Arch
Posts: 44

Rep: Reputation: 15
[Terminal] Brackets around username


How can I have those little brackets around the username in terminal like in this screenshot ?

Old 08-05-2010, 06:22 PM   #2
Registered: Jul 2010
Location: São Paulo - Brasil
Distribution: Debian 7 / Crunchbang 11
Posts: 229

Rep: Reputation: 41
I can't find a terminal window in the screenshot...

Last edited by fbobraga; 08-05-2010 at 06:24 PM.
Old 08-05-2010, 06:25 PM   #3
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
The bottom two windows look like terminals to me..

I don't know how to do such things, though. Sorry!
Old 08-05-2010, 10:15 PM   #4
Registered: Aug 2003
Location: Halifax, NS
Distribution: Debian, Gentoo, Ubuntu, Fedora
Posts: 128

Rep: Reputation: 30

You probably would like to look into setting the "PS1" environment variable.

this is ususally done in a file in your home directory called .bashrc (or, sometimes, .bash_profile)

man bash
and do a search (press the / key) for PS1, or do a google search on how to change the variable. Essentially, it is a string (with variables such as \h which translates to hostname) that is displayed as your prompt.

PS1="[\u@\h \w]\\$ "
would give you something like

[user@host ~]$
So play around with it till you have it as you'd like.
Old 08-06-2010, 06:03 AM   #5
Registered: Sep 2008
Distribution: Arch
Posts: 44

Original Poster
Rep: Reputation: 15
Cheers Awatto!
Old 08-06-2010, 01:05 PM   #6
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
The arch linux documentation has a good tutorial about the colorized bash prompt. Also check the colours page on the Bash Prompt HOWTO. Once you have defined your own colors, you can try to set the PS1 environment variable at your pleasure. For example this is similar to the prompt shown in the picture:
PS1="\[$G\]┌─[\[$N\]\u\[$G\]@\[$C\]\h\[$G\]]-[\[$R\]\W\[$G\]]\n└─• \[$W\]"
You can type special characters using Unicode support or you can copy/paste them from a list, e.g. Hope this helps.

Last edited by colucix; 08-06-2010 at 06:50 PM. Reason: slightly changed color definitions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why "bash-2.05b$" in Terminal instead of "username@localhost username" jayelitumbiolo Linux - General 9 10-04-2009 04:16 AM
Hello, i connected a server by type 'ssh username@remotehost' in ubuntu's terminal sxluck Linux - Newbie 1 09-06-2009 04:36 PM
Capture data in brackets nonnumquam Programming 11 07-11-2009 11:31 PM
Kmail--Unbalanced Brackets mooreted Linux - Software 4 01-14-2005 08:41 PM
username@something:~> in the terminal frode Linux - Newbie 1 08-25-2004 05:25 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration