Skip to content

Instantly share code, notes, and snippets.

@annarailton
Last active August 23, 2019 15:49
Show Gist options
  • Save annarailton/f102c21af367daa07a0bdaefb2f68e38 to your computer and use it in GitHub Desktop.
Save annarailton/f102c21af367daa07a0bdaefb2f68e38 to your computer and use it in GitHub Desktop.
Useful .bashrc aliases etc.
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=5000
HISTFILESIZE=10000
# Setup default editor
export EDITOR=subl
# Start ssh agent so can ssh to Git
eval "$(ssh-agent -s)"
# Required for The Fuck to work https://github.com/nvbn/thefuck
eval $(thefuck --alias)
# Get latest version of sublime-text
alias update-sublime-dev='echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list && sudo apt-get update && sudo apt-get install sublime-text'
alias update-sublime-stable=' echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list && sudo apt-get update && sudo apt-get install sublime-text'
alias update-sublime='update-sublime-dev'
# Command for getting newest file in current directory
alias newest='ls -Art | tail -n 1'
# I use readlink a lot apparently
alias where='readlink -f .'
# Add branch name to prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
# Be polite
alias please='sudo $(history -p !!)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment