Table of Contents

colorprompt

latest version:

#===============================================================
# /etc/colorprompt.sh
#
# Author: John de Graaff
#
# source file: /usr/local/syssetup/linux/etc/colorprompt.sh
#===============================================================

# INSTALL
#
# # on Redhat/CentOS:
# ln -sf /usr/local/syssetup/linux/etc/colorprompt.sh /etc/colorprompt.sh
# ln -sf /etc/colorprompt.sh /etc/profile.d/colorprompt.sh
# #or: /bin/cp -af /usr/local/syssetup/linux/etc/colorprompt.sh /etc/colorprompt.sh
#
# # on Debian/Ubuntu/MacOS:
# ln -sf /usr/local/syssetup/linux/etc/colorprompt.sh /etc/colorprompt.sh
# echo -e "\n#\n. /etc/colorprompt.sh\n" >> ~/.bashrc 
# echo -e "\n#\n. /etc/colorprompt.sh\n" >> /etc/skel/.bashrc 
# #or: /bin/cp -af /usr/local/syssetup/linux/etc/colorprompt.sh /etc/colorprompt.sh

#===============================================================
# Definitions
#===============================================================

# Define some colors first:
red='\e[0;31m'
RED='\e[1;31m'
green='\e[0;32m'
GREEN='\e[1;32m'
yellow='\e[0;33m'
YELLOW='\e[1;33m'
blue='\e[0;34m'
BLUE='\e[1;34m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
NOCOLOR='\e[0m'              # No Color
# --> Nice. Has the same effect as using "ansi.sys" in DOS.

#===============================================================
# PATH
#===============================================================

export PATH=/usr/local/syssetup/bin:$PATH

#===============================================================
# Shell prompt
#===============================================================

# version 1:
#
# --[22:26:19 jdegraaff@multi-delft-01]-------------------------------------------
# /etc/profile.d>
#
#PS1="${cyan}--[\t \u@\h]-------------------------------------------${NOCOLOR}\n\w> "

# version 2:
#
# --[CWD=/etc/profile.d]--[22:25:37]--[root@multi-delft-01]------
# >
#
#PS1="${cyan}--[CWD=${red}\w${cyan}]--[\t]--[${red}\u${cyan}@\h]------${NOCOLOR}\n> "
PS1="${cyan}--[CWD=${red}\w${cyan}]--[\t \d]--[${red}\u${cyan}@\h]------${NOCOLOR}\n> "

#===============================================================
# Timeout
# - seconds after BASH shell will exit (for serial consoles)
#===============================================================

# note: apparently "system1>ssh system2" will timeout system1 ....
# so only apply to serial consoles

# seconds   time
# 900	      15 min
# 1800      30 min
# 3600      1 hour
# 14400     4 hours
# 28800     8 hours
# 86400     1 day (24 hours)

TMOUT=14400

#===============================================================
# FTP Passive
#===============================================================

FTP_PASSIVE=1

#===============================================================
# Proxy
#===============================================================

#ftp_proxy=http://proxy.minvenw.nl:80/
#http_proxy=http://proxy.minvenw.nl:80/

#===============================================================
# ENVIRONMENT
#===============================================================

EDITOR=vi
VISUAL=vi

#===============================================================
# ALIASES AND FUNCTIONS
#===============================================================

alias o='less -iS'
alias path='echo -e ${PATH//:/\\n}'
alias cls='clear'

alias hg='history | grep'
alias ng='lsof -i -n -P | grep'
alias psg='ps aux | grep'
alias fm='/usr/bin/find . \( -path '*.svn*' -prune \) -o \( -path '*/proc/*' -prune \) -o \( -type f -printf "%010T@ [%Tc] %p\n" \) | sort -n | tail'
alias ifc="/sbin/ifconfig | egrep 'encap|addr|MTU'"
alias cdp='echo "change dir to: `pwd -P`";cd `pwd -P`'
alias dusort='du -sbx * .??* | convertsize.pl | sort'
alias fusort='find -maxdepth 2 -type f -size +2048k -printf "%s\t%p\n" | convertsize.pl | sort'
alias pt='perltidy -b -i=3 --cuddled-else'

alias du='du -h'
alias df='df -kh'

alias lt='ls -altr -hp'             # sort by date-reverse (youngest at bottom)
alias ltd='find . -type d -maxdepth 1 -printf "%4m %3n %8u %8g %5s %t %f/\n"'

#alias vi='/usr/local/bin/syssetup/vi'
#alias joe='/usr/local/bin/syssetup/joe'
#alias vi="/usr/bin/vim"
#alias vi="/usr/bin/vim"
alias vi=vim

ff ()   { echo "# bash-function 'ff':";  /usr/bin/find . -iname '*'$1'*'; }
ff2 ()  { echo "# bash-function 'ff2':"; /usr/bin/find . ! -ipath '*.svn*' -iname '*'$1'*'; }
fif ()  { echo "# bash-function 'fif':"; /usr/bin/find . -xtype f -iname '*'$2'*' -print0 | xargs -0i grep -sinH "$1" "{}"; }
fif2 () { echo "# bash-function 'fif':"; /usr/bin/find . -xtype f ! -ipath '*.svn*' -iname '*'$2'*' -print0 | xargs -0i grep -sinH "$1" "{}"; }
# Mac: fif () { echo "# bash-function 'fif':"; /usr/bin/find . -type f -iname '*'$2'*' -print0 | xargs -0 grep -sinH "$1" "{}"; }

# -i causes Less to search '/' with case-insensitive
# -S chop long-lines
# -F exit if one-screen
LESS='-i -S'

#===============================================================