Last active
November 11, 2021 09:44
-
-
Save pcbulai/7024143 to your computer and use it in GitHub Desktop.
.bashrc file with some useful aliases and functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# User specific aliases and functions | |
### autocorrects cd misspellings, 'cd /sur/src/linus' >> 'cd /usr/src/linux' ### | |
shopt -s cdspell | |
### Aliases ### | |
alias :hi="history" | |
alias :x="startx" | |
alias :rr="sudo su" | |
alias :rbt="sudo reboot" | |
alias :shd="sudo shutdown -h now" | |
alias :z="cd ../" | |
alias :sv="cd /var/www/" # Go to your local server | |
alias :ch="sudo chmod 777 -R ./" | |
alias :q="exit" | |
alias ls="ls --color" | |
alias g:pull="git pull" | |
alias g:stpl="git stash&&git pull" | |
alias g:stat="tig" | |
alias g:branch="git branch" | |
alias g:check="git checkout" | |
alias :build="grunt build" | |
alias :serve="grunt serve" | |
alias i:serve="ionic serve" | |
alias i:build="ionic build" | |
alias i:emulate="ionic emulate" | |
alias i:run="ionic run" | |
#alias c:prepare="cordova prepare" | |
alias :t="tmux" | |
alias :work="cd /mnt/Work" | |
alias v:up="vagrant up" | |
alias v:halt="vagrant halt" | |
alias v:ssh="vagrant ssh" | |
### Functions ### | |
chs(){ | |
sudo chmod 777 $1 $2 | |
} | |
install(){ | |
sudo apt-get install -y $1 | |
} | |
# mkmv - creates a new directory and moves the file into it, in 1 step | |
# Usage: mkmv <file> <directory> | |
mkmv() { | |
mkdir "$2" | |
mv "$1" "$2" | |
} | |
### Bash Completion ### | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
commit() { | |
git add $1 && git commit -m $2 && git push origin $3 | |
} | |
### Extract Archives ### | |
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjvf $1 ;; | |
*.tar.gz) tar xzvf $1 ;; | |
*.bz2) bzip2 -d $1 ;; | |
*.rar) unrar2dir $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $1 ;; | |
*.tgz) tar xzf $1 ;; | |
*.zip) unzip2dir $1 ;; | |
*.Z) uncompress $1 ;; | |
*.7z) 7z x $1 ;; | |
*.ace) unace x $1 ;; | |
*) echo "'$1' cannot be extracted via extract()" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
#bu - Back Up a file. Usage "bu filename.txt" | |
bu () { | |
cp $1 ${1}-`date +%Y%m%d%H%M`.backup; | |
} | |
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting | |
zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment