Created
March 29, 2016 09:49
-
-
Save shahzaibalikhan/539473d39be373a09969 to your computer and use it in GitHub Desktop.
General Linux .bashrc
This file contains 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
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
xhost +local:root > /dev/null 2>&1 | |
complete -cf sudo | |
shopt -s cdspell | |
shopt -s checkwinsize | |
shopt -s cmdhist | |
shopt -s dotglob | |
shopt -s expand_aliases | |
shopt -s extglob | |
shopt -s histappend | |
shopt -s hostcomplete | |
export HISTSIZE=10000 | |
export HISTFILESIZE=${HISTSIZE} | |
export HISTCONTROL=ignoreboth | |
export JAVA_FONTS=/usr/share/fonts/TTF | |
export EDITOR=/usr/bin/nano | |
alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' | |
alias ll='ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' | |
alias la='ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F' | |
alias grep='grep --color=tty -d skip' | |
alias cp="cp -i" # confirm before overwriting something | |
alias df='df -h' # human-readable sizes | |
alias free='free -m' # show sizes in MB | |
alias np='nano PKGBUILD' | |
alias fixit='sudo rm -f /var/lib/pacman/db.lck && sudo pacman-mirrors -g && sudo pacman -Syyuu && | |
sudo pacman -Suu' | |
#My Custom alias | |
alias sublime='subl3' | |
alias sdd='cd /home/shahzaib/ServerDoc && ll' | |
alias startHttp='sudo systemctl start httpd' | |
alias startMySQL='sudo systemctl start mysqld' | |
alias ProjectsDir='cd ~/Projects/MyBazar' | |
#Gist Alias | |
#------------------------------------ | |
# User specific aliases and functions | |
#------------------------------------ | |
# Useful shortcut to quickly open .bashrc and source it | |
alias bashrc="vi ~/.bashrc; source ~/.bashrc" | |
# Make a patch file between two source trees | |
alias make_patch="diff -uNr" | |
# Clear the screen of your clutter | |
alias c="clear" | |
alias cl="clear;ls;pwd" | |
# Make grep use color by default, and make a shortcut to using perl regex | |
alias grep="grep --color" | |
alias grepp="grep -P --color" | |
# Shortcuts for various ls options. All of these add colors, ignore files | |
# ending with '~', and add '/' to the end of folders. Shortcuts ending | |
# with 'a' show hidden files as well, except the redundant '.' and '..'. | |
alias ls="ls -pB --color" | |
alias la="ls -pA --color" | |
alias ll="ls -phl --color" # long-form list | |
alias lla="ls -phlA --color" | |
alias lz="ls -pshS --color" # sort by file size | |
alias lza="ls -pshSA --color" | |
alias lt="ls -pghotr --color" # long-form, sort by modification date | |
alias lta="ls -pghotrA --color" | |
alias lx="ls -pghoX --color" # sort by file extention | |
alias lxa="ls -pghoXA --color" | |
alias lr="ls -ARpsh --color" # recursive list (watch out! It will fill your screen!) | |
# Make some of the file manipulation programs verbose | |
alias mv="mv -v" | |
alias rm="rm -v" | |
alias cp="cp -v" | |
# Prints disk usage in human readable form | |
alias d="du -sh" | |
# Removes transparency when displaying an image | |
alias show="display -flatten" | |
# ex - archive extractor | |
# usage: ex <file> | |
ex () | |
{ | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $1 ;; | |
*.tgz) tar xzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1;; | |
*.7z) 7z x $1 ;; | |
*) echo "'$1' cannot be extracted via ex()" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
# prompt | |
PS1='[\u@\h \W]\$ ' | |
export NVM_DIR="/home/shahzaib/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm | |
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting | |
if [ -f ~/.git-completion.bash ]; then | |
. ~/.git-completion.bash | |
fi | |
# Hook for desk activation | |
[ -n "$DESK_ENV" ] && source "$DESK_ENV" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment