Skip to content

Instantly share code, notes, and snippets.

@boo13
Last active October 31, 2019 18:50
Show Gist options
  • Save boo13/859e03a9dcdfe7b93d6120721e4fed7e to your computer and use it in GitHub Desktop.
Save boo13/859e03a9dcdfe7b93d6120721e4fed7e to your computer and use it in GitHub Desktop.
Bash Aliases I Actually Use...

No aliases I don't really understand cus I got them off the internet, no aliases I consistently forget to use...

These are the REAL aliases... the aliases I actually use.

# ========================
# python
# ========================
alias pip='pip3'
alias py='python3'
alias python='python3'

# virtualenv stuff
alias venv='source deactivate &> /dev/null; source venv/bin/activate; pip install --upgrade pip'
alias ae='source deactivate &> /dev/null; source venv/bin/activate; pip install --upgrade pip'
alias de='deactivate'

# ========================
# git
# ========================
alias gs='git status'
alias gc='git commit'
alias gb='git branch'
alias gpull='git pull'
alias gp='git push'
alias gdiff='git diff'


# ========================
# Helpers
# ========================
# List USB
alias lsdev='ls /dev/tty*'

# uses pyserial to list Serial ports
alias lserial='python3 -m serial.tools.list_ports'

# ========================
# cd & ls
# ========================
cs () {
        cd "$1" && ls -la;
}

alias ..='cd ..'
alias ...='cd ../..'
alias la='ls -lahF -G'
alias ls='command ls -G'

# For this section =======================================================================
# Thanks to Corey Schafer: https://github.com/CoreyMSchafer/dotfiles/blob/master/.aliases
# List all files colorized in long format, including dot files
alias la="ls -lahF ${colorflag}"

# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
        colorflag="--color"
else # OS X `ls`
        colorflag="-G"
fi

# List all files colorized in long format, including dot files
alias la="ls -lahF ${colorflag}"

# Always use color output for `ls`
alias ls="command ls ${colorflag}"
# Colors
export LS_COLORS='no=00:fi=00:di=04;35:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'

export LSCOLORS='Gxfxcxdxbxegedabagacad'


# ========================
# grep
# ========================
alias hg='history | grep'

# Always enable colored `grep` output
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage.
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# ========================
# Mac
# ========================
# Update System
alias update_system='sudo softwareupdate -i -a'

# Show/Hide Hidden in Finder
alias showHidden='defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder'
alias hideHidden='defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder'

# Enable aliases to be sudo’ed
alias sudo='sudo '

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment