What does your shell prompt look like?
Well we have a thread for screen shots so waht about your shell prompt?
There are lots of examples on the net including ones that show load averages etc so I just wondered what other people used. I'll start off with my default one: Code:
rossy - Wed Nov 12 22:57:01 PS1="\[\033[0;31m\]\u - \d \t\n\w> \[\033[0m\]" Please try and include any commands/scripts etc you used to get your prompt. |
Mines simple and probably standard:
Code:
drew@trickykid:/etc$ PS1='\u@\h:\w\$ ' |
Here's my prompt string...
PS1="[\u@\h \w]--> " shows up like this: [blinky@Spork ~]--> |
Code:
|--j@slackmagick bash 2.05b (1) Wed Nov 12 19:26:51 Code:
PS1='\n|--\u@\h \s \v (\l) \d \t\n|--\w >> ' |
[[@bunny:17:54:17:root]]
But you dont get the full effect without the color, try it out: PS1="\[\033[1;30m\]\[\033[0;32m\][\[\033[1;32m\][\[\033[1;35m\]\[\033[1;36m\]@\h \[\033[1;37m\]:\[\033[1;35m\]\t\[\033[1;37m\]:\[\033[1;36m\]\W\[\033[1;32m\]]\[\ 033[0;32m\]]\[\033[1;30m\]]\[\033[0;0m\]" Make sure you get the line returns out. This is my firewall: [@m0rl0ck:22:57:15:root]+> Some what the same but uses reverse video, heres the $PS1: PS1="[\[\033[1;36m\]@\[\033[0;45m\]\h:\[\033[1;36m\]\t\[\033[0;44m\]\[\033[1;36m \]:\W\[\033[0m\]]\[\033[1;31m\]+>\[\033[0m\]" EDIT: HEY!! I just realized my clocks are either out of sync or it took me 5 hours 3 mins to compose this post :) |
I use ctrl+Z alot, so:
0 [321-2] [Wed Nov 12 22:02:47] green_dragon37@grndrgn001 / > PS1 = \j [\!-\#]\n[\d \t]\n\u@\h \W > |
For regular users: (I have a rather colorful hostname, so I edited it somewhat for this post)
cerbere@s#|thead:~$ PS1='\u@\h:\w\$ ' For root: root@s#|thead:~# PS1='\[\033[1;31m\]\u@\h\[\033[1;33m\]:\w\[\033[0m\]\$ ' This changes the color of 'root@hostname' to bright red, and the color of the pwd to bright yellow. That way I'm less likely to do things as root that I really don't want to do. Enjoy! --- Cerbere |
It depens on the way I've been logged into the system :-D
normal user: me@pts/1 foldername $ root user: root@pts/1 foldername $ and remotely, me@hal9000 foldername $ The title of the xterm / konsole will also display the tty, host, and full path name. (only the last folder is shown in the prompt) Code:
#!/bin/bash |
Hey, interested noobs (like me) :D
Note, that PS1 (the control-string for your prompt) can be set at differing places for different users on your system. Here is what I could make out (without actual access to my system): /etc/bashrc is used to set the prompt for the "true" consoles reached via <Alt><Crtl><Function key 1 through 6> /root/bashrc is used to set the prompt for root with graphical login (under KDE) /home/user/bashrc is used to set the prompt for user (your user-id here) Please note, that some systems place a "." (without the "'s) in leading position of bashrc, thus generating .bashrc (dot-bashrc), which might be hidden in the file manager (activate "show hidden files") and to the ls-command (that's a small "L") so use the -a option (ls -a). I do not know where PS2, PS3 ... PSN are set and what they are good for, exactly. Any takers? :D @moderators (and gurus): checking and editing this post directly as necessary for errors and improvements is welcome. :) |
PS2 is your secondary prompt, if you enter commands on multiple lines. for example, if statements, or while loops. (they require a 'counterpart'; a command that ends the statement)
PS4 is used if you enable "set -x", which shows all commands being executed. from the bash manual you'll see what files are used. (just type "G" to skip to the end) files in /etc/ are usually global, and affect everyone using bash. files in your home directory overrule these global settings. if you run bash from a login session (or bash -l), /etc/profile will be read, and from your home direcory: ~/.bash_profile, or ~/.profile. In slackware, there is a /etc/profile.d/ directory where all *excutable scripts* are being executed by /etc/profile too. Some distributions don't have this, but you could add a few lines at the end of /etc/profile very easy: Code:
# Append any additional sh scripts found in /etc/profile.d/: a script can be made executable with this command: chmod +x <insert filename here> |
For users: <user>@<host>$
and for root: <user>@<host># |
mine is simple :
Code:
[sohail@linux /usr/local]$ echo $PS1 |
[17:20:06] slight - slight>
Errr.... this is from memory, so no guarantees if it's wrong (which it probably is): export PS1="\e[36;1m]\t\e[0m]\u - \w>" slight |
Cool stuff guys, but one quick question...
Mine is the standard pibby@localhost thing and I am wondering how I change the "localhost" part. For instance TrickyKid has drew@trickykid. Local host is so boring, I hope there is a way to change that. Thanks in advance for any help you can offer :) |
Well, you could either change your actual hostname, or just use some of these tricks posted here. I am not positive about Mandrake, but I know in Slack there is a HOSTNAME file in /etc that you can edit to change it from localhost. I actually used netconfig, but I think thats a Slack-specific script.
|
Thanks for the help, I didnt realize that I could type anything in there, thought it had to be something like /h or /w. Thanks again :)
|
i use the default as well, but i have experimented with a few
C:$PWD> for instance (not much of a fooler because of the slashes instead of backslashes but still kinda funny) |
You're an evil person, frieza. :D It took me awhile to figure out and it's definitely not thoroughly tested, but it seems to work - I had a hard time going about it the wrong way. I set it pretty easily but couldn't get it to persist through 'cd' commands until I completely rethought it.
Try this Fake Working Directory in your ~/.bashrc or wherever. Very funny. *g* Code:
PS1="C:\$(fwd)>" |
bash-2.05b$
|
Code:
(19:51)[darkspy@Orion darkspy]$ cd Downloads/ |
this is what my bash prompt looks like:
echo $PS1 Code:
\[\033[0m\]\[\033[1;33m\]\j\[\033[0m\]\[\033[1;30m\]\t\[\033[0m\]\[\033[31m\]\u\[\033[0m\]@\[\033[1;34m\]\033[37m\]\w$\[\033[0m\] |
export PS1="[\u@\h \W]$ "
for normal users export PS1="[\u@\h \W]# " for root [theonekea@Ganymede theonekea]$ But I may change it, after seeing the stuff in this thread. |
mine's also pretty basic:
PS1='\[\e[36;1m\]\u@\h:\[\e[34;1m\]\w \$\[\e[0m\]' PS2=~> i wanted to add the current directory to the title bar instead, to save space, but it messes things up when in console mode. :( |
< /usr/local/games >
[ Sat Nov 29 ¤ 13:34:11 --- fatgod @ odin ] $ echo $PS1 \n\033[1;33m\] < \w >\n\033[1;32m\][ \d \244 \t --- \u @ \H ]\n \033[1;37m\]$ Which is virtually impossible to see on a light background... but works well enough on darkened tranparent windows. And when I 'su' the username turns red. |
$
|
I make it easy on myself, at the top I define the colors I use.........
Code:
# Color Variables for Prompt Code:
PS1="$GRN\h $RED\w $YEL\$ $NONE$NORM" Chessmaster ~ $ When I'm root: Chessmaster is Red and the working directory is Green |
I have a fairly bland command prompt. The only thing that I really like to have is a \n at the front, which puts a blank line between the last output and the new prompt
|
Glad you guys resurrected this thread. I searched for it a couple of
months ago but could not find it no matter what string I entered... |
Quote:
and came upon it...............hopefully it won't go dead again for awhile........... |
[19:11:21][will@hexbox1lnx]$
PS1="[\t][\u@\h\\$ " |
Quite simple... ;)
Code:
mary@linux % ~ |
My prompt?
3 lines long username on host.domain:/home/username cmd-> Done as PS1=" `whoami` on `hostname:\$PWD cmd-> " root's is slightly modified as root on host.domain:/root Simon Says-> |
james@poseidon ~ $
james@poseidon is in green path and $ is in blue For root root@poseidon ~ # root@poseidon in red path and # is in blue Code:
# Define some colors first: |
bigrigdriver Mon Oct 18] $ /path/to/working/directory. Red if I su to root; blue otherwise.
I have this in /etc/bashrc; # bash-specific settings ROOT_UID=0 if [ "$UID" -eq "$ROOT_UID" ] then PS1="\[\033[31;1m\]\u \d] \\$\w\n \[\033[0m\]" else PS1="\[\033[34;1m\]\u \d] \\$\w\n \[\033[0m\]" fi |
How do I get my prompt to show instead of ${PWD}, just the last 3 levels of the path ?
|
7h15 15 ]V[1]\[3
:: fugu@oni-tng /etc :: Code:
PS1="\[\033[1;30m\]:\[\033[1;33m\]: \[\033[1;30m\]\u@\h \[\033[1;33m\]\w \[\033[1;33m\]:\[\033[1;30m\]: |
for regular user:
[Mon Nov 1][user@percentageness] [~/music]$ for root: [Mon Nov 1][root@percentageness] [/etc][YOU ARE ROOT]# for regular users: PS1="[\d][\u@percentageness]\n[\w]\$ " for root PS1="[\d][\u@percentageness]\n[\w][YOU ARE ROOT]\# " |
Quote:
Code:
|
My home prompt is pretty complex:
Code:
\[\033[0;34m\][\[\033[0;35m\]\u\[\033[0;34m\]@\[\033[0;35m\]\h\[\033[0;34m\]]\[\033[1;37m\]:\[\033[0;31m\]\@\[\033[1;37m\]:\[\033[0;31m\]\d\n\[\033[0;34m\][\[\033[0;31m\]\w\[\033[0;34m\]]\[\033[1;37m\]:: [ user@host ] :current time:current date [ pwd ] :: While my work prompt is very simple: Code:
\u@\h:\w\$ |
Quote:
3: `pwd|awk --field-separator='/' {'print $(NF-2)/$(NF-1)/$(NF)'}` # By the way this is not Linux it is HP tru 64 |
echo $PS1
\033[35m\]\nDirectory:\[\033[32m\]\w\n\[\033[1;31m\]\u@\h: \[\033[1;34m\]$(/usr/bin/tty | /bin/sed -e 's:/dev/::'): \[\033[1;36m\]$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files \[\033[1;33m\]$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\033[0m\] -> \[\033[0m\] --- Ends Up Lookin Like This Directory:~ root@localhost: pts/4: 71 files1.1Gb -> |
After 6 years
Code:
16:52:49 Sat Mar 26 anisha ~ fortune |
for me:
[bread@staircase:~]$ and for root: [root@staircase:~]# .zshrc Code:
PS1="[$PR_WHITE%n$PR_NO_COLOR@$PR_NO_COLOR%m%u$PR_NO_COLOR:$PR_NO_COLOR%2c$PR_NO_COLOR]%(!.#.$) " |
Using zsh:
After a successful command: tobi@dragon ~ :) % After an unsuccessful command: tobi@dragon ~ :( % Code:
PROMPT=$'%n@%m %0(3c,%c,%~) %0(?,%{\e[0;32m%}:%),%{\e[0;31m%}:(%s)%b %# ' |
Mine is simple: nick@vega:~$
|
A couple of years ago I posted a script that I created that will truncate the $PWD and format it for use in the prompt.
Since then I've modified it some more and converted it into a function, and I use it like this: Code:
The result looks something like this: Code:
|
Whoa, haven't seen this thread in awhile. Mine now looks like:
[sean.bitwise: /home/sean]$ It also turns to red when a command fails, back to green under normal conditions. PHP Code:
|
mine looks like this:
┌─[18:04:17]──[bret]──[Ziggy]:~$ └──(28 files, 3.5Gb)>> Code:
PS1="\[\e[01;37m\]┌─[\t]──[\[\e[01;37m\u\e[01;37m\]]──[\[\e[00;37m\]${HOSTNAME%%.*}\[\e[01;37m\]]:\w$\[\e[01;37m\]\n\[\e[01;37m\]└──\[\e[01;37m\](\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[01;37m\])>>\[\e[0m\]" |
Quote:
|
Quote:
I don't have a clue. haha, I used the archbang default prompt (which has that character) and added some stuff. |
All times are GMT -5. The time now is 10:24 AM. |