DEV Community

Discussion on: Improving your workflow with aliases! 🚀🚀🚀

Collapse
 
patricnox profile image
PatricNox

Here's my bash_profile, been using it for around 2 years now. :)

gist.github.com/PatricNox/83f714e9...

source ~/.profile
export PATH=$PATH:/Users/lia/.npm-packages/bin

## General shorthands.
alias update='source ~/.bashrc'
alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy"
alias httpdconf="code /usr/local/etc/httpd/httpd.conf"

## Local.
alias startlocal="sudo apachectl start && brew services start mysql"
alias stoplocal="sudo apachectl stop && brew services stop mysql"
alias mysql=/usr/local/bin/mysql
alias mysqladmin=/usr/local/bin/mysqladmin

## Custom tools.
alias dbsearch="cd ~/playground/search && php -S localhost:1337 -t . ; cd -"
alias localtest="cd ~/playground/localtest && code . ; php -S localhost:9090 -t . ; cd -"

## Docker shorthands.
alias dc="docker-compose"
alias d="./dev.sh"
alias dd="../dev.sh"
alias dsup="docker-compose up -d"
alias dsall='docker stop $(docker ps -aq) && docker rm $(docker ps -aq)'
alias dsr="dsall && dsup"

## Git shorthands.
alias gp="git pull"
alias wip="git reset --soft head~"

## Vagrant.
alias vup="vagrant up && vagrant ssh"

## Composer Laravel - Cache clear and stuff
alias composercc="composer dump-autoload -o && dd artisan cache:clear && composer clear-cache && dsr"

## Shorthand for ./dev.sh drush for multi-docker
md() {
  d drush $1 $2 $3 $4
}

# Add entry to hosts file, needed for Multidocker.
mdaddhost() {
  sudo echo "127.0.0.1 $1.dev.local" | sudo tee -a /etc/hosts
}

# Drush in multi-docker
function mush() {
    dir=${PWD##*/}
    echo
    echo '_____________'
    echo 'Project:' ${dir}
    echo '_____________'
    echo 

    (cd ~/docks/multi-docker ; ./dev.sh drush ${dir} "$@")
}

## Git shortcuts.
# git push
gpp() { 
  git push -u origin "$1" 
}

# git checkout
gc() { 
  git checkout "$1" 
}

## Misc. 
# ruby, sbin, openssl.
export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/openssl/bin:$PATH"

# Autocomplete Git.
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

# nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# gem
export GEM_HOME="/usr/local/lib/ruby/gems/2.6.0"
export PATH="$GEM_HOME/bin:$PATH"

# Fixes problem with "perl: warning: Setting locale failed.".
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

# Other 
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
Collapse
 
kylehunter profile image
Kyle Hunter

Thanks for sharing 😄 you gave me a few ideas of new ones I can mix in to my workflow!