#!/bin/bash ######################################## MEINE EINSTELLUNGEN # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then eval "`dircolors -b`" alias ls='ls -h --color=auto' alias dir='dir --color=auto' alias vdir='vdir --color=auto' alias grep='grep -i --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep -i --color=auto' #alias today=date +"%A, %B %-d, %Y" # some more ls aliases alias lll='ls -alF' alias ll='ls -lF' #alias ll='stat -c "%A %a %U:%G %n" ?*' alias lsd='ls -d */' alias la='ls -ACF' alias l='ls -CF' fi ## Misc alias logout='gnome-session-save --kill' alias beedit='beesu gedit' alias TV='DISPLAY=:0.1' ## Xorg alias xcat='cat /etc/X11/xorg.conf' alias xnano='sudo nano /etc/X11/xorg.conf' alias xtree='nvidia-xconfig -c' alias Xlog='cat /var/log/Xorg.0.log' ## Custom Misc,BU-/-RE alias backup-deskmenu='cp ~/.config/compiz/deskmenu/menu.xml /opt/backups/Configurations/deskmenu/menu.xml' alias restore-deskmenu='mkdir ~/.config/compiz/deskmenu && cp /opt/backups/Configurations/deskmenu/menu.xml ~/.config/compiz/deskmenu/menu.xml' alias ..='cd ..' alias ...='cd ../..' alias cd..='cd ..' alias du='du -h' alias df='df -h' alias pu='pushd' alias po='popd' alias myrepo='cd /usr/local/repo/12/Everything' ## alias mount='mount | column -t' alias webshare='python -c "import SimpleHTTPServer; SimpleHTTPServer.test();"' alias pbin='paste2pastebin.pl' alias gmnext='gmusicbrowser -launch_or_cmd NextSong' ## Packageprocessing _distissue="`cat /etc/issue`" # FIXME: this should probably be somewhere else as root doesn't read this file. somewhere inside the global bash definitions, ## FIXME: make sure this is sourced by a shell _PKGMNGR= if [ $UID != "0" ];then _PKGMNGR="`which sudo` " fi ## case "$_distissue" in *Fedora*|*fedora*|*FEDORA* ) # echo "Fedora" _PKGMNGR="$_PKGMNGR `which yum` " ;; *suse*|*Suse*|*SuSE*|*SUSE* ) # echo "SuSE" _PKGMNGR="$_PKGMNGR `which zypper`" ;; *debian*|*Debian*|*ubuntu*|*Ubuntu* ) # echo "Debian" _PKGMNGR="$_PKGMNGR `which aptitude`" ;; * ) #echo "unknown" _PKGMNGR= ;; esac # ====== DEBUG ============ alias yue="echo $_PKGMNGR" # ============================= ## Define aliases for common commands if a package-manager exists if [ "$_PKGMNGR" != "" ]; then alias yumi="$_PKGMNGR install" alias yup="$_PKGMNGR update" alias yurp="$_PKGMNGR remove" alias yus="$_PKGMNGR search" alias yusi="$_PKGMNGR info" fi unset _PKGMNGR _distissue # WAN IP function myip { curl icanhazip.com } # wiki from cli function wiki() { dig +short txt ${1}.wp.dg.cx } # cmdlinefu search cmdfu(){ curl "http://www.commandlinefu.com/commands/matching/$@/$(echo -n $@ | openssl base64)/plaintext"; } # duplicate file finder, based on size, then md5, can take long dupesfind() { find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate } # modinfo - info of all loaded modules function moduleinfo # { modinfo $(cut -d" " -f1 /proc/modules) | sed '/^dep/s/$/\n/; /^file\|^desc\|^dep/!d' } ## =============SSH================= # # # #tar cXpf - /some/important/data | ssh user@destination-machine "tar xpf - -C /some/directory/" #rsync -a -e ssh source/ username@remotemachine.com:/path/to/destination/ # # ## ================================= # export HISTTIMEFORMAT="%F %T " alias lh='ls -a | egrep "^\."' # make dir and change into it mkcd () { mkdir -p "$@" && cd "$@"; } function get-my-pubkey { gpg --recv-keys --keyserver pgp.mit.edu E7B20A8E } function get-my-rpm-key { rpm --import http://omploader.org/vMmwyZA/loomsen-pub.asc } # tarview tarview() { echo -n "Displaying contents of $1 " if [ ${1##*.} = tar ] then echo "(uncompressed tar)" tar tvf $1 elif [ ${1##*.} = tgz ] then echo "(gzip-compressed tar)" tar tvf $1 elif [ ${1##*.} = gz ] then echo "(gzip-compressed tar)" tar tzvf $1 elif [ ${1##*.} = bz2 ] then echo "(bzip2-compressed tar)" cat $1 | bzip2 -d | tar tvf - fi } function createarchive() { tar cvf "$1.tar" $2 } set +x # ======== Custom prompt # Define colors for readability #black="\[\033[0;30;49m\]" #blackgrey="\[\033[30;47m\]" _RED="\[\033[31;49m\]" _GREEN="\[\033[32;49m\]" #yellow="\[\033[33;49m\]" _BLUE="\[\033[34;49m\]" #magenta="\[\033[35;49m\]" #cyan="\[\033[36;49m\]" _WHITE="\[\033[37;49m\]" r_color="\[\033[0m\]" # Reset color #clr="\[\033[K\]" # Clear to the end of the line _HOST="@\h" if [ ${UID} -eq 0 ]; then # [[ $SSH_CONNECTION ]] && _HOST="${_HOST}" _USER="$_RED\u$_HOST" else [[ $SSH_CONNECTION ]] && _HOST="${_RED}${_HOST}" _USER="$_GREEN\u$_HOST" fi #[[ -f /tmp/is_a_chroot ]] && PS1="${_WHITE}chroot\:${PS1}" PS1="$_USER [\w]$r_color " #$_GREEN if [ -f /tmp/is_a_chroot ]; then PS1="${_WHITE}chroot:${PS1}" fi unset _USER r_color _RED _BLUE _GREEN _HOST _WHITE