I’ve created a new Laravel application using docker and Laravel Sail. I’ve used Ubuntu on my Windows 11 computer to store my application using sail. Everything works as intended and I can access my application.
The problem I’m experiencing is that every time I need to run Laravel Sail commands I need to type in the full path: ./vendor/bin/sail (command)
. I know the way to add a bash alias is the following:
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
The issue is that every time I open up Ubuntu using my Windows terminal, or reset my computer, this alias is gone. I’ll have to re-apply the command into the terminal to use the alias again, until the next computer refresh.
How can I make sure this bash alias sticks, instead of having to type this out every single time I have to restart my computer?
2
Answers
You can add alias depending on the terminal you’re using, If you’re using
zsh
orbash
If zsh then run
and then add alias –
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
if you are using
bash
run in your terminaland then add alias –
alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail'
,Add alias sail=’bash vendor/bin/sail’ in your .bashrc in your home directory if you are using ubuntu dont know about windows