Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # EM
- alias s="ssh"
- alias r="rm -rf"
- alias t='top'
- alias u='uname -a; w'
- alias v='vim'
- alias e='exit'
- alias ex='exit'
- alias nv_on="echo ON > /sys/kernel/debug/vgaswitcheroo/switch"
- alias nv_of="echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"
- alias hh='history'
- alias ll='ls -alhF'
- alias lh='ls -lh'
- alias c-='c -'
- alias c..='c ../'
- alias c...='c ../../'
- alias c....='c ../../../'
- alias c.....='c ../../../../'
- alias c~='c ~'
- alias cx='chmod +x'
- alias pu='pushd .'
- alias po='popd'
- alias go='gnome-open'
- alias glog='git log --pretty=format:"%h - %an, %ar : %s" --graph'
- alias gl="git log --graph --pretty=format:'%Cblue%h%Creset -%C(bold blue)%d%Creset %C(yellow)%s %Cred(%cr) %C(white)<%an>%Creset' --abbrev-commit"
- # alias lh="ll | awk -F " " '{print $5 "\t" $9}'"
- alias gp="git pull --rebase"
- # Add support to permalias
- # http://stackoverflow.com/questions/15235141/how-to-create-a-function-in-bashrc-that-will-work-correctly-when-the-command-ru
- #
- #
- # Usage exc - <file1> <file2>
- #
- function exc() {
- mv $1 temp31337;
- mv $2 $1;
- mv temp31337 $2;
- }
- #
- # Usage: h - htop
- # h <string> - history | grep string
- #
- function h() {
- case "$#" in
- 0) htop
- ;;
- 1) history | grep $1
- ;;
- *) echo "Undefined"
- ;;
- esac
- }
- # p
- # Usage: p - ps;
- # p <proces> - ps aux | grep proces
- # p ip/host - ping ip/host
- function p() {
- case "$#" in
- 0) ps
- ;;
- 1) if [[ $1 =~ [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ || $1 =~ [a-z]+\.("com"|"net"|"org"|"ro") ]]
- then
- ping $1;
- else
- ps aux | head -1 && ps aux | grep $1;
- fi
- ;;
- *) echo "Undefined"
- ;;
- esac
- }
- # Usage c - clear; c <sursa> <destinatie>
- function c() {
- case "$#" in
- 0)
- if [[ `history | tail -2 | head -1 | awk '{ print $2 $3 }'` = "c" ]]; then
- cd;
- else
- clear;
- fi
- ;;
- 1) if [[ $1 = "-" ]]; then
- cd -;
- elif [[ -f $1 ]]; then
- cat $1;
- elif [[ -d $1 ]]; then
- cd $1 && ls;
- else
- echo "Invalid arg"
- fi
- ;;
- 2) cp -vr $1 $2;
- ;;
- *) echo "Undefined"
- ;;
- esac
- }
- # Usage: m = make; m <sursa> <dest>
- function m() {
- case "$#" in
- 0) make
- ;;
- 1) mkdir $1 && cd $1;
- ;;
- 2) mv -v $1 $2
- ;;
- *) echo "Undefined"
- ;;
- esac
- }
- # Usage: arc folder <type>
- # type = zip/tar/tar.bz/bz2
- function arc() {
- # TODO
- false;
- }
- # Usage: ext archiva.<tar.bz2/tar.gz/bz2/rar/gz>
- function ext() {
- if [ -f $1 ] ; then
- case $1 in
- *.tar.bz2) tar xvjf $1
- ;;
- *.tar.gz) tar xvzf $1
- ;;
- *.bz2) bunzip2 $1
- ;;
- *.rar) unrar 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 "'$1' Undefined "
- ;;
- esac
- else
- echo "'$1' is not a valid file"
- fi
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement