Zum Inhalt springen

.bashrc

    [codesyntax lang=“bash“]

    # Reset
    Color_Off=$'\e[0m'       # Text Reset
    
    # Regular Colors
    Black=$'\e[0;30m'        # Black
    Red=$'\e[01;31m'         # Red
    Green=$'\e[0;32m'        # Green
    Yellow=$'\e[0;33m'       # Yellow
    Blue=$'\e[01;34m'        # Blue
    Purple=$'\e[0;35m'       # Purple
    Cyan=$'\e[0;36m'         # Cyan
    White=$'\e[0;37m'        # White
    
    PS1='\n\[${Cyan}\]\t\n\[${Green}\]\w \[${White}\]- $(du -sh)\n\[${Red}\]\u\[${White}\]@\[${Blue}\]\h\[${Color_Off}\][~]'
    
    alias cd..='cd ..'
    alias ..='cd ..'
    alias ...='cd ../../../'
    alias ....='cd ../../../../'
    alias .....='cd ../../../../'
    alias .4='cd ../../../../'
    alias .5='cd ../../../../..'
    
    alias ll='ls -la --color=auto'
    alias lld='ls -la | grep "^d"'
    alias lm='ls -la --color=auto | more'
    alias l.='ls -d .* --color=auto'
    alias grep='grep --color=auto'
    alias ff="find . -type f -name"
    alias cls="clear"
    alias numfiles="echo $(ls -1 | wc -l)"
    alias du="du -sh"
    alias size="du -sh"
    alias rbash=". ~/.bashrc"
    alias ebash="vi ~/.bashrc"
    
    # sudo fixes
    alias update='sudo apt-get update'
    alias install='sudo apt-get install'
    alias remove='sudo apt-get remove'
    alias search='sudo apt-cache search'
    alias updatedb='sudo updatedb'
    
    # easy extract
    extract () {
      if [ -f $1 ] ; then
          case $1 in
              *.tar.bz2)   tar xvjf $1    ;;
              *.tar.gz)    tar xvzf $1    ;;
              *.bz2)       bunzip2 $1     ;;
              *.rar)       rar x $1       ;;
              *.gz)        gunzip $1      ;;
              *.tar)       tar xvf $1     ;;
              *.tbz2)      tar xvjf $1    ;;
              *.tgz)       tar xvzf $1    ;;
              *.zip)       unzip $1       ;;
              *.Z)         uncompress $1  ;;
              *.7z)        7z x $1        ;;
              *)           echo "don't know how to extract '$1'..." ;;
          esac
      else
          echo "'$1' is not a valid file!"
      fi
    }
    
    # create archive
    mktar() { tar cvf  "${1%%/}.tar"     "${1%%/}/"; }
    mktgz() { tar cvzf "${1%%/}.tar.gz"  "${1%%/}/"; }
    mktbz() { tar cvjf "${1%%/}.tar.bz2" "${1%%/}/"; }

    [/codesyntax]