My Open Bashrc

Prerequisites

  • Must be on an operating system that uses .bashrc (or zshrc).

What is a Bashrc

  • The .bashrc file is a file which executes on when you open the command console. It is typically used to set environment variables (such as PATH and LSCOLORS), to set custom aliases, and to set custom functions.

My setup:

My .bashrc file is split up into two separate files. One which contains secure data such as

  • Usernames
  • Passwords
  • Private API endpoints
  • API keys

And my common_bash.sh file which is posted below:

setopt correctall
alias untar='tar -zxvf'
alias common='vi ~/.common_bash.sh'
alias custom='vi ~/.custom_bash.sh'
alias gs='git status'
alias ga='git add .'
alias rs='rails s'
alias rc='rails c'
alias mvncp='mvn clean package'
alias mvnci='mvn clean install'
alias mvnc='mvn clean'
alias mvnp='mvn package'
alias mvni='mvn install'
alias es='elasticsearch'

alias flushdns='ipconfig /flushdns'
alias updatedb='sudo /usr/libexec/locate.updatedb'
alias home='cd ~/'
alias bye='exit'
alias ll='ls -l'
alias la='ls -a'
alias bashrc='vi ~/.zshrc'
alias vimrc='vi ~/.vimrc'
alias bs='source ~/.zshrc'
alias m2='cd ~/.m2'
alias projects='cd ~/Desktop/projects'
alias settings='vi ~/.m2/settings.xml'
LSCOLORS="gxBxhxDxfxhxhxhxhxcxcx"
export LSCOLORS
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
export PGDATA="/usr/local/var/postgres"

alias ls="ls -G"

function cd {
 builtin cd "$@" && ls -F
}

 

Advertisements

Kill All Processes

Prerequisites

  • Must have a UNIX terminal

Steps

to kill by name one can type:

ps -ef | grep ${NAME}

after you will retrieve a list of all the processes with that name then all thats left is to

kill -9 ${pid}

passing in the respected pid

Next

To kill all processes of a username its as simple as

pkill -u ${username}

Hope this saves you a little bit of time.