Last active
October 12, 2018 22:03
-
-
Save facelordgists/6572831 to your computer and use it in GitHub Desktop.
My .bash_profile used on Mavericks OSX 10.9
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
#!/bin/bash | |
## ================================== | |
## Servers | |
## ================================== | |
# A server with a non-standard SSH port, using passwordless RSA key authentication | |
alias server1='ssh -p 2200 [email protected]' | |
# A server that uses a certficate for authentication | |
alias server2='ssh -i ~/.ssh/amazon_ec2_certificate.pem [email protected]' | |
# Automatically switch to a directory upon login | |
alias server3='ssh -t -p 2200 [email protected] "cd /var/www/vhosts ; bash"' | |
## ================================== | |
## UTILITIES | |
## ================================== | |
# 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 e $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 | |
} | |
# Request a new DHCP lease for a new IP address | |
alias newip='sudo ipconfig set en0 BOOTP ; ipconfig set en0 DHCP' | |
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
# some more ls aliases | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' | |
## Git Aliases | |
## ----------- | |
alias gs='git status' | |
alias gb='git branch' | |
alias gca='git commit -a' | |
alias gcm='git commit -m' | |
alias gl='git pull' | |
alias gp='git push' | |
alias gpom='git push origin master' | |
alias gd='git diff' | |
alias gco='git checkout' | |
alias pull='git pull origin master' |
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
# Add NPM, Node and Grunt to path | |
export PATH=$HOME/local/node/bin:/usr/bin/:/usr/local/bin:/usr/local/share/npm/bin$PATH | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# make less more friendly for non-text input files, see lesspipe(1) | |
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color) color_prompt=yes;; | |
esac | |
force_color_prompt=yes | |
if [ -n "$force_color_prompt" ]; then | |
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
# We have color support; assume it's compliant with Ecma-48 | |
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |
# a case would tend to support setf rather than setaf.) | |
color_prompt=yes | |
else | |
color_prompt= | |
fi | |
fi | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" | |
;; | |
*) | |
;; | |
esac | |
# enable programmable completion features. Must be installed using brew using the following command: | |
# brew install bash-completion | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
# make bash autocomplete with up arrow | |
bind '"\e[A":history-search-backward' | |
bind '"\e[B":history-search-forward' | |
# make tab cycle through commands instead of listing | |
bind '"\t":menu-complete' | |
bind "set completion-ignore-case on" | |
# show git branch name in prompt | |
PS1='\[\e[1;32m\]\u: $CurDir $(__git_ps1 " (%s)")\$\[\e[0m\] ' | |
# git completion | |
# uses https://gist.github.com/2273507 | |
source ~/scripts/git-completion.sh | |
# Alias definitions. | |
# ~/.bash_aliases, instead of adding them here directly. | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi |
To install bash completion using brew:
brew install bash-completion
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create a file named
~/scripts/git-completion.sh
And paste the contents of this into it:
(https://gist.github.com/facelordgists/8105103)