Last Updated: February 25, 2016
· harshadkale

bash_profile backup

I extensively utilize ~/.bash_profile for my aliases. Here's the copy of my bash_profile aliases (it keeps getting better)

alias src='source ~/.bash_profile'
alias cd..='cd ..'
alias ..='cd ..'
alias cd~='cd ~'
alias cddl='cd ~/Downloads'
alias cddb='cd ~/Dropbox'
alias cdsd='cd ~/SkyDrive'
alias cdgd='cd ~/Google\ Drive'
alias proj='cd ~/Dropbox/projects'
alias cls='clear'
alias c='clear'
alias edit='nano'
alias hbu='brew update'
alias hbp='brew upgrade'
alias su='sudo -i'
alias psg='ps aux | grep '
alias asdk='android sdk'
alias guid='uuidgen'
alias md='mkdir'

# open folder in Finder
alias f='open -a Finder ./'  
# open folder in Finder and load in Sublime Text
alias fsubl='f && subl .'      
# open parent folder in Finder
alias fp='cd.. && f'             
# open parent folder in Finder and load in Sublime Text 
alias fpsubl='subl . && fp'  

I always worry of losing my bash_profile (I don't know why and how, I just do) and so decided to back it up from Dropbox

# No .bash_profile, just bash_profile so that it doesn't remain hidden in Dropbox
>>$ mv ~/.bash_profile ~/path/to/dropbox/folder/bash_profile
>>$ cd ~
# Symbolic link with .bash_profile so that it remains hidden in ~ folder
>>$ ln -s ~/path/to/dropbox/folder/bash_profile ~/.bash_profile 
# I have aliased 'source ~/.bash_profile' as just 'src' to reload bash_profile 
>>$ src 

2 Responses
Add your response

Ha, I know that feel too; I used to save mine on Dropbox as well but I've recently switched to using gists for that kind of things, I find it more flexible. Here's mine, for that matter.

Seeing your folder / files aliases, you might want to have a look at fasd (and / or my protip about it in the meantime), it's a real time saver.

You might also want to check the pgrep and pkill commands, not that much of an improvement but it's just good to know they exist :)

over 1 year ago ·

I think i will like 'fasd'. Didn't get time to explore it a lot but it looks cool from the github page and your protip.

Thanks for sharing.

over 1 year ago ·