What Does Your Command Prompt Look Like?
rogain writes: "Show your commandline coolness and post your ubergeek .profile
Donate a clue to the newbie hordes amazed that you can even change the command prompt! A nerdly sort of show-me-yours and I'll-show-you-mine kind of thing." I've attached mine below, but its kinda boring. I'm looking forward to seeing someone come up with a cooler one!
Here's mine:
PS1="$E\033]2;\h:\u:\w\007\033]1;\h\007$R$E$REDBLK$R\u$E$PPLBLK$R@$E$REDBLK$R\h$E$NONE$R\w>"
that'd be "prompt $p$g" if I remember correctly.
If your prompt looks like this:
#
You miss that ole' 1970s OS so you want it back so you can smoke weed and not bathe for weeks. And you even call the 1970s technology "new" in public forums. Oh, and you can't make a post without obscenities, so you will reply to this full of obscenities. You are the kind that insists on "skins" for all windows apps, to make them unusable. You used to complain about Win16 being a "Windows on DOS" operating system, yet you don't seem to see how close X-Windows is to that concept. .
If your prompt looks like this:
c:\>
At least you are interested in getting your work done and you cut your hair and bathe every now and then. And you realize that the best tool is the one that gets the job done, not the one that works best.
Notice, the site that Gile's page refers to, http://bash.current.nu/ is gone, hacked. Hope to see it back soon, and complete. BUT, there is another site that actually has the bashprompt package at http://www.neuro.gatech.edu/users/cwilson/cygutils /unversioned/bashprompt/, but that one is so old it refers to the bash.current.nu page before they even got thier own homepage.
get a life
Do not run this command - it tries to change the permissions of your /etc directory (no, it did not succeed with me).
Mmm... too much C++ and ZeroWing will do this to you...
set prompt='All your argv[]s are belong to us: '
What it looks like:
me@machine (01:53:11 PM)(07/06/01)(pts/8)(BG: 0/0)
$
Time, date, terminal,number of backgrounded jobs, and number of backgrounded jobs that are running. It's a little on the complex side, but I like it. All the funky escape codes change the colors (so it works best with a white text on black background)
-- Zack
I think the quote is "The LOVE of money is the root of all evil." Not "Money is the root of all evil."
Somewhat different.
-- Zack
But the main thing is- unless your a fool-
Oh, you know,
Yeah, you know, yeah, you know,
Man, you got to be cool...
- Jeremiah Cornelius Still a Face in my Sun Microsystems shirt!
"Flyin' in just a sweet place,
Never been known to fail..."
Because of the lameness filter, I have put my prompt code here That's Date in red, number of messages in my mail spool file in brighter red, current umask in red, current username and active group name in blue, current path in green, hostname in bright green, current command history number, and exit status of the previous command. It's pretty sick. But it provides lots of information.
-- Erich
Slashdot reader since 1997
Slashdot: for all your self-rightous, hypocritical news!
--
Hmm, in trying to post this, I came across a `lameness filter'. Probably a good idea in most situations, but this post contains a lot of the `junk characters' that it's complaining about. Maybe I just need to fill up some space with real words to offset whatever algorithm you guys are using to determine what shouldn't be posted.
/etc/bashrc:
/etc/jjcolors ] && . /etc/jjcolors
\ w$ BLUE]$RED\\$ $NORMAL"
W \w $BLUE]$CYAN\\$ $NORMAL"
/etc/jjcolors ] && . /etc/jjcolors unset
/etc/jjcolors:
Also, there's the bashish theme engine thingy that some people should look at. I've seen some really amazing prompts (well, sort of -- they don't always work).
In my
[ -f
if [ "$EUID" = "0" ]; then
PS1="$BRIGHT$BLUE[$RED\u$WHITE@\h$BLUE][$YELLOW
else
PS1="$BRIGHT$BLUE[$CYAN\u$WHITE@\h$BLUE][$YELLO
fi
[ -f
In my
if [ "$1" = "unset" ];
then
{
#
# unset all:
#
unset BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE
unset BGBLACK BGRED BGGREEN BGYELLOW BGBLUE BGMAGENTA BGCYAN BGWHITE
unset BRIGHT NORMAL REVERSE BLINK UNDERSCORE
}
else
{
#
# foreground colors:
#
BLACK='\[\033[30m\]'
RED='\[\033[31m\]'
GREEN='\[\033[32m\]'
YELLOW='\[\033[33m\]'
BLUE='\[\033[34m\]'
MAGENTA='\[\033[35m\]'
CYAN='\[\033[36m\]'
WHITE='\[\033[37m\]'
#
# background colors:
#
BGBLACK='\[\033[40m\]'
BGRED='\[\033[41m\]'
BGGREEN='\[\033[42m\]'
BGYELLOW='\[\033[43m\]'
BGBLUE='\[\033[44m\]'
BGMAGENTA='\[\033[45m\]'
BGCYAN='\[\033[46m\]'
BGWHITE='\[\033[47m\]'
#
# attributes:
#
BRIGHT='\[\033[01m\]'
NORMAL='\[\033[00m\]'
REVERSE='\[\033[07m\]'
BLINK='\[\033[05m\]' # doesn't work in xterms
UNDERSCORE='\[\033[04m\]' # only works in xterms
# zzzzzz='\[\033[00m\]' # last env var
}
fi
--
It occurs to me that the linux console and most xterms can switch in and out of a pseudo-vga mode where they can draw line characters to the screen using a standard iso8859-1 font. That's how `make menuconfig' and other menu-driven programs get line characters on the screen.
To go into and out of this mode, use these:
LINE='\[\016\]'
UNLINE='\[\017\]'
The letters `jklmnqtuvwx' correspond to different line characters when in this mode (well, single-line chars, at least).
--
On the various *nix machines I use where I can use zsh (yay programmable completion!):
[arianne:~] michael% echo $PROMPT
[%m:%~] %n%%
Or, in case of bash:
[arianne:~] michael$ echo $PS1
[\h:\w] \u\$
On Windows:
C:\WINDOWS>echo %PROMPT%
$p$g
--
[scott@pytheas] [pts/4] [~]
:-))
[0] [213] %
I use a two-line prompt. Why? Because I can have a really long directory name, and there's still room to type a decent command line without running off the edge of the screen!
(There's actually colour to it too, but I won't post the actual prompt definition, because it's full of literal escape sequences. I knew memorising all those ANSI codes would pay off someday!
\\'
Okay, fine, maybe I will post my actual prompt. It actually does that; the username root will turn up in red; everybody else is cyan. This requires zsh, of course :-).
3 6m %})%n%{ESC[37m%}@%{ESC[36m%}
PROMPT='%{ESC[0;1;37m%}[%(0#.%{ESC[31m%}.%{ESC[
%m%{ESC[37m%}] [%{ESC[36m%}'${ttyprefix}'%l%{ESC[37m%}] [%{ESC[36m%}%~%{ESC[37m%
}]
[%(0?.%{ESC[32m%}.%{ESC[31m%})%?%{ESC[37m%}] [%{ESC[36m%}%!%{ESC[37m%}] %{ESC[33
m%}%# %{ESC[22;36m%}'
POSTEDIT='ESC[0m'
\\'
You're right; it doesn't necessarily show any particular skill. But did you ever consider that it might be useful? My prompt tells me a lot more than the default one does, and I find that useful. I like seeing other people's prompts, because it gives me ideas of useful information that I could include in mine.
Is that a bad thing?
\\'
I use zsh, and I rather like having all of the information I need right on the command prompt. Many things only appear if they are needed (return values from programs for instance) and the prompt string avoids getting too long to leave me room to work my magic:
.../X11R6/share/xmame):
%(!.%B#%b.)<%m/%l> %(?.%{%}.%B%?%b )(%h %B%(4c,.../%3c,%~)%b)%B:%b
An average prompt looks like:
<escaflowne/p7> (128 ~):
A more interesting one:
#<escaflowne/p7> 5 (2
Down that path lies madness. On the other hand, the road to hell is paved with melting snowballs.
I read the internet for the articles.
I get strange looks from my friends for this one:
setenv HOSTNAME `hostname | sed 's/\..*//' | tr \[a-z] \[A-Z]`
set prompt = "C:\\"{$HOSTNAME}"> "
(I switch between machines a lot, so it makes sense to use the hostname rather than the directory name.) However, it gets worse... I once knew a former mainframe guru whose UNIX prompt was configured to look like VM/CMS.
Note that that is the FIRST tutorial. What was the first program you ever wrote? Hello world?
And you must admit it's a hell of a lot better than the kid trying to get started by cracking sites and turning into a script kiddie.
C:\> C:\spot> C:\spot>run run spot run!
set promptchars = '%>': %{\e[${in}%}$SHLVL%{\e[${out}%}][%{\e[${in}%}`whoa mi`@%m%{\e[${out}%}:%{\e[${in}%}%l%{\e[${out}%}]%{ \e[${in}%}%/%{\e[${out}%}%#%{\e[0;0m%} "
{ in}%}$SHLVL%{\e[${out}%}][%{\e[${in}%}`whoami`@%m% {\e[${out}%}:%{\e[${in}%}%l%{\e[${out}%}]%{\e[${in }%}%/%{\e[${out}%}%#%{\e[0;0m%} "
set out='0;37m'
if $?SSH_CLIENT then
set in='0;31m'
else
set in='0;36m'
endif
if ($term == xterm ) then
set prompt = "%{\e]0;`whoami`@%m:%l: %/\007%}%{\e[${out}%}[%{\e[${in}%}%?%{\e[${out}%}
else
set prompt = "%{\e[${out}%}[%{\e[${in}%}%?%{\e[${out}%}:%{\e[$
endif
[0:5][root@eris:pts/6]/root>
[returncode:shlvl][user@host:tty]path
It's red for ssh logins, else it's cyan.
Does the xterm titlebar too.
RPROMPT=' %B%t%b'
prompt="{%U%n#%l@%m:%h%u} %30<...<%~%#"
if [[ $TERM == "*term*" || $TERM_PROGRAM = "Apple_Terminal" ]] {
xterm_prompt=1
prompt="[%U%l:%h%u] %~%#"
}
chpwd() {
[[ -t 1 ]] || return
if [[ -n $xterm_prompt ]] {
print -Pn "\e]2;${USER}@${HOST}:%~\a"
}
}
On tcsh; this is complicated because it uses both xterm and xwsh titles and has to work with an oh-so-lame shell:
if ( $?DISPLAY || $term == xterm || $term == Apple_Terminal || $term == xterm-color ) then 0 44\0573cwd:s|${HOME}|~|\0575\\007\\c\042'"0 44\0573cwd:s|${HOME}|~|\0575\\007\\c\042'"
if ( $term == iris-ansi ) then
# need to use ]2 because xwsh doesn't support ]0 to change
# both window and icon titles...
setenv XTERM_TITLE_ESCAPE '2'
else
setenv XTERM_TITLE_ESCAPE '0'
endif
setenv XTC1 "alias cwdcmd '/bin/echo \042\\033]${XTERM_TITLE_ESCAPE};${USER}@${HOST}:"
setenv XTC2 '$\0573cwd:s|'
setenv XTC3 "${HOME}|~|"
setenv XTC4 '\0575\\007\\c"'
setenv XTC5 "'"
# these actually work, but... whatever... I've spent about 4 hours on this line so far.
#setenv XTC "alias cwdcmd '/bin/echo \042\\033]${XTERM_TITLE_ESCAPE};${USER}@${HOST}:\
#setenv XTC "alias cwdcmd '/bin/echo \042\\033]${XTERM_TITLE_ESCAPE};${USER}@${HOST}:\
eval `echo "${XTC1}${XTC2}${XTC3}${XTC4}${XTC5}"`
set prompt="[%U%l:%h%u] %B%t%b %~%#"
# set prompt = "%{%}%h-%~/%# "
cwdcmd
else
set prompt="{%U%n#%l@%m:%h%u} %B%t%b %~%#"
# set prompt = "%h-%m/%~/%# "
endif
Why, oh why, oh why does Slashdot not support <PRE>? I wish I knew.
--
This isn't really funny. I bet you're the type that watches America's Funniest Home Videos hoping to see someone get hurt.
-Paul Komarek
Ksh will expand environment variables when it diplays, so you can do:
PS1='$PWD$ '
(Note the single quotes)
-Dom
I can't post my .profile since I don't have one (I use .bashrc, etc), but it's not that interesting anyway ... the only interesting thing about it is that it's split up into a .bashrc (and .bash_login, etc) and .bashrc.local (and .bash_login.local, etc). The .local files are for local system settings, the rest are "generic" settings that should work under any *nix.
The non-.local files are managed by CVS; my CVS repository is out there on the 'net on my private server, so from any 'net-connected *nix system with CVS, I can just CVS checkout my init files. Also whenever I change something on one system I can check it in and then update it on the other systems when I get to them.
I even had the idea once of making this a sort of public service - setting up some simple scripts and programs as glue for managing the CVS side of things, and then putting a public CVS server up on the 'net just to allow people to check in their init files. Then someone could easily use this service to keep all of their init files up-to-date and consistent on every system they use.
Actually, I am slowly working on some new OS ideas and one of my ideas is exactly this - a public (secure) repository for user configuration info so that whenever a user of the OS goes anywhere, their preferences can easily follow them.
If anyone else wants to take this idea and run with it, be my guest.
Change someone elses prompt to "". Drives them crazy
until they figure it out.
The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
PS1='\w>'
---
ticks = jiffies;
while (ticks == jiffies);
ticks = jiffies;
Have you read my journal today?
select user_id, lower(username) user_name from user_users where username = user; select lower(substr(global_name,1,(instr(global_name,'.', 1,1)-1))) db_name
from global_name;
rem set the prompt
set sqlprompt "&db_name::&user_name> "
---
ticks = jiffies;
while (ticks == jiffies);
ticks = jiffies;
Have you read my journal today?
Here's how I set it in /etc/profile on all my boxen:
/home/jeh/foo/bar/bletch)
/usr/local/lib/perl/5.6.1)
case $USER in
root)
PS1="(\# \u \h \w)\n>> "
;;
*)
PS1="(\# \u \h \w)\n> "
;;
esac
export PS1
This means that my prompt looks like this if I'm a user:
(1 jeh myhost
>
and as root
(1 root myhost
>>
So I can tell at a glance exactly who and where I am, and still have nearly a full screen width for commandline editing.
Ok, since this post actually elicited email response (which the Kuro5hin one didn't), I've put up a description of my prompt at http://www.geeksimplex.org/phil/prompt/. Enjoy.
--Phil (Yep, I'm replying to one of my own posts.)
355/113 -- Not the famous irrational number PI, but an incredible simulation!
Kuro5hin ran an article on shell prompts recently. Rather than retype everything ('cause I'm lazy), I'll just provide a link to my post about my prompt.
--Phil (Still need to add APM stuff to my prompt.)
355/113 -- Not the famous irrational number PI, but an incredible simulation!
the lameness filter makes this really difficult, so these aren't my favorite but they work.
export PS1='\[\033[1;30m\]--\[\033[0;36m\][\[\033[0;37m\] \d \t \!\[\033[0;36m\]]\[\033[1;30m\]--\[\033[0;37m\]\n\ [\033[1;30m\]--\[\033[0;36m\]]\[\033[0;37m\]\h\[\0 33[1;37m\]:\[\033[0;37m\]\w\[\033[0;36m\][\[\033[1 ;30m\]--\[\033[0;37m\] '
--[Fri Jul 6 08:44:52 333]--
--]ceylon:~[--
export PS1='\[\033[0;36m\][\[\033[1;30m\]+\[\033[0;37m\]\ u\[\033[1;30m\]+\[\033[0;37m\]\h\[\033[1;30m\]+\[\ 033[0;36m\]]\[\033[0;37m\]\n\[\033[0;36m\][\[\033[ 1;30m\]+\[\033[0;33m\]\w\[\033[1;30m\]+\[\033[0;36 m\]]\[\033[0;37m\] '
[+dirt+twist+]
[+~+]
i had more, but man, the lameness filter is pretty lame.
---
---
You are not what you own -- Fugazi, "Merchandise"
Try this in GNU Bash. Maybe on an unsuspecting friend. :)
PROMPT_COMMAND='_pwd=`echo $PWD|\
sed "s:/:\\\\\\\\:g;\
y:abcdefghijklmnopqrstuvwxyz:\
ABCDEFGHIJKLMNOPQRSTUVWXYZ:"`'
PS1='C:$_pwd> '
--
Darren Stuart Embry
--
This web site will cure all your ailments.
I use that on bash, and this in tcsh:
set prompt='[%n@%m %B%~%b]%% '
to get me the same thing (except %B and %b bold (and unbold) the current directory).
It answers almost everything want to know before I type a command: "who am I?", "what machine am I on?", and "where am I in the file system?".
I use it on most systems I use. At work, however, I keep a very spartan root prompt ('# ') to remind me that I should double check everything I do as root. And I do.
...yellow number five, yellow number five, yellow number five...
set prompt="%m %B[%t]%b %n [%/]%#"
tcsh.
You can always put a different .profile in ~root, or add this to your /etc/profile:
if [ "`id -u`" = "0" ]; then
#setup root prompt
else
#setup user prompt
fi
ph33r my prompt! Color, upper asci, username, machine and date!!!
\ [\304\[\033[0;34m\[(\[\033[0;36m\[\u@\h\[\033[0;34 m\[)-(\[\0
3 [0;34m\[\304\n\300[\[\033[0;36m\[\w\[
(Actually I kinda ripped the idea off from Mandrake (the Enlightenment guy), but there are some changes).
export PS1="\[\033[11m\[\033[0;34m\[\332\304\[\033[1;34m
33[1;34m\[\`date +\"%a %B %-d %l:%M%P\"\`\[\033[0;34m\[)\[\033[1;34m\[\304\[\03
\033[0;34m\[]:\[\033[0;0m\[ \[\033[10m"
PS1="\H:\w# "
Work at ISP with literally hundreds of UNIX boxen. This keeps it easy to type (we use kerb and login as root) and doesn't interfere with the other sysadmins preferences.
Secret windows code
Clinton made me a Republican. Bush made me a Libertarian. Trump is making me question reality.
export PS1='\[\e[0;34m\][\[\e[1;34m\]\h\[\e[0;34m\](\[\e
if test $USER = "root" || test $LOGNAME = "root" || test `whoami` = "root" ; then
PS1="\[\e[41m\]\[\e[1;33m\]ROOT: $PS1"
fi
that's for my server machine. My laptop uses this:
export PS1='\[\e[0;32m\][\[\e[1;32m\]\h\[\e[0;32m\](\[\e
I use different colors for different machines. Makes life easier.
--
I noticed
--
I noticed
It's getting about time to leave everywhere
The one point of interest is the 0, which is the termination status of the most recently executed command. This is obtained from bash simply by inserting $? into the PS1 variable.
I got this termination-status-embedding-in-prompt idea from Tanmoy Bhattacharaya.
PS1=$?:\h:\w\$
For some reason I never customized my bash prompt half as much as the MUD. Maybe I should do that now...it would feel like old times.
(hmmmm...now how do I get my current hitpoints in bash...)
Bashprompt, the original BASHISH was cool. I helped the project a little, providing screen captures of the themes, and making a theme of my own for bashprompt. Their server was recently cracked, and they've run out of funding. Lets all pitch in and save this project. Mods: mod this one up please, thx
da w00t.
da w00t. mtfnpy?
set prompt = "%m %~ > "
on another:
set prompt='[%n@%m %c]$ '
on another:
set prompt = '[\!] %m %~ > '
on another:
set prompt = "Stremler> "
on another:
set prompt="[${SHLVL}]${HOST}% "
Etc. Etc.
Hm. All pretty simple.
Amen!
Pick One: http://www-rohan.sdsu.edu/~stremler/sigs/sigs.html (Note - disable Javascript first!)
yes, master? ~
Most of the time my Zsh-prompt looks like this:
juhtolv@heresy :
%
And as a rewt it looks like this:
-=*[ROOT ZSH]*=- root@heresy :
#
In both cases I have RPROMPT like this:
10001 | pts/5
My shell-configs are available here:
http://www.cc.jyu.fi/~juhtolv/configs/shellrc/i
Juhapekka "naula" Tolvanen - http://iki.fi/juhtolv
Or if your prompt is:
$
You spent way too much time learning VAX DCL and no one respects you for it!
My mom always said, "Jim, you're 1 in a million." Given the current population, there are 7000 of me. God help us all!
When I first started using XWindows (being from the Windows world), I put up a screenshot of my windows desktop as the background, and set my commmand prompt to be "c:\", just to make me feel more at home.
<tim><
Years?
Ever?
Can't wait to get home and tinker!
t_t_b
--
I think not; therefore I ain't®
I'm on PJ's "enemies" list! Are you?
it generates a 404...
t_t_b
--
I think not; therefore I ain't®
I'm on PJ's "enemies" list! Are you?
besides being pretty and colorful this prompt is useful as well!
;35m%}>%{\033[0;36m%}%m%{\033[1m%}: %{\033[32m%}%c5%{\033[33m%}%#%{\033[0m%} "
set prompt="%{\033[0;35m%}<%{\033[30;1m%}%h%{\033[0
set rprompt='%S%$note %s [%B%?%b] %D %w %T'
(make sure there are NO spaces in the $prompt variable. even though the above shows a space after a [0)
from right to left:
* history number.
allows you to quickly recall history events you see on screen.
* machine_name:path.
useful if you use rcp or scp, simply copy-paste the relevant part of the prompt to another window:
> scp a.out carl:~/R+D
i used to have my login name there too:
<212>eli7@fuzzy:~/R+D>
which helps if you have different logins on different machines.
<501>ealexand@dubek:~/ckp> scp tmp.c eli7@fuzzy:~/R+D
but the prompt becomes a bit too long.
* a little reminder.
i have a silly alias for taking a small note:
alias note 'set note="\!*"'
if i type "note call home" this will show up on the right hand side of my screen as a reminder.
* exit status.
cant live without it! for those programs that dont bother printing error messages for us humans.
* and finally the date and time.
Try it!
p.s.
if i dont have a color terminal i use:
set prompt="<%h>%m:%c5%# "
or with some c-shells:
set prompt="$hostname> "
I think it's included in the XScreensaver package by Jamie Zawinski (of Netscape fame).
Here's a screenshot, and here's the .bashrc stuff used to do it.
1. C:\>
You are conservative person. It takes you
some time to accept new techology
0. A>
How did you managed to get the generator running all these year in this island? By the way, the Soviet Union disappeared.
I received:
This comment has been submitted already, 276325 hours , 47 minutes ago. No need to try again.
__
__
Men with no respect for life must never be allowed to control the ultimate instruments of death.
GW Bu
Mine is just:
export PS1='\u@\h:\w\$ '
If I'm root I just s/\\\$/#/ instead.
Plain, boring, but highly informative.
Also in my
if [ "$TERM" = "xterm" -o \
"$TERM" = "xterm-color" -o \
"$TERM" = "rxvt" -o \
"$TERM" = "vs100" ]; then
export HOST=`hostname`;
export PROMPT_COMMAND='echo -ne \
"\033]2;$HOST: $PWD\007\033]1;$LOGNAME@$HOST\007"'
fi
- Kazin
"show-me-yours and I'll-show-you-mine"?! What kind of self-absorbed phallic wars are we engaging in here? Personally, I'm beyond a little disappointed that such a supposedly enlightened "geek" culture as Slashdot's could be so preoccupied with something that is nothing more than glorified penis worship. You should all be ashamed of yourselves.
Anyway, here's mine:
PS1="[c=====================8 \W]\\$"
In .profile, using bash:
0 33[0m> "'
PROMPT_COMMAND='PS1="[\t]-------->\n\h:\w\n\u > "'
if test `id -u` = "0"
then PROMPT_COMMAND='PS1="[\t]\n\h:\w\n\033[31;5mROOT\
fi
Simply, a normal prompt looks like this:
[12:40:03]-------->
habitrail:/home/httpd/html/hacksaw
hacksaw >
But if I am su'ed to root, it looks like this:
[12:41:00]
habitrail:/home/httpd/html/hacksaw
ROOT>
Where the word ROOT is in red.
The root account has its own standard prompt, which I left alone to remind me when I am using root's environment instead of my own, with its different paths and aliases.
And, of course, I use sudo as much as possible.
All the technology in the world won't hide your lack of vision, talent, or understanding.
in 4DOS box under windows (need ansi.sys)
prompt `[$n:%@label[$n]] $e[7m%_cwp $e[0m$h %% `
in BeOS:
PS1="[\h] \[\e[7m\w\[\e[0m \! % "
--
"Science will win because it works." - Stephen Hawking
Heh. And I was just about to make a "Feh, bash" post.
/. posts very well.
I like using zsh's RPROMPT, though the results don't show up in html
(I keep RPROMPT set to '[%!]'.)
--
Do you have a
Strikes me as just a touch redundant, no?
(I mean, do you really need both %m and %M both in PS1, and both %d on the left and %~ on the right?)
--
Do you have a
Mine is fairly simple, but I like it. (I wonder if this will make it past the lameness filter.)
export PS1='%B%m%(?..[%?])%(#.#.)%b '
export PS2='%B%_%(#.#.)%b '
export RPS1='%B%~:%*%b'
Explanation:
PS1 is the left-side prompt for normal commands, PS2 is for inside things like for & while loops. RPS1 is the right-side prompt for normal commands. All prompts are bold. PS1 is the machine name, the exit status (if non-zero) and then '#' if uid=0. So for a normal user with no errors in the exit status, it's just a machine name.
PS2 lists the blocks I'm in (e.g., "for then" if I'm inside of an if block inside a for block). Then, if root, '#'.
RPS1 is the tilde-encoded directory (e.g., '~' for home dir) followed by a ':', followed by the time.
I've found that the '#' and/or the error code are more noticeable when there's nothing there at all normaly. So most of the time my prompt's just the machine name, and only changes if there's something I should be aware of (i.e., I have root or a command failed).
Even better, though, is that I have "user@host:/dir" in my xterm (well, aterm, actualy) title bar:
precmd () {print -Pn "\e]0;%n@%m:%~\a"}
Great when I have a bunch of shells open and I'm looking through a menu for a particular shell session.
#Kewl funky looking prompt stuff4 \
S 2=$COLOR1$GRAD1$COLOR3$GRAD2$COLOR4$GRAD1$COLOR5'> ' $GRAD0' '
GRAD0='\[\033[00m\]'
GRAD1='\[\333\262\261\260\]'
GRAD2='\[\260\261\262\333\]'
COLOR1='\[\033[01;32;46m\]'
COLOR2='\[\033[00;30;46m\]'
COLOR3='\[\033[00;34;46m\]'
COLOR4='\[\033[00;34m\]'
COLOR5='\[\033[00;32m\]'
COLOR6='\[\033[01;37m\]'
COLOR7='\[\033[01;32m\]'
COLOR8='\[\033[00;37m\]'
PS1=$COLOR3$GRAD1$COLOR2'\h'$COLOR3$GRAD2$COLOR
$COLOR6' \d '$COLOR5'-'$COLOR6' \t'$NONE'\n'$COLOR5'\u'$COLOR8':'$COLOR7'\w'$COLP
US Citizen living abroad? Register to vote!
Maybe that's what I miss most about MSDOS. It was crippled and badly designed and basically useless, but I never, ever saw it crash.
[start][run] :)
All of these prompts have a lot of (what some would call superflous) information in them--I usually use prompt1, and I use all of the information it provides me on a regular basis. zsh's RPROMPT feature (which allows you to have part of the prompt tacked onto the right side of the terminal) is especially handy here, as it makes everything feel less cluttered. (There's no way in hell I'd have all that information otherwise--I'd be rather annoyed to have half of my screen real-estate gobbled up mercilessly by my prompt.)
I'm of the opinion that those who complain about prompts with lots of information are
Just my
--
Ben Winslow..........rain@bluecherry.net
bluecherry internet..http://www.bluecherry.net/
looking at this closely, those are backticks, which means that's shell code, I wouldn't run that if I were you, especially as root. I'm much to lazy to figure out what it does.
---
While I see we have the same taste in prompts, I go about it a little different, plus I throw in a few colors for easy recognition.
\ ]@\[\033[31m\]\h\[\033[0m\]:\[\033[33m\w\[\033[0m\ ]\$ '
;;
xterm|xterm-*)
export PS1='\[\033]0;\u@\h:\w\007\[\033[32m\]\u\[\033[0m
-- "it's not enough to be a great programmer; you have to find a great problem" - Charles Simonyi
For those not using zsh, you can use something like PS1="`whoami`:`hostname`% ".
--
setopt AUTO_LIST AUTO_MENU
PROMPT='%m}%~> '
Give zsh a shot. It really is pretty cool.
-Peter
. Penguins Surely Ca
Back in the day, I had this leet-o prompt on my DOS box that was a little Texas flag made from an asterisk and a little high-ascii block. I wonder, first off, if any *nix terminal emulators will support all of those old ANSI drawing characters and if anyone still has this prompt lying around.
BTW, remember ANSI bombs? heehee
--
You know? I thought it was only select crazy idiots like me who spent hours mindlessly customizing the perfect prompt..
3 7;43m\] \u[\!]\[\033[00;31;43m\]\260\261\262\333\[\033[00; 31;40m\]\333\262\261\260\[\033[m\]'
/$USER = '/root/' ]
\ [\033[m\] '
Here's the fire-looking prompt that was so popular a coupla years ago. (requires ANSI fonts)
fp ()
{
PS1='\[\033[01;33;43m\]\333\262\261\260\[\033[01;
}
But now, I have something a little more "proffessional". The idea is to have your root and user prompts look really different, and have the path in the title bar. Also, high legibility when backscrolling.
The extra stuff is to show your shell depth. (How many subshells you have) This is mostly to make figuring out which terms have screen running on them.
SHELL_DEPTH=$(expr $SHLVL \- 0)
export SHELL_DEPTH
# The Standard prompt (blue for users, green for root)
if [ $HOME = '/root' -o
then
PS1='\[\033[34;42m\]\u@\h[\!]\[\033[00;31;42m\]\$
else
PS1='\[\033[34;46m\]\u@\h[\!]\$\[\033[m\] '
fi
PS2="++>"
# Prepend a shell level "sticker" to indicate a screen session/subshell
# (Less to compensate 1 for X-window local connections)
MY_SHELL_DEPTH=`expr $SHELL_DEPTH - 1`
if [ $MY_SHELL_DEPTH -gt 0 ]
then
PS1='\[\033[31;46m\]'${MY_SHELL_DEPTH}'>'${PS1}
fi
# PROMPT_COMMAND="echo '(wd: ' \$PWD')'"
PS1='\[\033]0;\u@\h: \w\007\]'${PS1}
--
#include <malloc.h>
--
#include <malloc.h>
free(your.mind);
You should read the Bash-Prompt HOWTO for more
/usr $
.bashrc.
information.
My prompt changes colour according to the
logged-in user. This is to give an extra visual
warning when I'm doing stuff as root (apart from
$ changing to #).
[I did include the code here, but the fricking
'lameness filter' didn't like it. That
thing really needs to be turned off for
non-anonymous posts. Anyway, please look at
<http://www.doc.ic.ac.uk/~epa98/.bashrc> for my
prompt (roughly in the middle) and other fun
stuff.]
The prompt looks like
eavis@m
ie username@hostname current directory $
in light blue (cyan). When root, it's red with
the final character a #. When running as some
other user, it turns orange.
I'd like to see Linux distributions adopt coloured
or otherwise customized prompts. Each user could
have an ~/.prompt file or something. Easier than
editing your
Although actually Linux distros do a much better
hob of making the prompt informative than the
single character you get by default on many
proprietary Unixes.
-- Ed Avis ed@membled.com
PS1="[\u@\h \t \w]\$ "
PS1=" ::= "
Just junk food for thought...
export PS1='C:`pwd | sed s/\\\\\//\\\\\\\\\\\\\/g | tr a-z A-Z`> '
I've been using this for years. Does everything I need it to w/o being too much clutter:
My .tcshrc has:
which produces:
I don't expect anyone to read this, but I figured I'd at least post for posterity. Maybe someone will find it useful.
Without you I'm one step closer to happiness without violence.
If I'm on a plain VT100:
If I'm in an XTERM window, I like to have some info in the title bar:
That ^G is a Control-G (ASCII BEL). This is part of the escape sequence XTERM uses for setting its title bar. I suppose I could've used \007. Ah well.
--Joe--
Program Intellivision!
Mandrake (of enlightenement and other fame) has/had his prompt on his site (mandrake.net) and I took it and modified it to my liking. Here it is.
TERMIMON=`tty|cut -d/ -f3`
COLOR1="\[\033[1;36m\]"
COLOR2="\[\033[1;34m\]"
COLOR3="\[\033[1;33m\]"
COLOR4="\[\033[0m\]"
export PS1="$COLOR3<DA>$COLOR3<C4>$COLOR2[$CO LOR1\u$COLOR3@$COLOR 1\h$COLOR2]$COLOR3<C4>$COLOR2[$COLOR1$TERMIM ON$COLOR2] $COLOR3<C4>$COLOR2[$COLOR1\$(date +%I:%M%P)$COLOR3:$COLOR1\$(date +%m/%d
/%y)$COLOR2]$COLOR3<C4>$COLOR3<C4>$COL OR4\n$COLOR3<C0>$COLOR3<C4>$ COLOR2[$COLOR1\w$COLOR2]$COLOR3>$COLOR4 "
This shows user@host, current tty your on, time, and date on first line. Second line shows pwd. And its in shiney pretty colors! I have a different color scheme for users than for root. This one is for users. I don't thing any of the characters got munged by the html-ification of it. Looks like there are some extra spaces that get added for some reason. Anyway, there it is.
Pretty basic, but then I'm more for minimalistic sorts of things. For example I don't use GNOME, KDE or CDE, but I like FVWM or Enlightenment.
--
"If you insist on using Windoze you're on your own."
"If you insist on using Windoze you're on your own."
I don't mean this critically - I would actually really like to put some eye candy on my display. I just don't have time. Hacking prompts doesn't benefit me, so I don't do it. Adding eye candy might benefit me, but there are so many ways to do it that I just haven't spent the time to choose one yet, and TBH I don't know when I'll get a chance. :'}
Seriously, next time you spend an afternoon tweaking your computer to look cool, think for a minute about how much useful documentation you could have added to your favorite open source project, or the feature you could have hacked, or whatever, instead. You've got to chill sometimes, and environment hacking is one way to do it, but it can be a vice if you do it too much.
This is of course somewhat tongue-in-cheek - I use tcsh and my prompt tells me what machine I'm on - but the idea that hacking your prompt is geekitudinal is kind of silly. Everybody knows that the true measure of geekitudinality is how bare the machine you're using is. Real geeks use the ITS debugger as their command prompt. :')
does anyone know how to do a 2 line prompt in zsh?
Living in several networks I like to have intuitive signal where I am by first making the hostname standout (colored) and second using different colors in different networks.
] :\W>
This is one of them
\[\033]0;\h:\w\007\]\u@\[\033[1;34m\]\h\[\033[0m\
-- a blessed +42 regexp of confusion (weapon in hand) You hit. The format string crumbles and turns to dust
for tcsh:
set prompt=' %n@%U%m%u:%/%% '
This way you can easily cut and paste into an scp command.
Also, I use underline for the machine name so that it stands out to mor easily see which machine you are on. I also set underlined chars to show up as yellow in my color xterms(black bg, cyan text).
--
> Consider yourself lucky, it was easy enough to generate a general protection fault.
In DOS? Um, with all due respect, no.
DOS didn't take advantage of any of the facilities that the 80286 and later processors provided for multiuser operating systems. There was no concept of rings, or of kernel code having a greater privilege level than user code. So you'd never get anything as helpful as a GPF or SEGV.
It was incredibly easy to get DOS to crash, but that was something that usually happened as a result of some errant user program scribbling on the global interrupt vector starting at 0000:0000, which would generally just leave you completely hosed until you did a hard reset. Ah, DOS. How I don't miss you.
spawn_of_yog_sothoth
For years i've continued to be amazed by the fact that people are still using bash, when zsh is backwards compatible, and superior in every way.
Beware: Everybody who tries zsh will never use another shell again, and will be angry whenever they have to work on a machine that doesn't have zsh installed. Unfortunentely its default tab completion settings are not very good, so you need the options i present here.
It's tab-completion control and configurability is unparalleled. It can even be set to either bash or c-shell junkie mode to emulate your favorire shell before you see the light.
Try putting this in /etc/zshrc (remove old junk RedHat keep there, or just add this)
# tune the tab completion and other options.
# yes you can tab-complete "setopt", and see all the options!
setopt autolist autoremoveslash correct nohup nobeep extendedglob appendhistory \
listtypes histignoredups hashcmds hashlistall histnostore histignorespace
# and remember your history between logins
HISTSIZE=5000
SAVEHIST=100000
HISTFILE=$HOME/.zshhist
# show user@host:/path in xterm title bar
# maybe you want an if [[ $TERM != linux ]]; wrapped around this.
precmd() { print -n "\033]0;Terminal: $USER@$HOST:$PWD\007" }
You can't affect a parent shell from a subshell in any way that I am aware of.
I guess my statement was too wide-reaching. ;-) I meant that you can't execute commands/change environment variables/etc. i.e. you can't do damage in a parent shell from a child su nobody'd shell. Sure you can kill it, but you can't 'rm -rf /'.
I have to have colored prompts. I use them to designate what disto that computer is running or what that computer is used for. I use 2 diffrent ones for now. One for my slackware boxes and the other one for my debian boxes.
/etc/prompt. My .profile simply has:
/etc/prompt`
\ [\033[01;35m\]\d\
[ \[ \033[01;31m\]\t\
- \[ \033[00;34m\]=:\
m \] \[\033[00;34m\]\[\033[00;37m\]
d \[\033[01;35m\]>\[\033[01;35m\]:\
Since I wanted to test making prompts quickly I put them in seprate files and date them. Then I symlink that file to
PS1=`cat
I use extended ASCII so these may not come through correctly, but here is my slackware prompt:
\[\033[00;34m\]ÚÄ\[\033[01;34m\]®\[\033[00;36m\][
\[\033[00;36m\]]\[\033[01;36m\]ð\[\033[00;36m\]
\[\033[00;36m\]]\[\033[01;36m\])\[\033[01;34m\]
\[\033[01;37m\]ù\n\[\033[00;34m\]ÀÄ\[\033[01;34
and my debian prompt:
\[\033[00;35m\]ÕÍ\[\033[01;35m\](\[\033[00;36m\]\
\[\033[00;35m\])\[\033[00;37m\]
Also since the 2.2.x kernels the extended ASCII dosen't show up correctly. Though if I run bitchx and quit then that terminal shows correctly. Does anyone know how to make this work at boot time?
-magister-
I enjoy the likes of zsh, and use RPS1 for a prompt on the right side of the screen:
PS1="%B%t%b-%m%# "
RPS1=" %h:%B%c%b"
---
---
"To know recursion, you must first know recursion."
What's going to stop someone from just putting "exit" into the commands run, thereby hosing your system?
Don't follow his advice. If you must try every prompt here, I recommend gettng VMWare or using a machine that you were going to completely wipe later today anyway.
If tits were wings it'd be flying around.
set prompt="[%P] %B%n@%M%b:%l [%~] (%?)\nprompt-fu =%# "
yes, I did waste some time reading the tcsh man page. yes, it was worth it.
> For root, substitute final > with #
actually, just use %# instead, tcsh will replace it with a # if the user is root, and with > otherwise. cuz tcsh rocks like that.
PS1=$'%{\e[m\e]2; ['"$WINTITLE"$'] %m - %~ \a\e[m%}%(#.#.$) '
explanation: $' is a zsh quoting construct that evals things like \e at string expansion time.
alias setprompt 'set prompt="(`uname -sr`)[$cwd] %t\\
{\!} --> "'
alias cd 'chdir \!* ; setprompt'
setprompt
And my root shell is bash:
PS1="(`uname -sr`) [\u] [ \w] \n \! \$ --> "
mp
"The secret to strong security: less reliance on secrets." -- Whitfield Diffie
--
ZSH, baybe!!!
PROMPT='%(!..{)%n@%m':'%~%(!.#.}) '
-- Grey d'Miyu, not just another pretty color.
This puts my username, host and working directory in both my prompt and my xterm window title. Put it in /etc/profile on all machines you use and you always know where you are :) Only works if your shell is bash, though.
;;
;;
case "$TERM" in
xterm|xterm-*)
PS1='`echo >&2 -en "\033]0;\u@\h:\w\007"`\u@\h:\w\$ '
*)
PS1='\u@\h:\w\$ '
echo "Non-xterm: window-title functions disabled"
esac
PS1=$'\\[\\033[1;34m\\]\\h\\[\\033[31m\\] = = = - - -\\n\\[\\033[0m\\]\\!:\\u:\\w>'
Produces:
machinename = = = - - -
2218:username:~>
The 2218 is the number of commands, make sure to increase the history amount.
And the machine name is red, and the symbols after are blue.
You do know that if you're using bash, you can get the hostname up to the first . with \h, don't you?
I have a Mac here, so in my house a command prompt is something that triggers my wife to bark orders at me. :)
grub
yes it's a joke
Trolling is a art,
Keep in mind that reusing the same dummy account all over the place may undermine the inherent security and other benefits of using that user. Each service should have its own dummy user (typically named after the service) so that cracking one service doesn't allow the intruder to affect other services. (Historical note: 'nobody' and 'nogroup' were created specifically to handle unrecognized uids/gids encountered by NFS-using systems. They were never intended to actually own any files or processes.)
You may also want to make a chroot jail. Make a temporary directory, (say, /test). Copy /bin to /test/bin, /lib to /test/lib, and /usr/lib to /test/usr/lib. Then "chroot /test bash" after loging into nobody.
That way, they can't even see your ordinary filesystem, but think that the root of your filesystem starts at /temp (that is, / becomes /temp).
yes, i'm an E fanatic and all the time spent staring at raster's screenshots must have warped my mind, so i blame him ;)
\ 30 0\304\304|hi \u|\304\304\331 \w \$ \[\e[1;37m\]"
here's my prompt:
PS1="\[\e[1;34m\]\332\304\304|\T|\304\304\277\n
btw, for a good ansi font, try smoothansi ('s what i'm using) and a nice tutorial on how to begin building incredibly interesting and not all that useful prompts, check out keebler's page on it:
http://knuckle.sandwich.net/ansi.html
-dk
-dk
Dream with the feathers of angels stuffed beneath your head.
Anyway, I picked this up from a colleague in CHUUG:
(the spaces are important). The handy thing about this (assuming you're a bash/ksh/zsh/ash/sh user) is that ":" is the proverbial "ignore me" command, and y'all know what the semicolon does. So this way, you can cut and paste whole lines without worrying about any crap^H^H^H^Hcute metacharacters in your prompt getting in the way and creating all sorts of useless crud (for those who use angle brackets).
-- This
There was a feature that Slackware had which you can setup your own weird fonts in the console prompt or by SSH.
I been trying to figure out which one it is that I can grab and install so that I have fun with it. I was fun with the lazy fonts that I messed with years ago.
-- Amazing how the Internet still humms along.... -- Dispite all the flaws of Micro$oft in their software!
Simple, really. And, unlike using colored windows, the prompt actually stays correct whenever you ssh from one machine to another.
I also put the hostname in the window titlebar. 'Useful for finding the apropriate window when it is iconified. I haven't figured out how to make the title bar actually track the hostname though.
If you change "alias l.='ls .[a-zA-Z]* --color=tty'" to "alias l.='ls .[0-z]* --color=tty'" it will be a little more usefull.
the trick is to escape shell processing when defining PS1:
PS1=`hostname`':$PWD$ '
gives:
genesis:/usr/local$ _
tcboo
This shows me the basename of my current directory. Another good setting is PREFIX=$HOME/, which displays my current working directory as a relative path to home (if I'm under it), otherwise the complete pathname. Note that $PREFIX is a glob pattern, not a regular expression.
I don't use VT100-style colour changes in my prompts, because they don't play well (for example) within an Emacs shell buffer.
Thanks (does slash 2.x support editorial comments like scoop?)
This is by far the best AskSlashdot topic in recent memory (that goes all the way back to March, in my case...:)
PS1='[\h:\w] \u$ '
(Yes, it's the same as in OS X. I just happen to like it.)
-- Veni, vidi, dormivi
i dont have time to mess around with changing silly command prompts. no matter what the OS, it's the default.
function fire
{
local COLOR_RED='\[\033[00;31;40m\]'
local GRAD0='\[\033[00m\]'
PS1="$COLOR_RED\h$GRAD0 "
}
function green
{
local COLOR_GREEN='\[\033[0m\033[32;40m\]'
local GRAD0='\[\033[00m\]'
PS1="$COLOR_GREEN\h$GRAD0 "
}
if [ $UID == '0' ] ; then
fire
else
green
fi
Simple... but it keeps me from destroying stuff as root and not knowing it...
Telcos have alot of dark fibre in the States. Most people assume that's optical fibre...but it's actually moral fibre.
PS1="[\h][\w] : "
In longhand, it shows [Hostname][Fully Expanded Path] username :
Bowie J. Poag
If you're looking for a unique way to crash the almighty pound bang slash bin slash bash, try this on:
PS1=`cat
Whammo. No more xterm.
Then again, a 256MB-long shell prompt may not be such a good idea, but its a bug nonetheless.
Bowie J. Poag
I can relate, having typed reboot on a core server thinking I was in a development server (on a real time stock quotation system...) you can imagine my chagrin.
We are the mutts...
but not bell boys.
PS1=$'\\[\\033[34m\\][\\[\\033[1;37m\\]\\@\\[\\033 [34m\\]]\\[\\033[32m\\]\\u\\[\\033[1;37m\\]@\\[\\0 33[31m\\]\\h\\[\\033[1;37m\\]:\\w\\[\\033[34m\\]>\ \ [\\033[0m\\]'
I wonder if they disabled the lameness filter for this story...
set prompt="%{\033]0;%n@%m:%~\007%}"
This puts the info for the current user@host:directory in the title bar.
if ( $?term && "$shell" =~ *tcsh) then
if ( "$term" =~ xterm* ) alias cwdcmd 'echo -n "^[]2;${HOST} - ${cwd}^G"'
endif
set hostname=`echo $HOSTNAME | sed "s/\..*//"`
set euser=`whoami`
if ( "$euser" == arensb ) then
if ( "$shell" =~ *tcsh ) then
set prompt = "%U[\!]$hostname >%u "
else
set prompt = "[\!]$hostname > "
endif
else
if ( "$shell" =~ *tcsh ) then
set prompt = "%S[\!]$hostname($euser)>%s "
else
set prompt = "[\!]$hostname($euser)> "
endif
endif
-----
No, this isn't flashy. But if I'm su-ed to someone
else, the prompt is in inverse video rather than
underlined.
The hostname and current directory go in the
xterm title bar, rather than cluttering up the
prompt.
This is very handy to remind yourself who
and where you are at all times.
if ( $?prompt ) then
set prompt="%B%S%m%s:`whoami`%b \!> "
endif
--
Why not extend the terminal standard to support full RGB? The syntax could look like:
\033[33;155;255R
Then, for example, you could have a different colored prompt for each of your boxes. Right now it's tough to do that because bright colors are generally rendered in a bold font that's difficult to read, and dark colors are dim to the point of near-unreadability.
What do you all think? Am i dumb or is this something you would use?
--
--
Mod up a post Rob doesn't like and you'll never mod again
BTW, i have a neat case
I'd love to paste the code, it's pretty neat, but apparant Slashdot's braindead filters thinks it's too lame.
If you're interested, email me. Here's a screenshot:
[~]$ true
[~]$
[~]$
[~]$ false
[~] (1) $
[~]$
[~]$
--
--
Mod up a post Rob doesn't like and you'll never mod again
Set a password on the nobody account and give it a shell... so you can log in.
/bin/sh
passwd nobody
chsh nobody
then telnet into your box:
telnet 127.0.0.1
login as nobody.
Then they can put in all the exits they want and it won't make a diff, especially if you use something like ktelnet or gtelnet.
My journal has hot
[eom]
Blar.
set prompt="%{^[[1;32;40m%}%t-%n@%m\n%/%{^[[0;37;40m%} > "
> Use color !
Most of DEC's black-and-white VT terminals supported some kind of character-graphics display, where each "letter" was drawn as a little line or box or circle (etc) when you escaped into graphics mode. So people would use escape their prompt definitions and use strings that would result in images for their prompts.
--
Sheesh, evil *and* a jerk. -- Jade
Also, since I very frequently use OpenSSH to connect to a few other systems, I change out the {} for (), [], etc on the various systems, so I can tell at-a-glance that the prompt is not coming from my home system. (It's surprising how well that little change catches the eye.) I rarely use ssh to connect to more than a couple of machines at a time, so I don't really need the hostname as part of my prompt.
--
Sheesh, evil *and* a jerk. -- Jade
in my .bashrc:
.../\W> '
HOSTNAME=`uname -n`
TTY=`tty`
PS1='\n\u@${HOSTNAME%%.*} $TTY
A leading newline to separate the prompt from the previous command's output. usr@host so i know what user i'm logged in as and on what machine (i chop off any trailing domains). I include the tty so if the shell gets hosed i can find it with "ps" in another window and kill it. Round it out with the last component of the directory to remind me where i am (roughly) in the directory tree and I've got all i need.
--
Moderation in everything, including moderation.
And why wouldn't it? .bashrc gets read by
any interactive shell, and if it's in .profile,
sudo bash --login ought to do it.
imho, you ought not be handing root shells out through sudo, but hey, it's your box.
Code or be coded.
oops, i should have said 'any interactive bash' and not 'any interactive shell'
Code or be coded.
I set my prompt to something simple under X windows, but set the window title to the hostname and current working directory. If I'm not on an xterm, then I set the prompt to hostname and current working directory. Note that the "ESC]" is really an escape-] and the ^G is really a control-G. I generally scp my cshrc file everywhere as I have yet to figure out how to do these keys right under vi...
:$cwd^G"'
I use this all the time under Solaris and OpenBSD, so I assume it will work for that other popular Unix-like OS.
Thanks to Jim Martin and Walt Drummond as I stole this from them back in `92.
Using tcsh:
set cwd=`pwd`
if ( $?LEVEL ) then
@ level = $LEVEL + 1
else
set level = 1
endif
setenv LEVEL $level
set eop = "+"
if ( `whoami` == "root" ) then
set eop = "#"
endif
set mopc = ':'
set mop = ''
repeat $LEVEL set mop = `echo $mop$mopc`
if ($?DISPLAY) then
alias printtab 'echo -n "ESC]2;$HOST
set prompt = "$HOST $eop>> "
alias cd 'cd \!*; printtab'
else
alias getprompt 'set prompt = $HOST$mop$cwd$eop'
getprompt
alias cd 'cd \!*; getprompt'
endif
unset mopc
Press ctrl+alt+delete to login. I also click on Start to shut down.
Is is just me, or is there something really really wrong with this (aside from the obvious references to the manufacturer)?
You never really know how close to the edge you can go until you fall off.
Mine looks sorta like this, with some color added:
-[hynfiecl@xenos:~]--- ---[2001/07/06-11:05:42]-$
I have a pretty nasty script that hacks it together. I wrote it after reading the Bash Prompt HOWTO and visiting a Bash themes site that has since been haxx0red. There are more good example prompts, though, at this site. Here's my script, base 64 encoded (sorry, but uuencoding is not conducive to slashposting):
IyEvYmluL2Jhc2gKCmZ1bmN0aW9uIF9wcm9tcHQgewoJbG9jYXSIKCWxvY2FsICAgICBibGFjaz0iXFsbWzA7MzBtXF0iCglsb
OzM0bVxdIgoJbG9jYWwgICAgIGdyZWVuPSJcWxtbMDszMm1cX
XFsbWzA7MzZtXF0iCglsb2NhbCAgICAgICByZWQ9IlxbG1swO
cGxlPSJcWxtbMDszNW1cXSIKCWxvY2FsICAgICBicm93bj0iX
ICAgIGdyZXk9IlxbG1swOzM3bVxdIgoJbG9jYWwgICBka19nc
Y2FsICAgbHRfYmx1ZT0iXFsbWzE7MzRtXF0iCglsb2NhbCAgb
IgoJbG9jYWwgICBsdF9jeWFuPSJcWxtbMTszNm1cXSIKCWxvY
MzFtXF0iCglsb2NhbCBsdF9wdXJwbGU9IlxbG1sxOzM1bVxdI
WxtbMTszM21cXSIKCWxvY2FsICAgICB3aGl0ZT0iXFsbWzE7M
ZXY9IlxbG1s1bVxdIgoKCWxvY2FsIEg9JG5vbmUkYmxhY2sKC
JE0KCWxvY2FsIFQ9JG5vbmUkZ3JleQoJbG9jYWwgUD0kVAoJb
IiRESVNQTEFZIiA9ICc6MC4wJyBdCgl0aGVuCgkJbG9jYWwgR
CWxvY2FsIEI9IsAiCgkJbG9jYWwgTD0itCIKCQlsb2NhbCBSP
Ii0iCgkJbG9jYWwgQT0iICIKCQlsb2NhbCBCPSIgIgoJCWxvY
XSIKCWZpCgoJaWYgWyAtbiAiJEJBU0hfVkVSU0lORk8iIF0KC
JHtBfSR7RH0ke0x9JHtUfVx1JHtQfUAke1R9XGgke1B9OiR7V
fSR7Un0ke0R9JHtEfSR7RH1cCiQoX3Byb21wdF9tb3ZlX3JpZ
ZV9sZWZ0IDI1KVwKJHtIfSR7RH0ke0R9JHtEfSR7TH1cClwkK
e1R9JW0ke1B9LyR7VH0lZCR7UH0tJHtUfSVIJHtQfToke1R9J
fSR7Un0ke0R9XApcblwKJHtIfSR7Qn0ke25vbmV9XCQgXAoiC
fXske1R9XHUke1B9QCR7VH1caCR7UH06JHtUfVwke1BXRH0ke
cmlnaHQgMTMyKSQoX3Byb21wdF9tb3ZlX2xlZnQgMjApXAoke
JVkke1B9LyR7VH0lbSR7UH0vJHtUfSVkJHtQfS0ke1R9JUgke
XCIpXAoke0h9fVwKXG5cCiR7SH17JHtncmV5fVwkJHtIfX1cC
CVBTMj0iXAokKF9wcm9tcHRfcG9zX3NhdmUpJChfcHJvbXB0X
KF9wcm9tcHRfbW92ZV9yaWdodCAxMzIpXAoke0x9tFwKJChfc
fcAke019JHtEfSR7SH0oXAokKF9wcm9tcHRfcG9zX3NhdmUpJ
MTMyKSQoX3Byb21wdF9tb3ZlX2xlZnQgMilcCiR7SH0pJHtNf
X3Bvc19sb2FkKVwKJHtOfSBcCiIKCWV4cG9ydCBQUzIKCWV4c
dW5jdGlvbiBfcHJvbXB0X21vdmVfdG8gewoJZWNobyAiXFsbW
bgp9CgpmdW5jdGlvbiBfcHJvbXB0X21vdmVfdXAgewoJZWNob
cm4KfQoKZnVuY3Rpb24gX3Byb21wdF9tb3ZlX2Rvd24gewoJZ
ZXR1cm4KfQoKZnVuY3Rpb24gX3Byb21wdF9tb3ZlX3JpZ2h0I
IgoJcmV0dXJuCn0KCmZ1bmN0aW9uIF9wcm9tcHRfbW92ZV9sZ
RFxdIgoJcmV0dXJuCn0KCmZ1bmN0aW9uIF9wcm9tcHRfcG9zX
XSIKCXJldHVybgp9CgpmdW5jdGlvbiBfcHJvbXB0X3Bvc19sb
CglyZXR1cm4KfQoKZnVuY3Rpb24gX3Byb21wdF9jbGVhcl9zY
XF0iCglyZXR1cm4KfQoKZnVuY3Rpb24gX3Byb21wdF9jbGVhc
S1xdIgoJcmV0dXJuCn0KCmZ1bmN0aW9uIF9wcm9tcHRfY2hhc
ICAgICAgMCAgIDEgICAyICAgMyAgIDQgICA1ICAgNiAgIDcgI
IGQgICBlICAgZiAKICAweDAwOiAKICAweDEwOiAKICAweDIwO
ICAgJSAgICYgICAnICAgKCAgICkgICAqICAgKyAgICwgICAtI
ICAgMSAgIDIgICAzICAgNCAgIDUgICA2ICAgNyAgIDggICA5I
ICA/IAogIDB4NDA6ICAgQCAgIEEgICBCICAgQyAgIEQgICBFI
ICBLICAgTCAgIE0gICBOICAgTyAKICAweDUwOiAgIFAgICBRI
ICBXICAgWCAgIFkgICBaICAgWyAgIFwgICBdICAgXiAgIF8gC
ICAgYyAgIGQgICBlICAgZiAgIGcgICBoICAgaSAgIGogICBrI
eDcwOiAgIHAgICBxICAgciAgIHMgICB0ICAgdSAgIHYgICB3I
ICB9ICAgfiAgICAKICAweDgwOiAgIIAgICCBICAggiAgIIMgI
MDogICAgICAgiSAgIIogICCLICAgjCAgIAogIDB4YTA6ICAgo
ICAgpiAgIKcgICCoICAgqSAgIKogICCrICAgrCAgIK0gICCuI
ICAgsiAgILMgICC0ICAgtSAgILYgICC3ICAguCAgILkgICC6I
CiAgMHhjMDogICDAICAgwSAgIMIgICDDICAgxCAgIMUgICDGI
ICDMICAgzSAgIM4gICDPIAogIDB4ZDA6ICAg0CAgINEgICDSI
ICDYICAg2SAgINogICDbICAg3CAgIN0gICDeICAg3yAKICAwe
ICDkICAg5SAgIOYgICDnICAg6CAgIOkgICDqICAg6yAgIOwgI
ICDwICAg8SAgIPIgICDzICAg9CAgIPUgICD2ICAg9yAgIPggI
IP4gICD/IApFT0YKCXJldHVybgp9CgpfcHJvbXB0ICRURVJNC
Mine fiddles with my Xterm's title bar so it says "Terminal (user@host)". Great so you don't try to "sudo halt" your server by accident.
I was going to post it here, but the /. lameness filter flags it as random characters. It's from the BASH Prompt HOWTO, section 5, slightly modified.
Greg
PS1="/."
If "disco" means "I learn" in Latin, does "discothèque" mean "I learn technology"?
This is about 3-4 years old, i don't remember where i copied it from. It displays the full path on the window title:
0 7"'
if [ "$TERM" = "xterm" -o "$TERM" = "xterm-color" -o \
"$TERM" = "rxvt" -o "$TERM" = "vs100" -o "$TERM" = "dtterm" ]
then
export PROMPT_COMMAND='echo -ne "\033]2;$HOSTNAME:$PWD\007\033]1;$LOGNAME@$HOST\0
else
export PROMPT_COMMAND=' '
fi
Then the PS1 just reflects the current dir, for a quick reference.
export PS1="[\h:\W]\\$ "
Ok, I'll send mine too. What the hell. This makes the username teal (or red if you're root), the hostname bright white, and the current dir in dark blue. Also, for some reason, I dig the C-shell style percent sign instead of '$'. Don't ask me why. :)
\ [\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]%'
\ [\033[0m\]:\[\033[1;34m\]\w\[\033[0m\]#'
this is what I use:
export PS1='\[\033[1;36m\]\u\[\033[0m\]@\[\033[1;37m\]\h
I use this for root:
export PS1='\[\033[1;31m\]\u\[\033[0m\]@\[\033[1;37m\]\h
There's probably a better way to do this, but this is how I make sure fetchmail is always running.
[ -z "$(ps x|grep fetchmail|grep -v grep)" ] && echo "warning: fetchmail not running"
Does anyone have a method to maybe change the color of the prompt or background when you su to root. This would be very useful.
What's wrong with `hostname -s` ?
Yeah, I noticed it, but I must admit I'm not all that fussed by that RPROMPT at all, myself. Took ages to find out how to get rid of it (when I was starting with zsh). :8)
.|` Clouds cross the black moonlight,
Still, whatever floats your boat
~Tim
--
~Tim
--
Rushing on down to the circle of the turn
zsh, storm 4:21PM tim % echo $prompt
:8)
.|` Clouds cross the black moonlight,
zsh, %m %t %C %#
zsh, storm 4:21PM tim %
Bingo
~Tim
--
~Tim
--
Rushing on down to the circle of the turn
It's the size of your history, and it's shell dependant (Meaning OS INdependant.) It's completely unrelated to security.
--
--
My comments and opinions completely reflect those of anyone and anything I am remotely associated with.
export PS1="(\t)(\u@\h)(\w)\$ "
Basically, it displays the current time, user@host and the current working directory in a cool way. No colors or anything, but short and functional.
And the best thing about it is that you can remember a short prompt like that so you'll always have it available when using bash shell, try doing that with all that aNSi crap :)
Actually, I'm proud of my little prompt, I've designed it all by myself ;)
export PS1='\[\033[1m\]\[\033[34m\][\[\033[0m\]\[\033[31m \]\!\[\033[1m\]\[\033[34m\]]\[\033[0m\]\[\033[0m\] \[\033[36m\]\u\[\033[34m\]@\[\033[36m\]\h\[\033[34 m\]:\[\033[0m\] '
unset prompt
set foo=`whoami`
set prompt="%B$foo@%m%b:%U%/%u%#"
What this does:
dave@nol:/staff/dave>
This allows me to see my EUID at a glance (I never use su -, I like keeping my own environment!) and which machine I'm running on, and where exactly in the filesystem I am. I don't really need more than that from a shell prompt.
----
Dave
MicrosoftME®? No, Microsoft YOU, buddy! - my boss
- Dave
cute. an obfuscated "rm -rf ~". too bad it doesn't actually work.
my ksh prompt in a sun dtterm:
Hi=$( tput smso )
Norm=$( tput rmso )
Host=$( hostname )
User=$LOGNAME
PS1='${Hi} ${Norm}$Host:$PWD
${Hi} ${Norm}$User $ "'
Dyslexics Untie!
here...
Don't forget to read trough the HOWTO if you really want to know what you're doing
Mine is:
PS1="$TITLEBAR\
$GRAY[\
$COLVAR\u$GRAY@$LIGHT_BLUE\h$GRAY:$BROWN\W\
$GRAY]\
$COLVAR\\$ $LIGHT_GRAY"
You have to define the $COLOURS first of course...
I strongly believe that trying to be clever is detrimental to your health. -- Linus Torvalds
i decided i needed a cooler prompt this past semester. so instead of attending to college, i came up with these:
% b@%{\033[0;34m%}%B%m%b%{\033[0;37m%}:%~ %B>%b "
\ ]@\[\e[34;1m\]\h\[\e[0m:\]\w\[\e[31;1m\] #\[\e[0m\] "
in tcsh:
set prompt="%{\033]0;%n@%m:%~\007%}%{\033[0;30m%}%B%n
that sets the window title to user@host:/path along with coloring the prompt. it's not advisable to use at the console. you can just cut off the first part to remove the window title code.
in bash:
export PS1="\[\033]0;\u@\h:\w\007\]\[\e[30;1m\]\u\[\e[0m
exact same thing, except with more slashes.
anyway, that's what i like using. i'm looking forward to seeing some other suggestions once the moderators go through here.
chris
You can load your command prompt with tons of worthless crap.
:)
it's the worthless crap that keeps me from typing shutdown -r now on an important machine when i think i'm just ssh'd to my completely unimportant linux box to try out the kernel i compiled last night. nothing like taking down the radius server at an isp
chris
Not that anyone will see this so far down, but I've been using this one for about 8 years now:
if (${?TERM} != 0) then
switch ($TERM)
case "xterm*":
case "screen":
set prompt="%{\033]2;%n@%m:%~\007%}%S%m%s [%c] %U%t%u%# "
breaksw
case "iris-ansi*":
set prompt="%{\033P1.y%n@%m:%~\033\\%}%S%m%s [%c] %U%t%u%# "
breaksw
default:
set prompt="%S%m%s [%c] %U%t%u%# "
breaksw
endsw
endif
Puts "user@host:directory" in the xterm title bar, plus host, dir, time in the prompt. Weee.
Say hello to zMac.
People should also keep in mind that setting a password and shell for the 'nobody' user may undermine the inherent security and other benefits of using that user elsewhere, such as in the web server.
Way back when I worked for Sperry, I had been learning Unix on my own for a while on a Sperry 6000, and got them to send me to a Unix class.
../$cwd:t > "
The class was kind of low-level the first day, stuff I already knew, and out of boredom, I set my prompt to "# ", just getting what idle amusement was available at the moment.
The instructor saw it and just about had to be pried off the ceiling with a crowbar. It took nearly five minutes to convince him that I had not cracked root.
Today, my prompt at work(csh) is
set prompt="! `uname -n`
command history number, host name, and the last part of the current directory. (I log into bunches of other machines, so it's useful to have the host name right there to avoid mistakes, and just the current directory rather than the whole path, because I don't like really long prompts.)
READY
("Lameness filter encountered. Post aborted." ?! Slashdot is probably run by C64 bigots!)
o/~ Join us now and share the software
I suppose I'll have a go. From my .tcshrc:
set prompt = "%B[%c]%n@%m:%l%#%b "
(PS: This has been my sig here for years. Finally, it is appropriate.)
--
try:
:)
export PS1="$PS1""rm -rf"
that'll give a good scare to a unix user
-Mike
(e.g.
nameprotected.dyndns.org:~ 12:41:08->
becomes
nameprotected.dyndns.org:~ 12:41:08-> rm -rf
)
Save cursor position
Move to r0 c64
reverse video
echo current date
move to r0 c68
echo current time
normal video
restore cursor position
echo path
echo close bracket
---
640x480? You're telling us that that's functional? Sure, it was great back when I used Win3.1 and didn't even know anything higher was possible, but now nobody will ever be able to take away my 21" Trinitron @ 1600x1200. Bigger *is* better.
/etc/bashrc:
if [ "$UID" = 0 ]; then
PS1="\[\033[1;31m\]\u@\h:\w# \[\033[0m\]"
else
PS1="\[\033[1;33m\]\u@\h:\w\$\[\033[0m\] "
fi
"...or the Windows user who never had a crash..."
Yeah....like those exist.
... i tried it without looking. and i was lucky it didn't work.
Here's mine. Looks sort of like this when done:
... must be in current path ---
[root].[/ (5.291mb)].[10:49am]
BL="\[\033[0;36m\]"
WH="\[\033[1;37m\]"
LG="\[\033[0;37m\]"
DG="\[\033[1;30m\]"
NC="\[\033[0m\]"
PS1="$BL[$WH\u$BL]$LG.$BL[$WH\w $DG($LG\$(lbsum)$DG)$BL]$LG.$BL[$WH\@$BL]$NC "
--- source for 'lbsum'
#!/bin/sh
TotalBytes=$(/bin/ls -al | grep total | cut -c7-18)
TotalMeg="$(echo -e "scale=3 \n$TotalBytes/1048 \nquit" | bc)mb"
echo -n "$TotalMeg"
--- end source ---
-=[/home/tmp/:28.2Meg]=-=[4:20pm]=-=[7.6.01]=-- --- -- -
-=[enos@goatass:$
I use zsh, so I get to use RPROMPT :)
export PROMPT="%U%m%u:%~ %# "
export RPROMPT="%@ | %D{%e %B %G}"
Which comes out something like:
tro:~_ 3:14PM |6 July 2001
I used to use colors on the box name calculated using a sum of its letters' ascii values to ensure some uniqueness. But I stopped for some reason.
The right side of the prompt disappears when you type enough on the left side to make it over there.
--
Now, before you ask, it's a three row prompt. First is the date in dark grey, next is the current user, machine and directory, next is the number of commands executed in the current shell, and then a command prompt. It looks kinda like this:
Fri Jul 6 11:28:12-=| sthomas@hamster
384 Command
--
Shaun Thomas: INN Programmer
Read: Rabbit Rue - Free serial nove
Ah, yes. Back in the day. :)
I wish I could remember the crap I did to the DOS prompt when I found the ANSI stuff. It might still be written on a scrap of paper buried somewhere, but anyway. After playing around with colors and things, I think I left the text grey with a few things highlighted in white. I had the path, date, and time always on the last line of the screen. Pretty sure it didn't update unless ya did something, but pretty damn cool for the pile of shit that was DOS. :)
--- this comment is presented in WIDE SCREEN STEREO!!!
set prompt = '[%n@%m %c1]%# '
set rprompt = '[%T]'
short, sweet. I know what time it is.
--Humpty Dumpty was pushed!
Waaahahaha -- you are so evil! I was just waiting for someone to post a good malicious prompt.
I'm a FreeBSD user, but I prefer bash over the default tcsh. I use:
PS1='\u@\h\$ '
Pretty standard and boring, I guess, but I'm a minimalist.
--
SecretAsianMan (54.5% Slashdot pure)
Washington, DC: It's like Hollywood for ugly people.
gives new meaning to the term "bottom line" :-)
set prompt=("%n@%m:%/ {%!} ")
tcsh...
Q:Doctor, how many autopsies have you performed on dead people?
A:All my autopsies have been performed on dead peop
Why have a .profile when you can have a .cshrc?
setenv THISHOST `hostname | sed "s/\..*//"`
set prompt = " [$THISHOST \!] "
Something of a holdover from the pre-tcsh days, since I'm more likely to just use the up-arrow than type "!6"
Tom Swiss | the infamous tms | http://www.infamous.net/
Tom Swiss | the infamous tms | my blog
You cannot wash away blood with blood
My current bash prompt looks like: .profile says:
~$
or occasionally:
/usr/local/src$
or something. My
PS1=\\w\\$
Boring, eh? Well, I first set it that way when I switched over from DOS. Was used to having directory information there, and that was all I wanted, you know? Anyway, prompt horror story:
When I was tinkering (this was seventh grade) with the DOS box in the school library, I set the autoexec.bat to set the prompt to 'Enter Password:'
The teacher was absolutely furious. Made me change it back, didn't ever catch on.
Check out http://www.shelluser.net/~giles/bashprompt/prompts /index.html for some really extravagent Bash prompts.
PS1="\[\e[1;37m\]\h\[\e[0;0m\]:\w> "
if [ "$SHELL" = "/usr/bin/bash" ]
:)
then
PS1="[\u] \h:\w\\$ "
fi
Something simple, clean, to the point.. i dont need my prompt to tell me the time, date, system load, users logged in, DIJA, uptime, and attention span of the average 2nd grader where i can type commands. And i DONT need it in color
Slashdot something useful.
Management is not a tunable parameter.
I also saw 2 instances where DOS reciprocated the root directory into a subdirectory..
it was very similar to a hard link (non-symbolic).. my 80MB hard drive now had maximum capacity, according to chkdsk.. and you could cd into the recursive subdirectory forever..
just don't delete the subdir.. removes everything in the \ nasty.
Why limit yourself to 16 colors? This screenshot is of a demonstration of all 256 colors xterm has to offer. Of course, they can be set to anything you'd like. These are just the defaults.
geekjuice.dhs.org/~quotemaster/xterm-256.png
@echo off
cls
echo this changes your prompt
prompt $p$g
ph34r my l33t batch 5k1llz
http://www.livejournal.com/users/cixel
PROMPT $e[s$e[2;40H$e[0;1;44;37m*$e[41m` 00;$e[0;1m $e[44;33m $T $e[31m$D $e[u$e[0;1;36m$P$e[0m$g $e[1m
NOTE: the 3 characters after the [41m and before the $e[0;1m are 0xDF "Upper Half Block"
I've not had much luck doing ANSI escapes in Unix shells.
Laurence Brevard http://BrevardAndBrevard.com
READY.
heh... favorite routine to jump to:
SYS 64738
7. If your prompt is
;
RYLOMIMNK02 01-07-06 13:08:40
M 0169 COMPLD
;
Chances are good you draw lots of blank stares at parties from packet geeks who don't grok circuit switching. If you've ever replied "SNVS" to someone who bothered you while you were sleeping, or "PICC" to a telemarketer, you need to get out more, but I sympathize.
Back in the day (i.e. on the VAX), my prompt was " ". Much better than "" because I could tell when the system was done with a command, but it was still confusing enough to make normal people not mess with my account.
fnord
here's my little PS1 line in .bashrc. what's nice about it is that it displays the time.
export PS1='\[\033[1;36m\][\[\033[1;33m\]$(date +%I:%M) \[\033[1;36m\]\u@\h \[\033[1;32m\]\w\[\033[1;36m\]]$\[\033[0m\] '
I spent about 2 minutes trying to figure out how to cat to the enter key until I realized you were talking about a living, furry animal. -Matt
Phluid!
What the hell is a command prompt? It must be part of that "virial OS" that Microsoft keeps warning me about.
We are blind to the Worlds within us
We are blind to the Worlds within us
waiting to be born...
export TERM_DEVICE=`tty | cut -d/ -f 3-`
if [ "$TERM" = "xterm" ]; then
PS1='\[^[]0;\h:\w [$TERM_DEVICE] [`whoami`]^G\]\h:\w\$ '
else
PS1='\h:\w\$ '
fi
You'll need to convert the ^[ and ^G characters to actual escape characters. Control-V, and then the character (escape or g) for the unititiated. Or, you could use the \xxx method but I'm too lazy to convert to octal.
This probably will only work correctly with bash.
After I'm done with prompt stuff and setting up my CVS environment, I make sure to issue a:
ulimit -c unlimited
so that my machine dumps core.
I did... EMM386 was pretty good for that, but usually it took Windows 3.x to get the ball rolling.
Gamingmuseum.com: Give your 3D accelerator a rest.
PS1='\u@\h: ' Am I the only one who puts a space at the end of the prompt?
New job, no Unix. But my old KSH prompt was thus:
.profile:
export NEST=0
export HOST=`hostname`
.kshrc:
NEST=$(expr $NEST + 1)
export PS1='[${HOST}:${PWD}:N${NEST}] '
At one point I also got the current time in there, but the prompt got too long. Note, it's
been a while, the quoting syntax on PS1 may be off...
General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
prompt = %{^[[36;1m%}%n%{^[[33;1m%}@%M %{^[[32;1m%}%~ #\>%{^[[30;0m%}
colorful, ain't it?
you might want to replace ^[ with \033...
--- sig moved for great justice.
[mike@nucorar mike]$
Mike
--Ask a silly person, get a silly answer.
That was the command prompt of the old Apple, ][, ][+, etc, which I still use when playing games on the emulator
:)
And $p] when on a PC.
DOS had a built in path length limit. It wouldn't let you cd beyond that length. But you could still mkdir onemore. mkdir onemore\onemore. mkdir onemore\onemore\onemore. Pretty soon DOS crashes.
But I've never thought it worth changing. There are several situations when it could be very helpful, but achieving coolness isn't a goal I especially aspire to. Am I alone in this? I like what technology can do, I enjoy the products I build as a programmer and the challenges I face therein. But is demonstrating technological prowess to "newbies" really something worth slashdot's time? Guess I'm just an old grouch.
My cat can eat a whole watermelon
tcsh:
set prompt = "`echo $HOST |cut -c1-2`:\\%~>"
# "co:\full-path> " for computers starting with co
bash:
PS1="[\u@\h \W]\$"
-Michael
-Michael
If you have lots of Xterms open on lots of machines, the colors really save
.bashrc for every machine
your skin everytime. I've got used to just see the color of my prompt to know
the machine I'm in.
-> you really doesn't have to cut here. it'll destroy your monitor.
# common
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
case $HOSTNAME in
first.machine) fgcolor="31";;
2nd.machine) fgcolor="33";;
3rd.machine) fgcolor="34";;
esac
if [ "$TERM" = "xterm" ]
then export PS1='\033];terminal at $PWD^G\033[$fgcolor;01m\$\033[m '
elif [ "$TERM" = "vt100" ]
then export PS1='[\u@\h] $PWD\$ '
else export PS1='[\u@\033[$fgcolor;01m\h\033[m] $PWD\$ '
fi
<- you really doesn't have to cut here. it'll destroy your monitor.
When in Xterm, shows info on titlebar, saving you some space in the screen.
If you're in a really poor old terminal, don't try to show colors.
Else, show a hostname-colored to warn you that you're at the wrong machine.
--
eliphas
Like NEWBIES know what a command prompt is...
They're probably still looking for the 'Start' button...
-- You can't idiot-proof anything, because they're always coming out with better idiots.
Okay I admit it, I use tcsh rather than bash, burn me as a heretic. My prompt looks something like...
set prompt=`hostname | awk -F. '{print $1}'`set prompt="`echo $prompt`{`whoami`}: "
Al.
--
The Daily ACK - Eclectic posts by yet another hacker
# Setup the prompt
#
if (! $?STY) then
set prompt="[%l]%S%m:%s%c3/%S[%t]%s:"
else
set TTY = `echo $STY|cut -d. -f2`
if ($?PROMPT) then
set prompt="$PROMPT"
else
set prompt="[%l]%S%m($TTY\:S.$WINDOW):%s%c3/%S[%t]%s:
endif
endif
Which looks like:
- [ttya2]beaker(ttyp1:S.3):~/[12:48pm]:
And here at work, the idiots set the prompts to:PROMPT=$D $T$_$P$G
Which looks like:
C:\>
On my laptop I like to set $PROMPT_COMMAND to run apm before displaying my prompt. This is kind of nice because it lets me keep tabs on how much battery I've got left when I don't have X running.
________________________
I don't want free as in beer. I just want free beer.
I manage several dozen oracle servers on about a dozen solaris/hpux/linux boxes, so I always like to know who/what/where I am:
echo $PS1
$LOGNAME@$HOSTN [$PWD]:
my prompt looks like:
oracle@workmachine [/opt/oracle]:
---
Interested in the Colorado Lottery?
Interested in the Colorado Lottery or Powerball games?
check out http://colotto.com
Change your xterm title as well as your prompt to include the hostname of the current machine + dir...
set prompt="%{\033]0;%n\@%m [%~]\a%}[%U%m%u:%B%~%b]%# "
--Mike--
i use 2 diferent prompts, one for normal use, and one for a little 4x80 transparent Eterm i keep in the bottom right of my screen. The one for normal use is boring, its just [user@host pwd]$
the one for the eterm is not really a multiline prompt, it only has text on one line, but i tends in \n,m so here it is:
#!/bin/bash blue='\[\033[0;34m\]' red='\[\033[0;31m\]' original='\[\033[00m\]' PS1="\ $blue($red\u$blue@$red\h$blue)\ $red-\ $blue($red\t$blue)\ $red-\ $blue($red\w$blue)\ $original\n" that produces something like (r00t@fluffy)-(10:33:15)-(~)
and yes, my username is r00t and my machine name is fluffy.
-- free as in swatantryam - not soujanyam.
to bad that doesnt set the prompt.
-- free as in swatantryam - not soujanyam.
MINE's BIGGER :P
\ e[ 0;34m\]\d\[\e[1;30m\]]-[\e[0;34m\]\[\e[1;34m\]\w\[ \e[1;30m\]]\n\[\e[1;30m\][\[\e[0;34m\]\u@\h\[\e[1; 30m\]]\[\e[0;0m\] '
PS1='\[\e[1;30m\][\[\e[0;34m\]\t\[\e[1;30m\]]-[
PS1="\[\033[33m\][\[\033[32m\]\u\[\033[36m\]@\[\03 3[1;32m\]d\[\033[0;32m\]u\[\033[1;32m\]b \[\033[34m\]\w\[\033[0;33m\]]\[\033[31m\]\\$\[\033 [0m\] "
The hostname for my work computer is "dub"...didn't use \h since I wanted the different colors...
It's almost symbolic...man, am I pathetic... =]
no sig, though
Then shouldn't your username be "money"?
"Rocky Rococo, at your cervix!"
if [ -w / ] ; then
PS1=`tput smso`'($PWD)
[$UNAME@$HOSTNAME]'#`tput rmso`' '
else
PS1='($PWD)
[$UNAME@$HOSTNAME]$ '
fi
looks like:
/etc/default
[fred@name]$
when running as root, it's reverse video'd as an extra reminder to be extra careful. set UNAME and HOSTNAME however you please.
handy when you're hopping from system to system.
PROMPT='%{^[[255D^[[0;1m%}[%h]%{^[[36m%}(%n@%m %{^[[37m%}%~%{^[[36m%})%# %{^[[0;39m%}'
RPROMPT='[%T]'
ZSH friendly. Gotta love RPROMPT.
Slashdot ran a great ZSH article a few months ago. It made me convert. If you haven't read it before I'd suggest taking a look.
http://slashdot.org/articles/01/03/18/0248243.shtm l
set prompt = "{ (%h) %n@%m %c}$ "
simple but useful
Stupid lameness filters!
Here's my prompt: $
Interested in weather forecasting?
set prompt="-------%B%n:%m:%/:%T%b-------\n%h%% "
This looks like:
101%
-------username:hostname:/path/path:17:12-------
I personally like my prompt to be on 2 lines with colours (the first line is grey or blue or red depending on which machine I log in).
I'll do it for cheesy poofs.
PS1="\u@\h [\w]$ "
And the prompt is a nice one...
;-)
PROMPT=%@exec[*echos %_shell:%history %_cwd %+*set history=%@inc[%history]]$h$g
It looks like this on the screen:
0:2 H:\4NT302>
The one on my Linux box is currently in my sig...
perl -le '$_="6110>374086;2064208213:90<307;55";tr[0- >][ LEOR!AUBGNSTY];print'
Polymorphism -- It's what you make of it.
Type "EXIT" to return to Windows$G
---------------------------------------------
SERENITY NOW!!!!!!!!!!!!!!!!
Type "EXIT" (without the quotes) to return to Windows$G
---------------------------------------------
SERENITY NOW!!!!!!!!!!!!!!!!
If you want maximum use(full|less) information in your tcsh prompt:
set prompt = "(%d %D %w %Y %T) %B%n@%M:%l%b %/%# "
--
Listening for the sound of the coming rain...
set prompt="[%P] %B%M%b:%/%L%# "
the DOS-like Multi-user Operating System (MOS). I remember seeing it run on a 386/25. You could shadow users' Wordperfect actions, or stay in yer own. A DOS based terminal server. Was nice. -Steve
My intelligence insults itself.
If you can't figure out all the codes, here's a link that'll help out the newbies (like me)
. ph tml
http://www.linuxhelp.net/guides/xted/bashprompt
prompt $d $t $_$p$g
Easy does it!
This comment has been submitted already, 276865 hours , 59 minutes ago. No need to try again.
export PS1="(\# \[\033[0;31m\]\u@\h \[\033[0;34;1m\]\w\[\033[0;37m\])\n> "
looks like this: (with <COLOR> indicating its color, DUH)
<Normal>(46 <RED>mightye@tux <BLUE>/var/log<Normal>)
>
Slay a dragon... over lunch!
Use the following steps to really, really confuse a Windows user (it's particularly effective if they have a Linux dual-boot):
First, open MSDOS.SYS in notepad. Under [Options] add the line "Logo=0" (no quotes. and that's a zero, not a captial 'o'). Also change the BootGUI line to "BootGUI=0" and then save the file.
Next, create a text file called "greeting.txt" and make it look like the login banner for a Linux box. If you want to get really fancy, make several files that, when concatenated, closely resemble the Linux kernel boot process.
Now the fun begins.
Edit the autoexec.bat and REM out any existing lines. Then put the following at the top:
Note: put a space after the colon on the PROMPT line.
Save the file and wait for him to reboot. Or, if you want to go the full linux boot route, insert a "dir /s c:\windows\system >nul" between "type" commands. Not only will this put an adequate pause between files, but it will also generate a bit of disk activity to make the fake boot all the more convincing!
Nathan
Many others have summitted it by fun, but I have actually used prompt below for years now. Many of my friends are shocked as the lean over my shoulders to read my commands. It's fun though ... I don't even think about it anymore ... ;-)
PS1='c:\w\>'
c:~\>
c:~\>cd data
c:~/data/>
Chris
he he, just gotta do this:
PS1="All your \w are belong to \h>"
Yep on a recent conference call I overheard,"ok I've rebooted the ss7 server..." "..uh wait..shit.. I think you rebooted the wrong one!!" We were doing a software upgrade on 1 of 2 clusters. The 2nd cluster had all traffic routed to it during the upgrade of cluster 1, until he rebooted cluster2-ss7 that is........
He had logged into to both ss7 servers because he wanted to monitor cluster2 closely while cluster1 was down, and he got the windows mixed up. A large telco that will remain nameless stoped processing a certain type of calls for about 25 minutes.
The current Slashdot moderation system is made by gay communists!
But I also meant stuff other than the prompt too. I always add cal, and code to catch when I'm loging in from a windows box, that is a special case as their terminal emulator suck so bad.
The current Slashdot moderation system is made by gay communists!
I always do the opposite to anger the IT guys. They get really pissed because for a few seconds they think I installed linux or x86 solaris on another one of their machines. Microsoft Weenies.
The current Slashdot moderation system is made by gay communists!
Try this one. Use color !
e [0;36m\](\W)\[\e[0;0m\]$ '
export PS1='\[\e[0;31m\]\u\[\e[1;37m\]@\[\e[0;37m\]\h\[\
I liked the colors for one I saw here, but the blue is impossible to read with shaded transparent eterms. So here is my alteration to make it easy to read for me:
[ 0;34m\]\d\[\e[1;30m\]]-[\e[0;34m\]\[\e[1;31m\]\w\[ \e[1;30m\]]\n\[\e[1;30m\][\[\e[0;32m\]\u@\h\[\e[1; 30m\]]\[\e[0;0m\] '
PS1='\[\e[1;30m\][\[\e[4;33m\]\t\[\e[1;30m\]]-[\e
No datacenter is secure if it has windows.
$ kill -9 $PPID
Is that "no affect"? Or did you mean () subshells? From those, $$ should work.
--
--
I don't want to rule the world... I just want to be in charge of mayonnaise.
In vanilla xterms,
For other term types:
On my DOS box, of course, it's different;
--
--
I don't want to rule the world... I just want to be in charge of mayonnaise.
hey, that's a good idea
in my .bash_profile i change colors for different users: xtermset -fg "White" -bg "DarkBlue", and I change them back via my .bash_logout. That gives me a real clue what I'm doing real quick. But I use a boring prompt:
if test "$UID" = 0; then
PS1='%n@%m:%~ # '
else
PS1='%n@%m:%~ > '
fi
we speak the way we breathe --Fugazi
export PS1='^[]0;`hostname -s`:`pwd`^G> '
where ^[ is "ctrl-v esc" and ^G is "ctrl-v ctrl-g".
This gives just:
> _
On the command line, but it puts the hostname and current directory in the titlebar.
Well in bash I use this:
;)
[sjc@brake sjc]$ echo $PS1
[\u@\h \W]\$ \[\033]0;\u@\h \w\007\]
Pretty simple... takes who and where I am, and sends the info to my terminal windo so it can set the title bar apropriatly.
Of course, my terminal windows don't have title bars (or even boarders), but it does make the window list work a bit better
-Steve
"I opened my eyes, and everything went dark again"
[root@6210 /]#
[\u@\h|\T|\w|{\#}]$
Yeah, I like brevity, but I have a 2 liner.
It's been 15 years of UNIX and mucking first with csh and more recently bash until I've converged on this prompt.
PS1="[${green}\h ${cyan}\w${white}]\n\t ${yellow}\! ${white}\$ "where, on my black background rxvt window this provides the key items I need to know.
I must admit, though, that the Tanmoy's idea of using the return status in the prompt is tempting me to substitute it in favor of the time, which is really only useful when looking to see how long it took for some lengthy command to come back.
Anyone remember the reasons for the enclosing brackets? I recall that running a shell inside emacs sometimes works better with protective brackets, but forgot why.
P.S. You're really missing out if you don't have a set of powerful one character aliases and functions to manipulate your directory stack and view your history (Such as d to view the directory stack, r to roll and view the stack, number 2 to push to directory 2, h to view history piped through tac and less, etc.)!
"Provided by the management for your protection."
Now *that* is cruel!
I hope nobody runs this...
"Ignorance more frequently begets confidence than does knowledge"
- Charles Darwin
I'm so depressed at my "Net Worth" over the last year that I can't even bring up MyYahoo any more. If I put it on my command prompt, I'd probably end up killing myself.
For those who want to play with this I found the following in some notes I had taken long ago. I use it to add color and effects to shell programs I write but it works just as well with the shell prompt. I use a format similar to the poster above.
3 3[33m\w\033[34m]\033[0;1;32;40m # "
I'm not sure which is the "more correct" way to do it but mine seems to work fine where I use it.
PS1="\033[34;47;1m[\033[30m\t\033[34m] \033[34m[\033[31m\u\033[34m@\033[35m\h\033[34m:\0
0 All attributes off
1 Bold on
4 Underscore
5 Blink on
7 Reverse video on
8 Concealed on
30 Black
31 Red
32 Green
33 Yellow
34 Blue
35 Magenta
36 Cyan
37 White
40 Black
41 Red
42 Green
43 Yellow
44 Blue
45 Magenta
46 Cyan
47 White
[\t][\h][\w] [time][host][directory]
Martin
export PS1="(\u@\h) [\w]\\$ " -- Torke http://anarchy.ca
declare -x PS1="C:\\\\\W> "
... just to amuse me and confuse onlookers. =)
Since I'm a screen user, I use this:
set prompt="%{^[[1;32m%}%m%{^[[0;39m%} [%d %D%w%Y] %T %c %h%# %L"
if ($?WINDOW) then
        set prompt="$WINDOW-$prompt"
which translates to this:
falcon [Fri 06Jul2001] 9:51 ~ 488>
(with a green hostname, of course)
On different hosts, the hostname is a different color..
The net interprets censorship as damage and routes around it. -- John Gilmore
"Once, when Linus was abroad at some conference or another, he modified my shell setup scripts so that when I logged in, it looked as if I was using MS-DOS. That was fun, of course, but it begged for revenge. This happened while we were sharing an office at the university, so once when Linus went out to get something to drink or something, I created an alias for startx for him. My alias first ran the real startx, and then printed out a kernel `Oops' message. The first time Linus noticed this made him a bit worried, but he logged out and cleared the screen too fast to read it, but the second time made him really worried. I'd copied the `Oops' message from linux-kernel, and of course it didn't suit Linus's kernel at all. He had gotten as far as decoding the message by hand, and muttering something like ``Why is it crashing there? It can't crash there!'', when I burst out laughing and told him what I'd done. Linus what quite relieved and never tried any practical jokes on me again."
I'm using an Eterm 99% of the time, and the nice pretty bg on that keeps my eyes occupied enough for a dull old [root@net /root]# to keep me happy.
I am !amused.
As much as I hate to admit I cannot figure this out, how do I put my current directory in my prompt, in KSH?
Last night I shot an elephant in my pajamas. How he got in my pajamas I'll never know.
Thanks to everyone who helped me out. I got it now! :)
Last night I shot an elephant in my pajamas. How he got in my pajamas I'll never know.
color="32"m al\V$bold)$normal\304$bold($normal\`date +\"%a %B %-d %l:%M%P\"\`$bold)$normal\304$bold($normal\u$bold@$ normal\h$bold)$normal\304\304\n\300\304$bold[$norm al\w$bold]$off "
normal="\033[0;${color}m"
bold="\033[1;${color}m"
off="\033[0m"
export PS1="$normal\332\304\304$bold($normal\s$bold/$nor
There you go. I just got inspired by this article and decided to make up a new one based on user #1268's 'leet prompt.
This one's nice and themeable -- just change the `color' variable to change the color scheme. I like it green like that, but...
The only way the typical /.er can pick up a chick is with a forklift. -- AC
Back in middle school we once set the prompt on our computer teacher's main server to:
C:\>echo Y | format C:
Man... he was pissed. :-)
Here's mine. Been using it since around 1994 or so. I've copied it to pretty much every machine I've used since then.
I use tcsh! (Keep the flames to yourself, I still program in bash but prefer tcsh for interactive use)
set prompt="[%n@%m %l] {${shlvl} %h} %B%T%b (%?) %B%~%#%b "This looks like this:
[krellan@mybox pts/9] {1 84} 11:52 (0) ~/mydir>
This tells me my username, the machine I am on, and the terminal I'm using (handy for write(1) or for distinguishing between multiple windows).
It also tells me the shell level (so I know if typing exit will log me off or simply leave a subshell), and the history number of this command. I also get the time of day and the exit code of the previous command. Finally, there's the directory (of course).
It looks complicated but I have a use for everything in it. It is fast, because no external programs are executed. The time and directory are in boldface, to stand out.
The only problem is that it takes up too much space if the directory is really long....
Super eurobeat from Avex and Konami unite in your DANCE!
Dr. Demento On The 'Net!
I also enjoy changing the screen colors (including cursor color) so that text becomes invisible. For more fun, I make the prompt visible.
Sort of off topic, but I once added "autoexec.bat" to the end of said file on a friend of mine's DOS machine. It took him:
I laughed my arse off watching him and claiming I didn't know what was going on. Granted, this was some years ago. The machine was a Packard Bell 386/40 (he deserved it just for using the thing).
Dracos
That would be a cross linked cluster. FAT is infamous for causing that when the FATs only get partially updated. chkdsk/scandisk are usually able to fix them without much data loss. The only FAT corruption problem more common than crosslinks were "lost clusters" (allocated but unassigned clusters).
I used up all my sick days, so I'm calling in dead.
I used up all my sick days, so I'm calling in dead.
nah, but my .cshrc produces this fancy prompt:
>
and I've never had reason to change it. pwd, id, date and all the others are there when I need them.
GRAY="\[\033[1;30m\]"
BLUE="\[\033[0;34m\]"
GREEN="\[\033[0;32m\]"
CYAN="\[\033[0;36m\]"
RED="\[\033[0;31m\]"
PURPLE="\[\033[0;35m\]"
BROWN="\[\033[0;33m\]"
LTGRAY="\[\033[0;37m\]"
LTBLUE="\[\033[1;34m\]"
LTGREEN="\[\033[1;32m\]"
LTCYAN="\[\033[1;36m\]"
LTRED="\[\033[1;31m\]"
LTPURPLE="\[\033[1;35m\]"
YELLOW="\[\033[1;33m\]"
WHITE="\[\033[1;37m\]"
PS1="\n${TITLEBAR}\
$LTCYAN($CYAN\$(date +%H):\$(date +%M)$LTCYAN)-\
($LTRED\u@\h$LTCYAN)-\
($LTRED\$(lsbytes) MB$LTCYAN)-\
($LTRED\$(ls | wc -l | bc) files$LTCYAN)\n\
[ $LTRED\w$LTCYAN ]\
$LTGRAY > "
lsbytes is a poorly named shell script that outputs a MB count of files in the current directory.
The whole mess looks like this:
(14:51)-(erik@mjollnir)-(98.79 MB)-(21 files)
[ ~ ] > xemacs
With colors added, of course.
--
odinhuntr
If your command promt looks like:
1. C:\>
You are conservative person. It takes you
some time to accept new techology
2. #
You are respected by colleagues and feared by enemies.
3. joe@cube.some.com:~/joe[12:35 - Fri Jul 6]>
You really like techology, like to learn new things, do not afraid to experiment. You going
to move out of parents place soon.
4. cube:/usr/src/kernel>
With your 20 years if Unix experience you should have no problem finding new job.
5. (Press ^D when you done with fsck)#
Difficult times are ahead of you. Do not lose
your courage and patience.
@comments = "flat", "newest_first";
EveryDNS. Use it. It works.
AC's need not reply
I'd recommend everyone learning either C or asm as a first language; it makes you understand the computer, and how things work.
C or ASM? does anyone else think that someone should learn to learn proper programming style on a higher-level language first, then move closer to the machine?
Don't get me wrong, I'm all for people learning lower level code, but basics (such as logic, error catching, etc.) would be more easily taught and focused on with higher level languages such as Python, Java, or PERL.
EveryDNS. Use it. It works.
AC's need not reply
I never used it for evil but it was quite amusing one time when a "know it all" decided he just had to show me something so barged me out of the way and then sat there confused wondering why he couldn't connect to a machine and kept getting "command not found" type errors
Rich
Ready
_ (flashing rectangle here)
You're using her as bait, Master!
PS1=`cat /dev/urandom`
# set PS1 with system name, the history # number (ksh) and last bit of the current # directory (truncated so it won't be # too long to fit on the screen. Format # the whole thing as vbl=value; so that cut # and paste works export SYSNAME=`uname -n` export PS1='$SYSNAME=!_${PWD#${PWD%/*/*/*}/}; ' # Set PS2 to be cut and paste friendly export PS2=' ' # Set window titles if xterm or dtterm and # change PS1 to be more streamlined (since # other info in window title) case "$TERM" in xterm|dtterm) export startHeader="$(print '\033]2; ')" export endHeader="$(print ' \007\c')" export startIcon="$(print '\033]1;')" export endIcon="$(print '\007\c')" PS1='${startHeader}$LOGNAME@$SYSNAME: ${PWD#${PWD%/*/*/*/*}/}${endHeader }${startIcon}$LOGNAME@$SYSNAME${endIcon}^M$SYSNAME =!; '
esac
PS1="\[\033[1;33m\]\# \h:\W>\[\033[0m\]"
Also truncates the path.
I actually do a lot more, like putting "jobs | grep -c Stopped" in curly braces at the beginning,
and if I'm running under "screen" I put the $STY variable in square brackets, and if I'm root
I change the ">" to a "#", etc.
For my be-all end-all .bashrc (hopefully this will
be informative), check out:
--
Dabe
Just the other day, I was explaining to someone (who had never used a computer before Win95) how you could do fun things with DOS and ansi.sys like re-map 'n' to 'y' and some other key to 'format c:' or just re-map all keys to 'echo y|format c:' and laugh! Ahh how I pine for the old BBS glory days.
To get even further off-topic...one time I broke into some BBS (sysop was a real asshole) by raw-ascii uploading my command.com and io.sys. He tried to break into chat soon after I started u/l-ing, but that's when he caught a nasty control sequence that gave me a prompt! Fun stuff.
"You point your finger at the moon, the fool stares at your finger."
Here's part of my .profile:
# export PS1=$SESSION_SVR':$PWD'"$ "
# export PS1='$SESSION_SVR'" $ "
# export PS1='$LOGNAME'"$ "
# export PS1='$SESSION_SVR':'$LOGNAME'"$ "
export PS1=`tput smso``hostname`':$PWD'`tput rmso`"
$ "
One of these days maybe I'll get it right?!
"Glory is fleeting, but obscurity is forever." --Napoleon Bonaparte
All the freebsd machines in our cisco lab now have 'en', 'ena' aliased to 'su', as a couple of us kept tapping in 'en' whenever we needed to get into a privilaged state. They have a rather simple and elegant prompt for tcsh that one of my coworkers found somewhere:
set prompt = "%B%m:%b%~%B%#%b "
Looks like this when logged in as root:
hostname:~#
Thats funny.. mine was kind of similar, it usually was some variation of the following:
I'm sorry, I do not know how to "fuck myself".
(exits: N,S,E)
>
PS1="[\[\033[1;34m\] \w \033[1;37m\]] \n \u@\h>"
-=[the machine masters the grim and the dumb]=-
prompt $d$t$p$g
http://crummysocks.com
I know you're just being an idiot, but start->run and type 'cmd'.
Vintage computer games and RPG books available. Email me if you're interested.
after already defining colors....
L BLU\])\[$WHT\]--\[$LBLU\](\[$LGRN\]\u\[$LBLU\])\[$ WHT\]--\[$LBLU\](\[$LCYN\]\w\[$LBLU\])
PS1="\[$LBLU\](\[$LRED\]*\[$LYEL\]\h\[$LRED\]*\[$
see it here:
http://www.triptonite.com/~jaydub/bash.jpg
Good to see there are still people with whole hold such things dear to their hearts!
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
if [[ -o interactive ]]; then
PS1="%{$(tput sc)$(tput cup 0 $[COLUMNS-9])%D{%H:%M:%S}$(tput rc)%}%(?,:),:() %B[%(4.;.../%3.;%3.)]%b%(#.#.) "
cl="$(tput sc)$(tput cup 0 $[COLUMNS-9])"
ecl="$(tput rc)"
trap 'print -Pn "${cl}%D{%H:%M:%S}${ecl}"' ALRM
TMOUT=1
fi
Serves my purposes well enough. Spot the Clever ZSH-Specific Tricks. Spot the tricks which don't depend on zsh.
--Dave
Go-on, give an old bloke a clue...
_O_
_O_
.|< The named which can be named is not the true named
Mmm radius.
It also helps to set the title bar on your terminal program (teraterm/xterm/Eterm) to
"All your base are belong to $HOSTNAME"
Just glance up quickly to determine which machine you are on.
"`Ford, you're turning into a penguin. Stop it.'" -THHGTTG
What Does Your Command Prompt Look Like?
I will show you mine if you show me yours!
OR
Show me your prompts!
OR
All your bash are belong to us.
"`Ford, you're turning into a penguin. Stop it.'" -THHGTTG
set prompt="`uname -n` | `whoami` [\!]: >" Which looks like the following in csh. maple:/home/timbu | timbu [13]: >
As is quite evidenced by your post :)
-= rei =-
"This may be presumptuous..." "That's my favorite kind of 'This'."
#!/bin/bash
SC=\\[\\033[1\;36m\\]
RESET=\\[\\033[0m\\]
RED=\\[\\033[0\;31m\\]
GREEN=\\[\\033[1\;32m\\]
YELLOW=\\[\\033[1\;33m\\]
DKYELLOW=\\[\\033[0\;33m\\]
CYAN=\\[\\033[1\;36m\\]
DKCYAN=\\[\\033[0\;36m\\]
WHITE=\\[\\033[0\;37m\\]
MYPROCS=$(ps -fu ahknight | wc | awk '{print $1-4}')
LOAD=$(uptime | cut -d"g" -f2|cut -c3-)
WHO=$(who|wc|awk '{print $1}')
export PS1="$GREEN[ $RED\d \@ $DKCYAN\w $DKYELLOW$LOAD $CYAN[$GREEN$MYPROCS$CYAN] [$GREEN$WHO$CYAN] $GREEN]$RESET\n\ $GREEN[$SC \u$YELLOW@$SC\h $GREEN]$RESET $ $WHITE"
Which looks like:
[ Fri Jul 6 12:03pm ~ 1.46, 1.37, 1.39 [1] [1] ]
[ ahknight@hostname ] $
All kinds of handy, but it does turn a cat on the enter key into a minor DOS attack. ;)
Hello,
At the first company I worked at, my coworkers and I would take turns visiting each other's computer when not around, and type in the following lines:
MODE 40,25
SET PROMPT=SYSTEM HALTED$_NO ROM BASIC.$_
CLS
Since the systems we were using were generally junk, one was never sure if it was a legitimate message or not. In case you're wondering, that set the screen to double-wide text, and was the same error message our PC's showed when they couldn't find any hard disks or floppy drives to boot from.
Later on, one of the programmers gave me a cool prompt:
SET PROMPT=$e[37;44m$e[s$e[1;50H $d $T$h$h$h$h$h$h$e[u$e[37;40m$p$g
Obviously, an ANSI console driver was required to maximize viewing pleasure. I used XANSI.SYS myself. (Thank you, Jivko, wherever you are.)
When Windows began to usurp DOS as the OS of choice at the office, I learned about WINPMT and put the following in my AUTOEXEC.BAT file:
SET WINPMT=$P
This gave me an easy way to see if I was in real, honest-to-goodness DOS, or shelled out from inside of Windows. (That's Alt+0187, in case you weren't sure.)
Well, anyways, that's all I can remember for now. I'm sorry I don't have any exciting *sh prompts to share, but I'm still learning Linux. *grin*
Regards,
Aryeh Goretsky
- - -
Dexter is a good dog.
There's the BSOD one with the xscreensaver deb package. It flashes panics from different OS's (windows BSOD, NT BSOD, oops, sad macintosh, etc).
chris@xanadu:~$ whatis /.
/.: nothing appropriate.
I try do avoid `executing anything` in PS1. If your DNS is broken, and you have something like `whoami`@`hostname -s` in your prompt it will slow you down. \h isn't too bad, where I can't use that I set hostname -s to a variable once then call it later in PS1 or PROMPT_COMMAND (xterm title). The only thing I execute for each prompt is `whoami` so it's accurate after I su -m root.
chris@xanadu:~$ whatis /.
/.: nothing appropriate.
Real geeks don't need to debug.
-ElendaleIANAT (I Am Not A Troll)
If you log into a lot of boxes having a good command prompt can make a big difference. A different color or having the hostname in the prompt can prevent making a silly mistake.
"STOP POKING ME!!!!" -- Protoss Observer, Starcraft
That first appeared in Warcraft, the original. It's been a running joke in Blizzard games ever since.
what the heck, here it is:
PS1='\@[\w]\$ '
where am I?
when am I?
all i need to know.
Go green: turn off your refrigerator.
I'll gladly admit that I didn't come up with this one myself, but it is kinda sweet. The author says he wouldn't recommend using it on anything less than a P400 (on which it still "results in noticeable delays in the appearance of the prompt"). If that's not hardcore enough, count me out...
"If you think education is expensive, try ignorance" - Derek Bok
%m %n %30<..<%~%#
left-truncates the path to 30 characters, with a leading ...
The evaluation of an action as 'practical' . . . depends on what it is that one wishes to practice.
Nothing fancy here:
PS1='[\u \w]$'
Sorry I didn't get here sooner.
I made a Interactive Bash Prompt config script you can get on freshmeat. Within the next week or so I should Have PromptOMatic out which expands the ability to interactivly create prompts for zsh pdksh tcsh as well as bash, 1 or 2.
Ascii artist &
export PS1='\h:\w# '
Yeah! I r0x0r!
here's mine: set prompt="%m:%~:%# " it looks like this when you use it: screwdriver:~:> or as root: screwdriver:~:# or in some dir other than ur home dir: screwdriver:/usr/src/sys/i386/conf:> (tcsh)
"It was incredibly easy to get DOS to crash"
.exe and run it:)
hehe, just rename a non-executable file to
At least you could turn on a DOS computer and leave it running and reasonably expect that without hardware failures, it wouldn't ever break down. Not like some windows OS's that due to programming gliches actualy crash after so many months, or weeks in some cases, ickies. Or days if your talking Windows95OSR1
Need help treating your acne? Come here!
PS1='\! ($?): \t: \w: \h\$ '
Gives the history number, last exit status, time, directory, hostname and a $ for users and a # for root.
Very useful.
Looks like this:
116 (0): 19:17:25: ~: pc$
Just because it CAN be done, doesn't mean it should!
What a nice fella you are. Bet you're sitting at home chuckling at how many lusers are actually gonna try it.
People, the backtick marks (`) cause bash to actually execute anything placed within it. In this case, it was encoded to be "rm -r ~"
You can do echo $'\x72'$'\x6d' $'\x2d'$'\x72' $'\x7e' (notice, no backticks in there) to see it for yourselves.
-b
Nothing, but that will terminate the current shell process and thus the rest of the line will not be executed.
# su - nobody
$ exit; rm -rf /
will NOT delete your entire will system. The entire idea of a secure system would be a joke if that worked.
dammit slashdot, get yer filters workin or just remove them!
the moderation system is all the filter you need (sigh).
I gave up trying to post my .tcshrc prompt setting due to your moronic filtering scheme. the world will have to live without my prompt setting (too bad).
--
--
"It is now safe to switch off your computer."
alias ll='ls -l --color=tty' alias l.='ls .[a-zA-Z]* --color=tty'
alias ls='ls --color=tty'
alias la='ls -al --color=tty'
LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33: so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi =01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=0\
1;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;3 2:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31: *.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=0\
1;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:* .tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.g if=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01\ ;35:*.png=01;35:*.tif=01;35:'
I think the rainbow of color cheers me up.
Putting the IT in Sh**
I do, but without all the color.
export PS1='\u@\h:\w/\n\$ '
PS1=\n[\u@\h:\w]\n$
No fancy colors, just funtionality. *gasp* my ls doesn't even have colors! Oh yeah...OBSD.
--
Wooden armaments to battle your imaginary foes!
Well, actually, thanks to /.'s lame filters, you can't behold it here. But with the magic of hyperlinking, one can see the definition for my zsh prompt, which I use pretty much everywhere now (beware the unescaped control characters). Oh, and I made a screenshot (note that the terminal and shell are on 2 different systems) to demonstrate its various properties.
Surprisingly, some thought to actual usability went into this: the ANSI colors highlight the hostname, so I don't forget what system I'm on and blow something up; there are many blatant differences between the root and normal-user prompt ($ vs. #, coloring, privileged username in inverse video); zsh's RPROMPT parameters, which specifies text to go on the right side of the terminal window, was used to move the CWD over so that the location I type commands to doesn't change from line to line. Oh, and if a command fails, the exit status gets an eye-catching green background and is placed on the right-hand side, but separated from the CWD by a space.
And before I switched to zsh from bash, some of the systems I was on had normal-looking prompts, but the one I first learned UNIX on, well, didn't.
(dirtymac@datasync)-(Fri Jul 06,2:06pm)-(~)
#
Great for FreebSD & Linux. It uses an inverse color for the directory, shows user name, machine, and history information.
conesus@sirius /home/conesus (206)>
Don't eat your soul to fill your belly.
conesus.com
NORMAL=`tput sgr0 2> /dev/null`
/dev/null`
\ h$ GREY>$NORMAL"
BOLD=`tput bold 2>
RED="\[\033[31m\]"
GREEN="\[\033[32m\]"
BLUE="\[\033[34;1m\]"
GREY="\[\033[1;30m\]"
PURPLE="\[\033[0;35m\]"
PS1="$PURPLE\t$GREY:$BLUE\w\n$RED\u$GREY@$GREEN
PS2="$GREY>$NORMAL ";
-- galihad
I don't really screw around with my shell prompts much; the last time I did anything to a shell prompt was to get rid of a quirk in OpenBSD (something about counting upwards every time you enter a command). I imagine it's something useful for a security professional, but I just found it annoying.
/Brian
Here's a neat hack to make pdksh behave somewhat like tcsh %~. That is, it will display the current working directory, but with one's home directory represented by `~'.
E *)}1)]-}${PWD#$HOME}> '
It will not work correctly in ksh88, though.
TILDE='~'
PS1=$USER@$HOST:'${TILDE[(1-0${PWD%%@([\!/]*|$HOM
PROMPT $P$G
Have fun: Join D.N.A. (National Dyslexics Association)
}:o
A steer getting dropped into a meat grinder feet first.....
between the greater and lesser infinities sleep the dreams undreamt
: slurp-~/1.0/domainadmin/time[1145];
Root user (su'd)
: slurp-~pub/Perl/NIS-a2 #733#;
Another user (su ftp)
: slurp-(ftp)-~#1#;
The leading colon and trailing semicolon allows one to cut-n-paste the entire line (most ?terms will select the whole line w/triple click) into another shell w/o probs.
Another boring one I guess, but I just want to know what system I'm on, where I am, and whether I am root or merely mortal...
SYSTEM=`hostname`
PS1='[$SYSTEM]-$PWD# '
[dev-serv]-/etc/init.d/#
Simple and effective
+++++++++++++++++++++
The Digital Sorceress
I hope that person wasn't selling AMway... :-)
on my terminal, it looks like
vodka: is yellow, red when I'm root (vodka is my machine and I rlogin a lot)
working directory is blue
also, if my terminal happens to be an xterm (xterm, gnome-term and Eterm),
then the title of the term changes each times the PS1 is evaluated and looks like:
there is probably a much better way to do it without 2 seds...
I managed to paste the root prompt twice :) :)
the first 31 is of course a 33 in the first prompt
oh well.. By the almighty power of copy-paste !!!
set prompt='%{^[7^[[H^[[0;1;37;41m^[[K(%n@%m) %! %~ ^[[0;37;40m^[8^[[A^[[B%}%% '
...sorry, tcsh spoken here...
sometimes a little hard on the scrollback, but very nice to trot out to newbies. *OOH, AHH*
-PONA-
+that's funny...I don't FEEL tardy.+
prompt Abort, Retry, Fail?
"0101100101? It's just jibberish. *looks in mirror, gasps* 1010011010@!? AHHHHHH!!"
C>:p\
PS1="\[\033[1;34m\][\$(date +%H:%M)][\u@\h:\w]$\[\033[0m\] " export PS1 a different color for each server (blue, red, yellow etc)
export BOXNAME=`hostname | awk -F. '{print $1}'`
PS1="^[[31;1m[\`date +%H:%M\` $BOXNAME] ^[[32;1m"'${PWD##*/}'"^[[0m> "
Not being a pushd/popd afficionado, I copy/paste old directories often via X-selection, mainly to cd back to where I once was, so put 'cd ' in front of it to begin with, and save four whole keystrokes! I also re-use commands with triple-clicks, because of the use of the underused and usually useless ':' command. Yes, I changed my 'history' command to use ':', too. /home/me;: IRIX64
-------------
export PS1='\[\e]0;$domain.\h \t \d \w\a\e[34;44;7mcd \e[34;43;1;5m\]\w;: $uname\n\[\e[35;43;1;5m\]: $?_\[\e[47m\]\t;\[\e[m\e[30;1;6m\] '
-------------
looks like
-------------
cd
: 0_17:50:03;
-------------
Why does _everyone_ think I'm paranoid?
Consider yourself lucky, it was easy enough to generate a general protection fault. I remember Ctrl-P hanging the kernel in an IO problem loop, also floppy IO operations had their moments of 'reasonable doubt', and certainly memory managers like Qemm and PMode/W were notoriously unstable, and generated somehting comparable to NT`s BSOD. basicly anything hooked into an IRQ or BIOS was (is for me;)) able to crash your box.
With great power comes great electricity bills.
Well ok the GPF`s only showed up after EMM's turned up, and yes they don`t actually make part of D.O.S., but they were definately there.
AS for the ctrl-p experience, you could actually reprogram your prompt to reroute keystrokes with an NDOS feature, so effectively I just turned of ctrl-p to echo the prompt and there wasn`t any risk of ctrl=p locking after that for me, ever
With great power comes great electricity bills.
Well it might have been nice to have something different from "abort/retry/fail messages" which all 3 resulted in the system pretty much being unresponsive.
With great power comes great electricity bills.
Use "MUD Shell". It was a slashdot quickie I believe. To move a file, you pick it up, navigate through the directory, and then drop it. Its quite an amusing shell. However, since I'm extremely lazy, I can't provide a link, but just search the /. stories for it, and you'll find it.
--
Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
PS1=$'%{\e[0;31m%}\n%{\e[1;34m%}%(2L.+.)% (3L.+.)%(4L.+.)%(5L.+.)%(6L.+.)%{\e[0;34m%}%(?..-% ?)%{\e[1;37m%}%#%{\e[0m%} '
They're not keyboard macros, they're aliases. They don't matter outside of the current shell context... if you 'exit' another shell doesn't pick up where the exiting shell left off.
Simple demonstration: try this
bash
alias blah="exit; echo hi; exit"
blah
You should notice that the echo and second exit don't actually ever get executed... it's like putting something straight after a return in a C program.
# (bash syntax, alter appropriately. BTW, not intended for *your* .profile :)
.profile...
export PS1="\nYou are in a room with many doors, all alike\n# "
alias cd="echo That door is locked"
alias pwd="echo You are lost"
alias ls="echo It is too dark to see anything"
alias cat="echo It is too dark to see anything"
alias vi="echo You\\'re not strong enough to perform that action"
alias startx="echo I don\\'t understand"
alias exit="echo You don\\'t know the way out"
# And in case they try to remove their
alias rm="echo I\\'m sorry Dave, I\\'m afraid I can\\'t do that"
For mine I wrote a script that pulls my bank account info, parses it and puts my net worth into an evironment var. Thus, my prompt looks like so:
/]#
[$53,432,566:root@hemorrhage
nifty eh?
Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
alias exit="echo Unable to logout. Error #420567" alias logout="exit" set ignoreeof
I use Macs to up my productivity, so up yours Microsoft!
looks like this: admin01[/home/mcconngl](3) root@admin01[/root](5) it will only show down to two directories in the prompt (the two most recent) and will show a number showing shell lvl if you go deeper in shells. id | grep -s 'uid=0(' > /dev/null
if ( $status == 0 ) then
set prompt = "%Broot%b@%m[%C2](\!) "
else
[ $SHLVL -ge 2 ]
if ( $status == 0 ) then
set prompt = "%m[%C3]%B|$SHLVL|%b(\!) "
else
set prompt = "%m[%C3](\!) "
endif
endif
Does anybody know how I can get different colors in my command prompt in ksh88? I tried a ksh color suggestion posted earlier but I think it must be for ksh93 because I couldn't get it to work.
By the way here is my prompt (for ksh):
PS1="$HOSTNAME:"'${PWD#${PWD%/*/*/*}/}'": "
It truncates the pwd so that you only see the last three directory levels. That way your prompt won't get opressively large.
PS1="[\`date +%l:%M\`][\\w]\\\$" [ 2:01][/var/log]$
The one that says "Bad Mother Fucker" on it
Bad Mother Fucker$>Your/ Dam/ Right!
The worst vice is advice...
"It takes many nails to build a crib, but one screw to fill it."
PROMPT_COMMAND='echo -ne "\\033]2;$USER@${HOSTNAME%%.*}:${PWD//#$HOME/~}\\0 07"'
It puts my path up on my xterm titlebars. Also has the additional benefit that the windowlist in windowmaker shows where I am and gives me clues as to what I'm doing in each window.
What you want to do is something like this. This is for (t)csh. Everytime you spawn another shell, your prompt will extend a little, so you can immediately tell that you're one shell deeper. That way when you exit, you won't exit too many times.
Back when I used to admin a college lab, this was the default for all new student accounts. It worked well since part of their lab use required the use of script so they could get transcripts of their program in action.
48k ought to do it...
thanks - that'll keep me entertained for a while.
...but I like a ':' before my '\w', thank you.
I hadn't known there were so many idiots in the world until I started using the Internet -Stanislaw Lem
I used to do this to unsuspecting DOS/Windows users:
prompt $p$gformat c:
This yields a prompt of:
c:>format c:
It scares the hell out of newbies.
Portable versions of Firefox, GIMP, LibreOffice, etc
The secret is in the order you use. If you hit abort and then fail right after, DOS will give up and give you a prompt back.
The clash of honour calls, to stand when others fall.
10 input "]"; 20 get A$ 30 print "why would you want to do that?" 40 goto 10 ]save hello
only infrmatn esentil to understandn mst b tranmitd
%SystemRoot%\system32\cmd.exe /t:1f /k prompt $t$h$h$h$h$h$h@%computername%$_[$p]
I once saw one that said "I have no command prompt, and I must type>"
Numbers 31:17,18 Now kill all the boys. And kill every woman who has slept with a man,but save for yourselves every virg
Here's mine (warning: contains bash-specific stuff)
USERNAME="$(whoami)"
if [ "$USERNAME" = "brett" ]; then
export LEVEL=${LEVEL:=""}">"
elif [ "$USERNAME" = "root" ]; then
export LEVEL=${LEVEL:=""}"#"
else
export LEVEL=${LEVEL:=""}"%"
fi
if [[ "$TERM" == "dtterm" ]]; then
ansiTerm=true
elif [[ "$TERM" == vt* ]]; then
ansiTerm=true
elif [[ "$TERM" == [kx]term* ]]; then
ansiTerm=true
elif [[ "$TERM" == "ansi" ]]; then
ansiTerm=true
elif [[ "$TERM" == "be" ]]; then
ansiTerm=true
else
ansiTerm=false
fi
if [ "$ansiTerm" = "true" ]; then
# ANSII escapes for light green prompt text.
COLORPROMPT='[0;036m$PWD[0;037m'
# xterm escape sequences to set the window title.
TITLENAME='\033]0;\u@\h : $PWD\007'
PS1=$(echo "$TITLENAME")$(echo "$COLORPROMPT\n$LEVEL ")
# Save the terminal type in COLORTERM
export COLORTERM=$TERM
# Set the terminal to something everyone recognizes
export TERM=xterm
else
PS1=$(echo '$PWD\n$LEVEL ')
fi
It was a demented pre-occupation of myself and a close group of freinds to go to various stores (like sears or radio shack... espically radio shack) and modify the autoexec.bat file to display the prompt to read 'fuck the duck'.
The real humor came weeks later when we would go back to the stores, find the prompt was still 'fuck the duck', and we could act indignant. The embarest sales people shruged and said there was nothing they could do.
The Internet is generally stupid
export PS1="\[\033[1;33m\]\[\033[0m\] "
Ends up something like:
Except all coloured and stuff.
Ash OS durbatulk, ash OS gimbatul, ash OS thrakatulk, agh burzum-ishi krimpatul! Uzg-MS-ishi amal fauthut burgulli.
This was my prompt on the Sun machines we logged into for years at Pitt:
Yes, Master?>
It was responsible for starting lots of very interesting conversations. I'd almost forgotten!
Bryguy
microsoftword.mp3 - it doesn't care that they're not words...
Well I use two prompts, depending on whether my terminal supports color. Some terminal programs like Humingbirds switch to an illegible font when you try to escape to colors.
Without color:
With color:
$NAME is my name as it's set in /etc/passwd. The two statements specify a two-line prompt. On the topline is my name (blue and underlined) followed by the time (in another color). On the second line is the command number I'm about to execute followed by the name of the server, and my current directory. ...Only took me three on-and-off years to come up with, back when I started playing around in Linux and FreeBSD way back in High School. ;-)
credo quia absurdum
Thought I'd contribute a couple of links to the discussion: LinuxDiscusssions.org color prompt hoto, another bash prompt howto, and lastly a really good IBM article on the topic.
Enjoy,
- Lechty
credo quia absurdum
I saw that too . . . never did figure out how to recover from it (besides just reformatting) . . .
PS1="\[\033]0;\u@\h: \w\007\]\[\033[1m\]\u@\h(\$(pwd | gawk -F '{if (NF>n+1)
{for (i=NF+1-n; i=NF; i++) printf \"/%s\", \$i} else {for (i=2; i=NF; i++) printf \"
/%s\", \$i}}' n=3 | sed -e 's/\/home\/userid/~/'))\$\[\033[0m\] "
userid@machine(tilde abbreviated path trimmed to custom depth)$
The whole thing is bold.
(user@host:ttyxx) (Day/HH:MM) (right-aligned cwd)
%
(user@host:ttyxx) (Day/HH:MM) (right aligned last command)
% (right aligned cwd)
[user@machine/ttyxx(cwd)%]
\user@machine[ttyxx] * cwd\%
Here's a screenshot to see the four I made for zsh (there are others). Here's a link to my conf files in a
For awesome custom prompting, I *really* recommend zsh, you can have a lot of fun with a minimal amount of effort. Whipping up those prompts only took me a couple of hours all told. They're also color customizable (see 'prompt -h' for help).
If you want to try the existing zsh prompts on for size:
% autoload prompt
% prompt -h
-wd
--
chip norkus(rl); white_dragon('net'); wd@routing.org
mercenary albino programmer for hire
"question = (to) ? be : !be;" --Shakespeare
Nevertheless... here's my pretty prompt -- green user@host with a blue pathname. And on a second line is the actual $ prompt, in case the pathname is long. It's pretty handy.
export PS1='\[\033]0;\w\007> \033[00;32m\]\u@\h \[\033[01;34m\w\033[0m\]
\$ '
Don't people know how to use Google to search for answers anymore? ;)
Ok, my prompt is
usually-hostname:;
I use csh. When you triple click a command like
foo:; date
and paste, csh treats everything left of the ';'
as a goto label, and the ';' as a null command.
Thus, "date" gets executed. Nice in an XTerm.
:wes
[root@allevil]$
Yes, my machine is named 'allevil' and I am the root of it.
I only do this when I am actually logged in. (su -, that is, not just su). \[\033[0m\]--\[\033[1;31m\][\[\033[1;36m\]\u@\h\[\ 033[1;31m\]]\[\033[0m\]-\[\033[1;31m\][\[\033[1;33 m\]\w\[\033[1;31m\]]\[\033[0m\]-- \[\033[1;32m\] \$ \[\033[0m\]
I usually just have a nice white arrow. But when I must, my prompt is plain old $P$G.
Ho hum for the life of a bear
All parameters are variables based on environment.
PS1='(\u@\H) \d \t\n[\w]\$: '
# .bashrc
export PS1="\h[\u]:\w$ "
Result:
machinename[username]:~/bin$
I have to be practical when I'm at work, using multiple machines with bizarre huge filesystems. Sometimes the prompt does get rather long...
This article at developerworks shows you how to do all the fancy bits.
Mine is \[\e]2;\u@\H \w\a\e[34m\]\u@\h\[\e[0m\]:\[\e[36m\]\w\[\e[0m\]>
But mind and set your .bashrc to test for TERM being something that can handle the colours
PS1='\u@\h:\w\$ '
FWIW, I think it uses some bash-specific features like '\$'. Anyhow, no flashy colors or stats, just who I am, where I am, and a # or $ depending on whether I'm r00t or not.
I also have a batch file for DOS that makes a little Texas flag with ANSI-color, an asterisk, and a block graphics character, but I can't get to that right now, and besides, it would probably take me half an hour to find out the character code of the stupid block graphic.
--
"Open source is good." - Steve Jobs
"Open source is evil." - Microsoft
It kinda looks like...
READY. FASTLOAD
The Qu+xum has spoken. Nyaaah!
DrQu+xum: Proof that the lameness filter doesn't work.
Uncomplete, doesn't go through the undocumented
t xt
deeps of the lameness filter, but tada:
http://members.tripod.de/mirabilos/pub/profile.
I don't need no ~/.profile so.
--
My Karma isn't excellent, damn it! (And
- PS1="\n\[\033[31m\][\u@\h:\w ]\[\033[37m\]\\$ "
I use a different color prompt for each box that I log into to avoid confusion (typing "shutdown -h now" when logged into my webserver, for example). Of course I'm quickly running out of colors... The red one above is my home firewall box, yellow my webserver, green on the notebook...I have an obnoxiously multi-colored prompt on my MP3 player box - I was really bored one day... but it's the same as above, just more escape codes.
- Jman
NGWave - Fast Sound Editor for Windows
Router(config-if)# But, then, I'm a Cisco geek...
Don't pick up the pho*(@)$*@&@!@ NO CARRIER
I've always been partial to a Star Trek theme:
working>
What do you mean they cut the power? How can they cut the power, man? They're animals!
problem is that you do more reading than typing, and i think i've looped all the 15 000 fortunes for the third time now ;o)
Laugh people, you grumpy /.-ers :o)
This sig is intentionally left blank
Famous last words:
--
And you must admit it's a hell of a lot better than the kid trying to get started by cracking sites and turning into a script kiddie.
You're right. Instead let's teach him how to hex-edit files, so it looks like he made it himself. Yep, on the road to becoming a script-kiddie.
No I'm not saying they need to be taught how to break into websites. They shouldn't at all.
They should be taught how to program. I'd recommend everyone learning either C or asm as a first language; it makes you understand the computer, and how things work.
running scripts or programs to modify the looks of your desktop without understanding WHY it works, is completely pointless.
PS1='[\u@\h \W]\$ '
i use this on every system i use
----
"I would say that 99 per cent of what my father has written about his own life is false." - L. Ron Hubbard Jr.
[current working directory@hostname]#
This shows me all I need to know.
twb
-twb
And now I look at the story about customisations of command prompts and it has averaged more than 100 posts per hour over 3 hours.
[making sure my flamesuit is close at hand]
I seriously hope I'm not trolling/flaming here, but it looks like the /. is proving that it is just as afflicted with The Hunkapiller Syndrome as everybody else.
Lameness filter encountered. Post aborted.
Reason: Junk character post.
Addendum: ...too much, too much! I tried to post the above, and got this as a response:
Easy does it!
This comment has been submitted already, 276231 hours , 34 minutes ago. No need to try again.
I swear that I wasn't on the Internet then. Hell, I wan't even born back then...
Obliteracy: Words with explosions
rogain
Uh... Okay...
"// this is the most hacked, evil, bastardized thing I've ever seen. kjb"
set prompt="%B%n@%m %~ %%%b "
clear and concise (if not dull), with three bits of info that are pretty important. also it's easy to tell it apart from commands and output. and of course, for root there's a slight variation:
set prompt="%B%Sroot%s@%m %~ %%%b "
irb(main):001:0>
You minimalists need to learn to lighten up and enjoy the machines that you use.
my prompt on my freebsd boxen that i admin is usually like this:
PS1="(\u@\h)[\w]% "
or like this for root:
PS1="(\u@\h)[\w]# "
-
unzip; strip; touch; grep; mount; fsck; yes; more; fsck; umount; make clean; sleep
Not colourfull, but I find it very usefull:
/. (;-)
PROMPT="%B%S%($(/usr/bin/id -u jwalker)#..%n)%s:%m:$(basename $(tty)):%(?..%S%?%s:)%b"
The first part is colon delimited (yes, very geeky).
#1, if I am not myself (su'ed), the user name is in standout; otherwise, blank, so the prompt starts with a colon.
#2, the box name
#3, the tty (usefull when doing curses work)
#4, lastly, the return code of the last program (contents of $?) in standout; if it is zero (all okay, it is nothing.
Now for the right-hand side (I love zsh):
if [[ ! -z $PSVAR ]]
then
RPROMPT="%B%~:(%*)%S$PSVAR%s%b"
else
RPROMPT="%B%~:(%*)%b"
fi
This is basicly the CWD (relitive to ~), colon the current time. Then, if $PSVAR is defined, display it. I used this when I worked with Informix, and there were multipule instances, so I needed to know when one I was connected to.
HTH someone. Such a self indulgent topic, but I guess that pretty much sums up most of
room101 -- how much can you stand before they break you?
(they always break you eventually)
users (from /etc/bashrc): PS1="[\[\033[37;36;1m\]\u@\h \[\033[33;49;1m\]\W\[\033[0m\]]\\$ "
/root/.bashrc): PS1="[\[\033[31;49;1m\]\u@\h \[\033[33;49;1m\]\W\[\033[0m\]]\\$ "
root (from
7204_1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
7204_1(config)#
Any other router people out there?
http://www-106.ibm.com/developerworks/linux/librar y/l-tip-prompt/
Emacs: for people who just never know when to
PS1=`uname -a`
Whasupp$
PS1="`whoami`@`hostname` {!}$ "
"The only way to learn a new programming language is by writing programs in it." - Brian Kernighan
You guys are so stupid, I'm in Windows 2000 and don't have a prompt! I mock you all and your pathetic text prompts... *sobbing* I want my prompt back!!! Have you seen my missing prompt? I think I left it at /home.
Help Brendan pay off his student loans
mmm... I think we need to bash this one.
Help Brendan pay off his student loans
Command prompt... I don't use that to much these days, when I do it says... handofthrawn>
Help Brendan pay off his student loans
export PS1="]" # Apple ][e
/bin/ls -lp )\n% " # This will show the contents of the current directory constantly. I used something like this for a while when I first started using Unix; as I was used to using a GUI and constantly seeing my files in front of me. This would, of course, be reset on run of `cd` or it would be quite stupid.
export PS1="C:\>" # DOS...
export PS1="What?\n:" # ex!
export PS1="?\n" # ed!
export PS1="\n$(
Liberty in your lifetime
PS1="\e[32m,.\e[31m\267\260\e[35m\221\222\e[32m[\e [35m\u@\h\e[32m]\e[35m\222\221\e[31m\260\267\e[32m .,\e[32m,.\e[31m\267\260\e[35m\221\222\e[32m[\e[35 m\d \t\e[32m]\e[35m\222\221\e[31m\260\267\e[32m.,\e[32 m,.\e[31m\267\260\e[35m\221\222\e[32m[\e[35m\#\e[3 2m]\e[0m\n
"
\e[0m\e[32m[\e[35m\!\e[32m]\e[35m\w\e[31m>\e[0m
Which comes out roughly as:
,.''[jedidiah@Wintermute]''.,,.''[Sat Jul 7 18:02:15]''.,,.''[3]
[502]~>
Jedidiah
--
Craft Beer Programming T-shirts
MCH=$(hostname)
PS1='[\!]${MCH}(${PWD#/*/*/*/})# '
This prints the command number in square brackets, the hostname, and the current working directory in parentheses. The directory only displays up to the last 3 subdirectories.
[42]dbs01(8.1.5/admin/XYZSTAGE)# pwd[43]dbs01(8.1.5/admin/XYZSTAGE)# cd
[44]dbs01(8.1.5/admin)#
Makes it easy to know which system and directory you are in, if you administer several systems (and numerous Oracle databases).
No, you don't click on things here$G
I remember knocking together a turbo basic program which would generate the endlessly recursing subdirectories. Blew the minds of the lecturers who were 'teaching' me at the time. Before they realised what was happening the program had been run on virtually all the PC's in the college by people wanting to see what it did.... lots of reformatting followed.
At least, if I remember correctly ;)
Ceci n'est pas un sig
My prompt is something like this (I don't feel like looking for it)
export PS1="${USER}@`hostname`:${PWD}\n[`date H:m:s`] ";
And looks something like this:
jesses@point-five.net:/home/jesses/Development/
[15:32:01]
Which comes in handy not only for knowing where you're at but for quick GPM/Eterm pastes into scp or cvs login commands.
you gotta wonder why these "I'm too leet to customize my box" people are even reading the /. discussion about customizing command prompts. I think the only reason people bother making comments like "I don't waste tme trying to be cool so I don't need change my prompt" is because they're trying to be so cool that they don't have to try to be cool. If they were legitimate not-cool-and-dont-care type hackers, they wouldn't need to share it with the /. community and insult all the 1337 prompts.
___
___
The way to see by faith is to shut the eye of reason. --Ben Franklin
export PS1="[\W]-> "
and faster
Make It Secret . Free JavaScript implementation of AES for your browser
'Your Blood? '
--Any sufficiently reliable magic is indistinguishable from technology.
set mch = `hostname - s`
set wam = `whoami`
set prompt = "${mch:q}: ${wam} {\!} "
alias setprompt 'set prompt="${mch:q}: ${cwd}{\!} "'
alias cd 'chdir \!* && setprompt'
Before this /. thread I didn't know you could have color in $PS1. Now my prompt is green when I'm a user and red after /bin/su. I'm wondering though if it's possible to change the color of the directory (\w) depending on whether $PWD is in userland or system (writable by users or not)
Wroot
#, just #.
http://erichsieht.wordpress.com/category/english/
PS1="Catastrophic System Failure: Core Dumped"
c:\>
UNI%
don't forget integer basic (also part of DOS 3.3):
PS1=">"
csh set prompt="%S %p %s [%~] %m(!)%# "
Moron.
"display RC only if RC changed" - I like this, going to steel. In my prompt I display RC only if RC != 0
I also conditionally display user name and host name - only if they different from default. And when UID=root, prompt turns red. And of cause will display colors not only on ANSI compatible terminals (and use colors only if terminal can display it).
Prompt $P$G 'Nuff said.
-
Gangis M. Khan
Unofficial Chrono Trigger 2 project
http://www.uct2.net
"Black holes are where God divided by zero." - Steve Wright
PS1="$PWD> "
to
PS1="
Memory fault(coredump)^G
$PWD>"
(^G being the "beep" character.)
While I was at it, I modified his MSDOS prompt to look similar to his Cygwin prompt, and his Cygwin prompt to:
PS1="$(pwd -P | tr / \\\\)> "
He comes back from vacation on Tuesday. Can't wait...
--
KMSMA (WWBD?)
PS1="
$(whoami)@$(hostname) [\$PWD]
$ "
Something simple to liven up my day. export PS1="\h:\W:Master?
One of the coolest crashes I can remember is the time I encrypted a .COM file with VOYNICH enrcryption. The odd thing was, the com file still ran...with very odd results; It would spew garbage onto the screen while incessantly beeping and every time it beeped it would print the screen.
I miss that program, :P.
DEVICE=ANSI.SYS
"Witty Phrase."
Some of the prompts posted in these threads will severely harm your system, a couple have already been spotted actually performing 'rm -rf
For the experts here: OK, some people need to find out the hard way
For the newbies: read this:
I've you're really lazy, open a shell, change to root and type 'su nobody', this way, you cannot harm you own system as bad as root or a normal user (although you might lose some unimportant stuff)...
bit me!
What's a command prompt?
Is that the part that says File and then Edit???
Huh?
Yes, you should have rolled your eyes at that.
Those of you who read 'Got Ghand?' sohuld appreciate this one.
When I login to my UNIX box, it states "I r teh mastar!!1" and my prompt is: TehMastar%>
(By the way, my computer's name is Mr. Box)
Elmo knows where you live!
For the machine I use all the time:
export PS1="[\u]\$ " which gives me:
[miko]$ To remind me when I'm root:
PS1="\[\033[41;1;37m\][\u]\[\033[0m\]\$ "
which gives the the prompt a red background.
Miko O'Sullivan
Miko O'Sullivan
COLOR1="\[\033[1;35m\]" COLOR2="\[\033[1;36m\]" COLOR3="\[\033[0;35m\]" COLOR4="\[\033[0m\]" PS1="\[$COLOR2[\u@$COLOR1\h][$COLOR2\W]\[\\$\] $COLOR4" - and i noticed that when i put yours in and tried it it didn't wrap propperly !! Mine did that for a while - had to do a bit of tinkering but got it working in the end.
In the olden days I used 2 ANSI prompts for DOS, one when I was in pure DOS, and one when I was in a DOS window.
1. SET PROMPT=$e[1;37;45m$p$e[1;31;45m\$e[1;33;44m
2. SET WINPMT=$e[1;33;44m[Windows]$e[1;37;45m $p$e[1;31;45m$g$e[0;34;46m
Of course they both require ANSI.SYS.
- Eric, InvisibleRobot.com
I'd write to CowbowNeal to let him know, but he's probably to busy changing his prompt right now.
Free unix account: freeshell.org
PS1="[-=\h/`whoami`=-]\n\w: "
I used to be at a military college, and we had some computers for the cadets' use. One fine day, somebody left their computer while still logged in. We had e-mail aliases that could access everyone in the entire college, and for reasons I have yet to understand they were accessible by anyone. Anyway, somebody found this computer logged in and sent an obscene message to the universal alias - so everyone from the General to the lowliest first year got the message, apparently from this hapless guy who left himself logged on.
The best part is that the colonel in charge of cadets, who mustn't have known much about computers, thought that this represented a breach of national security and nearly court-martialed the guy who left his computer logged on. I think somebody in the engineering faculty straightened it all out and very little ended up happening, though.
Toronto-area transit rider? Rate your ride.
----
Capt' Trips
grep >= ! == $your
This is what my prompt says on one of my servers...
"
So, Idiot, What do you want to fuck up today?
C:\>
"
*Headline News* censorship shuts down the Internet! More at 6PM!
set prompt="%B%T %m %l %h%b %~%B %#%b "
It looks like this:
11:29 fhi2009 ttyr7 209 ~ >
It shows 24hr time, machine, terminal, command number, path.
uh, you are kinda moronic.. he pasted a story from someone else, who knew linus... as you would know had you read the beginning.
just look at my sig ;-)
intellectual property law is philosophically incoherent. it is your moral duty to ignore it or sabotage it
COLOR1="\[\033[0;36m\]"O LOR5\w$COLOR2)$COLOR1:> $COLOR4"
COLOR2="\[\033[1;31m\]"
COLOR3="\[\033[0;36m\]"
COLOR4="\[\033[1;37m\]"
COLOR5="\[\033[1;33m\]"
COLOR6="\[\033[1;34m\]"
if [ "$TERM" = "ansi" ]; then
PS1='`whoami`@`hostname`:`pwd`>'
else
PS1="$COLOR2($COLOR3\u$COLOR6@$COLOR3\h$COLOR2:$C
fi
The phone, the bane of my existance, rings. "Hello, Computer Room" I say, being helpful - BOFH
You can load your command prompt with tons of worthless crap.
Yeah that will impress the newbies.
For the longest time at home, my prompt was:
It is very dark. If you continue, you are likely to be eaten by a grue.
>
Fatal Error!
[username]
sometimes i put the path in there too. it reminds me of the OS/2 prompt... ah i loved that
Nononono, but they do, according to myth. I've seen bad videotape footage of happy windows users deep in the forests in the foothills of mountains. They have pointy ears and feathers in their hats if I remember right.....
WWJD.... for a Klondike bar?
You're the stupid one. the first line says from that guy.
[server] [dir] %
regular user:
PS1="<\u \h:\[\033[0;32m\]\W \[\033[0m\]|> "
root:
PS1="<\[\033[0;31m\]\u\[\033[0m\] \h:\[\033[0;32m\]\W \[\033[0m\]|> "
and it looks like that:
<root spanky:root |>
with colors (red for root)
I use Mac OS 9.1 so if I want a command prompt I have to go into Open Firmware :D (command+option+o+f while you turn power on) My promt is:
0)
yay, nice prompt, ehh?
\w always gives ~ for your home directory. That sucks. Of course its a little thing really, but still sucks. Some fun ideas here.
so here is mine :
PS1="(\l) [\u@\[\e[31;1m\]\h\[\e[0m\]:\w] $ "
I dunno, I just like to know what tty I am on (\l) and my server is the firewall, so I like the name to be in bold red
(\[\e[31;1m\]\h\[\e[0m\]:).
And yes I put a space between the $ and the end of string. Its just nice to have that space.
Boring, but shows the current directory on one line, with the hostname and history number on the next. PS1=\w\n[\h] \!\$
This is a simplified version of bashprompt
;;
;;
;;
;;
;;
;;
;;
;;
;;
/proc/loadavg| cut -f2 -d/)" /proc/loadavg)" /proc/loadavg .. anyone know FreeBSD equiv?? =)3 /$COLOR1$GRAD3"
R 1\u$COLOR3@$COLOR1\h$PDP$COLOR1\#$COLOR3/$COLOR1$T TY$PDP$COLOR1$TIME$COLOR3:$COLOR1$DATE$PVL$COLOR2) $COLOR1$DASH$COLOR3$DASH$COLOR3$CLOSERIGHT$COLOR1$ DASH$COLOR2($COLOR1\w$COLOR2)$COLOR1$DASH$COLOR3$D ASH$COLOR4 "
### Uncomment whichever color scheme you want.
local COLOR_SCHEME=cyan
#local COLOR_SCHEME=grey
#local COLOR_SCHEME=red
#local COLOR_SCHEME=green
#local COLOR_SCHEME=magenta
#local COLOR_SCHEME=blue
#local COLOR_SCHEME=yellow
#local COLOR_SCHEME=white
### Leave these alone, unless you want the sky grass and the green blue =)
local NOBOLD="\033[0m"
local BOLD="\033[1m"
local BLACK="\033[30m"
local GREY="\033[0m"
local RED="\033[31m"
local GREEN="\033[32m"
local YELLOW="\033[33m"
local BLUE="\033[34m"
local MAGENTA="\033[35m"
local CYAN="\033[36m"
local WHITE="\033[37m"
case "$COLOR_SCHEME" in
black|BLACK)
local COLOR=$WHITE
grey|GREY)
local COLOR=$WHITE
red|RED)
local COLOR=$RED
green|GREEN)
local COLOR=$GREEN
yellow|YELLOW)
local COLOR=$YELLOW
blue|BLUE)
local COLOR=$BLUE
magenta|MAGENTA)
local COLOR=$MAGENTA
cyan|CYAN)
local COLOR=$CYAN
white|WHITE)
export COLOR=$WHITE
esac
local COLOR1="\[$NOBOLD$COLOR\]"
local COLOR2="\[$BOLD$COLOR\]"
local COLOR3="\[$BOLD$BLACK\]"
local COLOR4="\[$GREY\]"
local GRAD1="\$(cut -f4 -d\
local GRAD2="\$(echo \`users | wc --words\`)"
local GRAD3="\$(cut -f1 -d\
local TTY="\$(tty|cut -d/ -f3)"
local TIME="\t"
local DATE="\d"
local PDP="$COLOR2)$COLOR1$DASH$COLOR2("
### PVL wil draw extra stuff from
local PVL="$PDP$COLOR1$GRAD1$COLOR3/$COLOR1$GRAD2$COLOR
PS1="\n$COLOR3$OPENRIGHT$COLOR1$DASH$COLOR2($COLO
PS2="$COLOR2$DASH$COLOR1$DASH$COLOR3$DASH$COLOR4 "
Common sense is not so common.
WAY2FONKY$ uname -a
Linux greatspacetoaster 2.4.5 #4 Tue May 29 17:36:20 MDT 2001 i686 unknown
WAY2FONKY$
well, kinda. it runs sequentually with each second:
m \@ \[\033[0;36m\]\h\[\033[1;30m\]\[\033[1;30m\])(\[\0 33[0;3`date +s|sed 's/........//'`m\]\W\[\033[1;30m\]) -\[\033[0;36m\]> \[\033[0;40m\]'
PS1='\[\033[1;30m\](\[\033[0;36m\]\u\[\033[1;30
note: partially copied from www.vulnerable.org/sys (madog).
looks like this:
[2:03] [mattw@Metallica] [~]
what it is:
set prompt="%B[%@]%b [%n@%m] [%~] "
i dont even have bash installed. (using FreeBSD cos linux is slower)
this is my first slashdot post.
set prompt="%S%T-%m-%C2-%h>" gives me the time, machine, two current directory and it's parent as well as the history. Small, simple, everything that I need, without wasting much.