Search This Blog

12 December 2006

.tcshrc prompt

I have found that it is very helpful to know which domain and user you are logged in as... this is especially important with things like panic: userret which seems to be happening when using the man pages from within a jail...
complete sysctl 'n/*/`sysctl -Na`/'

# Miscellaneous Info
set HOST = `uname -n`
set HTYPE = "HOST"
#set user = `whoami`

set color_dark="00"
set color_light="01"
set color_black="30m"
set color_red="31m"
set color_green="32m"
set color_yellow="33m"
set color_blue="34m"
set color_purple="35m"
set color_cyan="36m"
set color_white="37m"
# Color Format: %{^[[DARKORLIGHT;COLOR%}
set userColor = "%{^[[$color_dark;$color_green%}"
set hostColor = "%{^[[$color_dark;$color_blue%}"
set pathColor = "%{^[[$color_dark;$color_cyan%}"
set resetColor = "%{^[[00m%}"

#set prompt="%{^[[01;31m%} `whoami`%{^[[01;37m%} %c %{^[[01;32m}%#%{^[[00m%} "

# Macros
alias setprompt 'set prompt="\n[$pathColor$HTYPE$resetColor]$hostColor$HOST$resetColor\:$userColor`whoami`$resetColor($pathColor$cwd$resetColor)\n>"'
alias cd 'cd \!* && setprompt'
alias pushd 'pushd \!* && setprompt'
alias popd 'popd \!* && setprompt'
alias ls 'ls -G'
setprompt
You should customize the non-highlighted part first, copy/paste this file and change the highlighted part per user and per domain.... for example:

































































User on Host (Above Example)
TYPEHOST
userColor$color_dark;$color_green
hostColor$color_dark;$color_blue

[HOST]serveris.eoti.org:malachi(/home/malachi)
>

Root on Host
TYPEHOST
userColor$color_dark;$color_red
hostColor$color_dark;$color_blue

[HOST]serveris.eoti.org:root(/home/malachi)
>

User in Jail
TYPEJAIL
userColor$color_dark;$color_green
hostColor$color_dark;$color_purple

[JAIL]serveris.eoti.org:malachi(/home/malachi)
>

Root in Jail
TYPEJAIL
userColor$color_dark;$color_red
hostColor$color_dark;$color_purple

[JAIL]serveris.eoti.org:root(/home/malachi)
>

No comments:

Post a Comment