Laravel Bash Aliases

Published on by

Laravel Bash Aliases image

Bash aliases are shortcuts added to a file that allows you to reference another command through more memorable words, abbreviations, or characters. For example, if you use Git you may run git status many times throughout the day, so to save yourself time and keystrokes you could alias gs to git status and it’ll automatically expand and call the proper command.

Over the years I’ve seen a lot of unusual aliases and many are unique to the person. Shortcuts that make sense to me, might be confusing and weird to you. That’s what makes these so fun.

To gain some insights into what others are doing I asked the community to share theirs with me and quite a few responded. It surprised me how many are similar in that almost everyone made shortcuts for the Artisan command. Yet everyone has a different shortcut pattern, for example, “a”, “pa”, or “art” for the php artisan command. Another unique one that a few shared is a command called “nah”:

nah='git reset --hard;git clean -df'

That one is really nice and to demonstrate how it works, pretend that you started working on a new feature, maybe added a few new files, and then after lunch, you decide everything you’ve done is wrong. By running the nah command it’ll reset your code back to what is committed, and delete any files that are not known to git. Very convenient and useful!

How To Create Your Own Base Aliases

For those new to creating bash aliases, the process is pretty simple. First, open up the ~/.bashrc file in a text editor that is found in your home directory. Uncomment or add the following lines:

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases

This tells it to load a .bash_aliases file, if it exists, so you can put all your aliases in it and make them easier to share and keep up with. Finally, create the ~/.bash_aliases file and add the following as your first alias:

alias art="php artisan"

Save the file and type the following in the terminal:

source ~/.bashrc

From here on you should be able to type art and it’ll auto expand into php artisan. Just remember that every time you modify the bash_aliases file you’ll need to either run that source command or restart Terminal so the changes are picked up.

Laravel Bash Aliases from the Community

Below is a list of all the Laravel community contributions and what they are using.


# Laravel
artisan() {
if [ -f bin/artisan ]; then
php bin/artisan "$@"
php artisan "$@"
alias serve='artisan serve'
alias tinker='artisan tinker'
# Misc PHP
t() {
if [ -f vendor/bin/phpunit ]; then
vendor/bin/phpunit "$@"
phpunit "$@"


nah='git reset --hard;git clean -df'
vm='ssh vagrant@ -p 2222'


pa='php artisan'

Mohamed Said

alias dracarys="git reset --hard && git clean -df"
alias copyssh="pbcopy < $HOME/.ssh/"
alias reloadcli="source $HOME/.zshrc"
alias zshrc="/Applications/Sublime\ ~/.zshrc "
alias shrug="echo '¯\_(ツ)_/¯' | pbcopy";
alias fight="echo '(ง'̀-'́)ง' | pbcopy";
*** This one opens a PR from the current branch
function openpr() {
br=`git branch | grep "*"`
open -a /Applications/Google\${repo/* /}/compare/${parentBranch/* /}...themsaid:${br/* /}\?expand\=1

Jeffrey Way

alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias wip="git add . && git commit -m 'wip'"
alias nah="git reset --hard && git clean -df"
alias p="phpunit"
alias pf="phpunit --filter "
alias art="php artisan"
alias migrate="php artisan migrate"

Bill Mitchell

alias a="php artisan"
alias pu="vendor/bin/phpunit"
alias puf="vendor/bin/phpunit --filter "
alias pug="vendor/bin/phpunit --group "
alias cdo="composer dump-autoload -o"
alias serve="php artisan serve"

Jesús Amieiro

alias pa='php artisan'
alias par:l='php artisan route:list'
alias pam='php artisan migrate'
alias pam:r='php artisan migrate:refresh'
alias pam:rs='php artisan migrate:refresh --seed'
alias cu='composer update'
alias ci='composer install'
alias cda='composer dump-autoload -o'
alias vu='cd ~/Homestead && vagrant up'
alias vs='vagrant suspend'
alias vssh='vagrant ssh'


alias artisan = "php artisan"
alias db-reset="php artisan migrate:reset && php artisan migrate --seed"


alias a="php artisan"


alias _='sudo'
alias art='php artisan'
alias tinker='php artisan tinker'
alias ll="ls -lh"
alias la='ls -lAh'
alias c='composer'
alias iphp='psysh' # repl
alias g='git'
alias gs='git status'
alias d='docker'
alias dc='docker-compose'
alias dm='docker-machine'
alias k='kubectl'
alias publicip='dig +short'
alias chrome="/Applications/Google\\ Chrome"
# Show file and folder permissions as octal
# Usage: `octal file.txt` or `octal my/path`
alias octal="stat -f '%A %a %N'"
# Mac conveniences for Linux
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
if type "xdg-open" &> /dev/null; then
alias open="xdg-open"

TJ Miller

nah: aliased to git reset --hard && git clean -fd
aa: aliased to php artisan


# Hub (extend git commands)
alias git=hub
# Directories
alias ll='ls -FGlAhp'
alias ..="cd ../"
alias ...="cd ../../"
alias ....="cd ../../../"
alias .....="cd ../../../../"
alias df="df -h"
alias diskusage="df"
alias fu="du -ch"
alias folderusage="fu"
alias tfu="du -sh"
alias totalfolderusage="tfu"
alias finder='open -a 'Finder' .'
# Vagrant
alias vagrantgo="vagrant up && vagrant ssh"
alias vgo="vagrantgo"
alias vhalt="vagrant halt"
alias vreload="vagrant reload && vgo"
alias c='composer'
alias cr='composer require'
alias cda='composer dumpautoload'
alias co='composer outdated --direct'
alias update-global-composer='cd ~/.composer && composer update'
alias composer-update-global='update-global-composer'
alias a='php artisan'
alias pa='php artisan'
alias phpa='php artisan'
alias art='php artisan'
alias arti='php artisan'
alias test='vendor/bin/phpunit'
alias y='yarn'
alias yr='yarn run'
# Homestead
alias edithomestead='open -a "Visual Studio Code" ~/Homestead/Homestead.yaml'
alias homesteadedit='edithomestead'
alias dev-homestead='cd ~/Homestead && vgo'
alias homestead-update='cd ~/Homestead && vagrant box update && git pull origin master'
alias update-homestead='homestead-update'
# Various
alias editaliases='open -a "Visual Studio Code" ~/.bash_aliases'
alias showpublickey='cat ~/.ssh/'
alias ip="curl"
alias localip="ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v ''"
alias copy='rsync -avv --stats --human-readable --itemize-changes --progress --partial'
# Functions
mkcdir ()
mkdir -p -- "$1" &&
cd -P -- "$1"
function homestead() {
( cd ~/Homestead && vagrant $* )

Alexander Melihov

alias ars="php artisan serve"
alias art="php artisan tinker"


alias l="php artisan"


alias unit='php vendor/phpunit/phpunit/phpunit'
alias unitreport='php -d xdebug.profiler_enable=On vendor/phpunit/phpunit/phpunit --coverage-html=./public/report'
alias laravel-installer='composer create-project --prefer-dist laravel/laravel'


alias artisan="php artisan"
alias cclear='php artisan cache:clear'
# now with 5.5
alias fresh="artisan migrate:fresh --seed"


alias pf="phpunit --filter"
alias artisan="php artisan"
alias tinker="php artisan tinker"


alias mfs="php artisan migrate:fresh --seed'
Eric L. Barnes photo

Eric is the creator of Laravel News and has been covering Laravel since 2012.


Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Manage your Laravel app as if it was a CMS – edit any text on any page or in any email without touching Blade or language files.

Visit Paragraph
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo


The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo


Providing innovation and stability to ensure your web application succeeds.

Shift logo


Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Bacancy logo


Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo


The official Laravel job board

Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with Vue and Livewire stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo


Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies


The latest

View all →
Running a Single Test, Skipping Tests, and Other Tips and Tricks image

Running a Single Test, Skipping Tests, and Other Tips and Tricks

Read article
View Third-party Relations in model:show - Now Available in Laravel 11.11 image

View Third-party Relations in model:show - Now Available in Laravel 11.11

Read article
Asserting a JSON Response Structure in Laravel image

Asserting a JSON Response Structure in Laravel

Read article
Backpack turns 8 years old, celebrates with 40% discount image

Backpack turns 8 years old, celebrates with 40% discount

Read article
Create a DateTime from a Timestamp With this New Method Coming to PHP 8.4 image

Create a DateTime from a Timestamp With this New Method Coming to PHP 8.4

Read article
Neovim Plugin to for Navigating Laravel and Livewire Components image

Neovim Plugin to for Navigating Laravel and Livewire Components

Read article