May 14th, 2004, 12:04
After looking at Friscos pictures of office and computers, it inspired me to jump back into something I was working on a few weeks ago, but had to put it on hold. Basically, I need to spiff up my command prompt as well as maybe add some colors to my syslog logs, maybe even my maillogs.

I brought my "Unix Power Tools" book into work today and plan on going through it a today, to try and gather ideas on how I can make my command prompt look pretty.

Was curious if anyone had any links that they like on how to modify the command prompt and add color to some logs. I'm getting tired of just looking at the '#' prompt, or the '$'.

Feel free to post your pics as well. I'm always look for new things to get my brain turning....

May 14th, 2004, 12:26
I have mostly switched to tcsh for my shell. I still use bash some but not so much after I discovered some nice tweaks for tcsh. I got my .tcshrc from optyk originally because I liked the colored prompt. I've added to it and tweaked it from there. The .bashrc is one I pulled from a linux box long ago.

Here's an example of my bash and tcsh prompts. Notice that I changed the color to all red when you are su'ed to root.


.tcshrc ( autolist and correct=cmd make tcsh really nice)

# $FreeBSD: src/share/skel/dot.cshrc,v 1.13 2001/01/10 17:35:28 archie Exp $
# .cshrc - csh resource script, read at beginning of execution by each shell
# see also csh(1), environ(7).

alias h history 25
alias j jobs -l
alias la ls -a
alias lf ls -FA
alias ll ls -lA

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin)

setenv EDITOR vi
setenv PAGER more

if ($?prompt) then
# An interactive shell -- set some stuff up
set filec
set history = 100
set savehist = 100
set mail = (/var/mail/$USER)
if ( $?tcsh ) then
bindkey "^W" backward-delete-word
bindkey -k up history-search-backward
bindkey -k down history-search-forward
set autolist
set correct=cmd
if ($uid) then
set prompt = "%{\033[34m%}%B<%n@%{\033[31m%}%m%{\033[34m%}>%b%{\033[0m%} %~ > "
set prompt = "%{\033[31m%}%B<root@%{\033[31m%}%m%{\033[31m%}>%b%{\033[0m%} %~ # "


# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

# by default, we want this to get set.
# Even for non-interactive, non-login shells.
if [ `id -gn` = `id -un` -a `id -u` -gt 99 ]; then
umask 002
umask 022

# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

if [ -z "$loginsh" ]; then # We're not a login shell
for i in /etc/profile.d/*.sh; do
if [ -x $i ]; then
. $i

unset loginsh

May 15th, 2004, 00:07
heres another bash shell

export PS1='\[\033[01;31m\]\u@\h \[\033[01;32m\]\W \$ \[\033[00m\]'

and heres a zsh one

PS1=$'%{\e[1;32m%}%n@%m \e[1;33m%}%1d %# %{\e[0m%}'

These are just the PS1's, youll need to fill up the rest of your .bashrc or .zshrc with your alias, etc