# ~/.bashrc: executed by bash(1) for non-login shells. # If not running interactively, don't do anything [ -z "$PS1" ] && return # The prompt command will only show the current directory and username if the terminal type is "correct" [ "$TERM" == "xterm" -o "$TERM" == "rvxt" ] && export PROMPT_COMMAND='echo -ne "\033]0;${debian_chroot:+($debian_chroot)}${USER}@${HOSTNAME}: ${PWD}\007"' # Superuser will get a timeout for the shell if it's a remote shell via SSH [ -n "$SSH_TTY" ] && [ $UID -eq 0 ] && export TMOUT=1800 export IGNOREEOF=2 export CDPATH=~:~/docs:~/src:/mnt:/usr/lib:/usr/local export PATH=$PATH:~/bin # Remove empty entries export PATH=${PATH//::/:} if [ $UID -eq 0 ]; then export PS1='${debian_chroot:+($debian_chroot)}\[\033[1;31m\]${SHLVL:+[$SHLVL] }\u\[\033[1;34m\]@\h\[\033[0m\]:\[\033[1;32m\]\w\[\033[0m\]\$ ' NEWPATH='' LASTDIR='' for dir in ${PATH//:/ }; do LASTDIR=$dir [ ! -d $dir ] && continue if [ "$(ls -lLd $dir | grep '^d.......w. ')" ]; then echo -e "\nDirectory $dir in PATH was world-writable, removed it from PATH!!!" elif [ "$NEWPATH" != "$dir" ]; then NEWPATH=$NEWPATH:$dir fi done # Remove the leading colon and export this as the path export PATH=${NEWPATH:1:${#NEWPATH}} else export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;34m\]${SHLVL:+[$SHLVL] }\u@\h\[\033[00m\]:\[\033[01;32m\]\w\[\033[00m\]\$ ' fi # don't put duplicate lines in the history. See bash(1) for more options export HISTCONTROL=erasedups:ignorespace export HISTIGNORE="&:ls:ll:l:[bf]g:exit:clear" # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize shopt -s cdspell shopt -s dotglob # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)" # ANSI color codes # ---------------- # Black 0;30 Dark Gray 1;30 # Blue 0;34 Light Blue 1;34 # Green 0;32 Light Green 1;32 # Cyan 0;36 Light Cyan 1;36 # Red 0;31 Light Red 1;31 # Purple 0;35 Light Purple 1;35 # Brown 0;33 Yellow 1;33 # Light Gray 0;37 White 1;37 umask 022 # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi export LS_OPTIONS='--color=auto' alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -l' alias l='ls $LS_OPTIONS -all' # Some more alias to avoid making mistakes: # alias rm='rm -i' # alias cp='cp -i' # alias mv='mv -i' alias mc='mc -c' alias grep='egrep' alias ducks='du -ckhs * |sort -rn |head -11' alias psaux='ps awux' alias nano='nano -w' alias currdate='date +"%Y-%m-%d %H:%M:%S"' if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi if [ -d ~/.bashrc.d ]; then for f in `ls -A ~/.bashrc.d`; do . ~/.bashrc.d/$f done fi