I\'m being put in charge of managing a bunch of servers, I want to set up my prompts on each of them so that I don\'t get confused as to where I am logged in to.
I\'ve e
This page has a pretty good explanation, although the syntax is a bit different in csh
. Here's what I came up with:
set prompt="%{\e[32;1m%}%n%{\e[37m%}@%{\e[33m%}%m%{\e[37m%}:%{\e[36m%}%~%{\e[37m%}"\$"%{\e[0m%} "
# root variation:
set prompt="%{\e[31;1m%}root%{\e[37m%}@%{\e[33m%}%m%{\e[37m%}:%{\e[36m%}%/%{\e[37m%}#%{\e[0m%} "
update: the previous prompt I had here didn't actually update when you changed directories. using %n
, %~
and %m
instead of $cwd
or pwd
actually update. see here.
%{ ... %}
means the stuff between should take 0-width
\e[ ... m
specifies the colors and bolding. \e
escapes the [
which seems to be necessary (I believe it's equivalent to \033
), the m
signifies the end.
Use 0
as your color to reset to default.
If you want to set a color and background, simply separate the numbers with semi-colons. Use 1
to enable bolding.
Consult this table to choose your colors:
(source: funtoo.org)
So for example, "Hello World" in bold, cyan on a red background would be %{\e[36;41;1m%}Hello World%{\e[0m%}