heiko-barth.de

// Dotfile: .bashrc

Ich habe mal ein paar Anregungen zur .bashrc Optimierung zusammen getragen:

# Color my prompt
export PS1='\[\e[0;36m\]\h\[\e[0;32m\]:\w\$\[\e[0m\] '
 
# $PS1 is your shell prompt
# \h the hostname up to the first '.'
# \[ specifying start of non-printing characters
# \e[ Start color scheme
# 0;36m Color pair to use (x;y). See also http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
# \] specifying end of non-printing characters
# \w the current working directory, with $HOME abbreviated with a tilde 
# \e[0m Stop color scheme
 
# We need to surround all non-printing characters with special bash escape sequences, \[ and \].
# These sequences will tell bash that the enclosed characters don't take up any space on the line,
# which will allow word-wrapping to continue to work properly.
# Without them, you'll end up with a nice-looking prompt
# that will mess up the screen if you happen to type in a command that approaches the extreme right of the terminal. 
 
# Color my life
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
 
export GREP_OPTIONS='--color=auto'
 
# Useful shortcuts
alias apt='aptitude'
alias cls='clear'
alias loop='while [ true ]; do'
alias mysqlctl='/etc/init.d/mysql'
 
# Lower process priority
alias low='nice -n 20 ionice -c3'
alias md5sum='low md5sum'
alias sha1sum='low sha1sum'
alias unrar='low unrar'
 
# Fix display bug when PuTTY is in UTF-8 translation mode
alias iptraf='[ $TERM == "screen" ] && iptraf || TERM=linux iptraf ' 
alias htop='[ $TERM == "xterm" ] && htop || TERM=screen-256color htop'
 
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
 
# Writes bash history immediately;  Useful for concurrent user log ins
# Applies only on interactive shells
shopt -s histappend
export PROMPT_COMMAND='history -a'
 
# Save execution time in history
export HISTTIMEFORMAT='%d.%m.%Y %H:%M:%S '
 
# This causes any lines matching the previous history entry not to be saved.
# Also commands beginning with a space character are not saved.
export HISTCONTROL='ignoreboth'
 
# This prevents writing history of this colon-separated list of patterns
export HISTIGNORE='truecrypt*'
 
# The  number  of commands to remember in the command history (default value is 500)
export HISTSIZE=500000
 
# Delay until given time
delay() {
	# $1 = hh:mm
	while [ $(date +%R) != $1 ]; do
		sleep 30
	done
}
Web 2.0



RSS   RSS abonieren

Github   Github
QR Code