How to set vagrant command globally
May 24, 2021
•
•
1
min to read


This article will show you how to access vagrant
commands globally on windows or linux. We will assume that vagrant
and homestead
are correctly installed.
- First of all, you will need to find or create a
.bashrc
file on your user directory. On windows, this file should be located inC:\Users\<your-user>
. On linux it should by in/home/username
- Then, type in the following function :
function homestead() {
( cd homestead_directory_path && vagrant $* )
}
The function above will simply reach the homestead
directory and then run the vagrant
command you want.
- Then save the file.
⚠️ If your
homestead
directory location is :C:\data\homestead
then, is thishomestead_directory_path
you should type/c/data/homestead
- Finally, restart your terminal and you're ready to go 👍.
Now, you can access each vagrant
commands like vagrant up
or vagrant ssh
by typing homestead up
or homestead ssh
.
Cover by Mohammad Rahmani