Skip to content

Instantly share code, notes, and snippets.

@tpb1908
Last active November 23, 2017 00:05
Show Gist options
  • Save tpb1908/19bea9d208a3384963a544973d601257 to your computer and use it in GitHub Desktop.
Save tpb1908/19bea9d208a3384963a544973d601257 to your computer and use it in GitHub Desktop.
alias please='sudo $(history -p !!)'
alias accio='sudo apt-get install'
alias alohomora='chmod 777'
alias setclip="xclip -selection c"
alias getclip="xclip -selection c -o"
alias ls="ls --color=auto"
alias lsh='ls -lhXG' # long listing, human-readable, sort by extension, do n$
alias downloads="cd ~/Downloads"
alias documents="cd ~/Documents"
## get rid of command not found ##
alias cd..='cd ..'
## a quick way to get out of current directory ##
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
function up( )
{
LIMIT=$1
P=$PWD
for ((i=1; i <= LIMIT; i++))
do
P=$P/..
done
cd $P
export MPWD=$P
}
source ~/Documents/programs/bashmarks/bashmarks.sh
alias grep="grep --color=auto"
alias gc='git commit -m'
alias gca='git add -A; git commit -m'
alias gpm='git push origin master'
alias gp='git push origin'
alias gitc='git ls-files | xargs wc -l'
alias gitcj='git ls-files | grep "\.java$" | xargs wc -l'
alias ports='netstat -tulanp'
alias ip="curl icanhazip.com"
function cls() { cd "$1"; ls;}
function md5check() { md5sum "$1" | grep "$2";}
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
return 1
else
for n in $@
do
if [ -f "$n" ] ; then
case "${n%,}" in
*.tar.bz2|*.tar.gz|*.tar.xz|*.tbz2|*.tgz|*.txz|*.tar)
tar xvf "$n" ;;
*.lzma) unlzma ./"$n" ;;
*.bz2) bunzip2 ./"$n" ;;
*.rar) unrar x -ad ./"$n" ;;
*.gz) gunzip ./"$n" ;;
*.zip) unzip ./"$n" ;;
*.z) uncompress ./"$n" ;;
*.7z|*.arj|*.cab|*.chm|*.deb|*.dmg|*.iso|*.lzh|*.msi|*.rpm|*.udf|*.wim|*.xar)
7z x ./"$n" ;;
*.xz) unxz ./"$n" ;;
*.exe) cabextract ./"$n" ;;
*)
echo "extract: '$n' - unknown archive method"
return 1
;;
esac
else
echo "'$n' - file does not exist"
return 1
fi
done
fi
}
alias cputemp='sensors | grep Core'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment