LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: 15
[Terminal] Brackets around username


Hello,

How can I have those little brackets around the username in terminal like in this screenshot ?
http://omploader.org/vNTN6Yg

Thanks.
 
Old 08-05-2010, 05:22 PM   #2
fbobraga
Member
 
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 05:24 PM.
 
Old 08-05-2010, 05:25 PM   #3
Nylex
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, 09:15 PM   #4
Awatto
Member
 
Registered: Aug 2003
Location: Halifax, NS
Distribution: Debian, Gentoo, Ubuntu, Fedora
Posts: 128

Rep: Reputation: 30
AMA,

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)

Code:
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.

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

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

Original Poster
Rep: Reputation: 15
Cheers Awatto!
 
Old 08-06-2010, 12:05 PM   #6
colucix
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:
Code:
G='\033[1;30m'
N='\033[0;32m'
C='\033[0;36m'
R='\033[0;31m'
W='\033[0m'
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. http://www.utf8-chartable.de/. Hope this helps.

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


Reply


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 03:16 AM
Hello, i connected a server by type 'ssh username@remotehost' in ubuntu's terminal sxluck Linux - Newbie 1 09-06-2009 03:36 PM
Capture data in brackets nonnumquam Programming 11 07-11-2009 10:31 PM
Kmail--Unbalanced Brackets mooreted Linux - Software 4 01-14-2005 07:41 PM
username@something:~> in the terminal frode Linux - Newbie 1 08-25-2004 04:25 PM


All times are GMT -5. The time now is 01:58 AM.

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