Skip to content

Instantly share code, notes, and snippets.

@shawnachieve
Last active December 21, 2015 18:39
Show Gist options
  • Save shawnachieve/787a1175b114bd76be45 to your computer and use it in GitHub Desktop.
Save shawnachieve/787a1175b114bd76be45 to your computer and use it in GitHub Desktop.
A set of aliases for common vagrant commands.
# Clone this script using:
# cd ~
# git clone git@gist.github.com:787a1175b114bd76be45.git .vagrant_aliases
#
# Add the following to your ~/.profile file:
# if [ -f ~/.vagrant_aliases/.vagrant_aliases ]; then
# source ~/.vagrant_aliases/.vagrant_aliases
# fi
# Custom Vagrant Aliases/Commands
alias vrsync='vagrant gatling-rsync-auto'
alias vrsb='vagrant rsync-back'
# cd to vagrant project folder.
# Ex: cdvp myproject
cdvp() {
PROJECT_NAME=${1}
cd ~/vagrant/projects/${PROJECT_NAME}
}
# Start up a vagrant instance from anywhere.
# If no project name is given, assumes you are in the project folder already.
# ex: vup myproject
# ex: vup
vup() {
if [ "$#" -eq 1 ]; then
PROJECT_NAME=${1}
cdvp $PROJECT_NAME
fi
vagrant up
}
# Shut down a vagrant instance from anywhere.
# If no project name is given, assumes you are in the project folder already.
# ex: vdown myproject
# ex: vdown
vdown() {
if [ "$#" -eq 1 ]; then
PROJECT_NAME=${1}
cdvp $PROJECT_NAME
fi
vagrant halt
}
# SSH into a vagrant instance from anywhere.
# If no project name is given, assumes you are in the project folder already.
# ex: vssh myproject
# ex: vssh
vssh() {
if [ "$#" -eq 1 ]; then
PROJECT_NAME=${1}
cdvp $PROJECT_NAME
fi
vagrant ssh
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment