Advertisement

In development, We spend a lot of time on the command line. We type a lot of commands on regularly.

I have created a shortcut for the most of the commands which I use on a daily basis some of them are below:

WP CLI

Command Keyboard Shortcut/Aliases
wp theme list wpthl
wp plugin list wppll

Check all the available WP CLI commands etc. (all WP CLI commands list)

Example 1. Using shortcut wpthl instead of wp theme list


Yum@M MINGW64 /c/xampp/htdocs/dev.test
$ wpthl
+————————+———-+———–+———-+
| name | status | update | version |
+————————+———-+———–+———-+
| twentyeleven | inactive | none | 2.8 |
| twentyfifteen | inactive | none | 2.0 |
| twentyfourteen | inactive | none | 2.2 |
| twentyseventeen | inactive | available | 1.6 |
| twentysixteen | inactive | none | 1.5 |
| twentyten | inactive | none | 2.5 |
| twentythirteen | inactive | none | 2.4 |
| twentytwelve | inactive | none | 2.5 |

Example 2. Using shortcut wppll instead of wp plugin list


Yum@M MINGW64 /c/xampp/htdocs/dev.test
$ wppll
+——————————————+———-+———–+————+
| name | status | update | version |
+——————————————+———-+———–+————+
| akismet | inactive | none | 4.0.8 |
| contact-form-7 | inactive | available | 5.0.3 |
| easy-digital-downloads | inactive | none | 2.9.6 |
| elementor | inactive | available | 2.1.5 |
| free-images | inactive | none | 1.0.0 |
| gutenberg | inactive | available | 3.3.0 |
| site-reset | inactive | none | 1.0.1 |
| sync-post | inactive | none | 0.1.0 |
| theme-trac-reviewer | inactive | none | 1.0.0 |
| wordpress-importer | inactive | none | 0.6.4 |
+——————————————+———-+———–+————+

view raw

command.txt

hosted with ❤ by GitHub

Some more commands with keyboard shortcuts/aliases are below:

Grunt

Command Keyboard Shortcut/Aliases
grunt release grr
grunt minify grm

PHPCS

Command Keyboard Shortcut/Aliases
phpcs pb
phpcbf pbf

Git

Command Keyboard Shortcut/Aliases
git add . gaa
git commit –message gcm
git checkout gco
git pull origin gpu
git push origin gpp
git status gs

To create keyboard shortcuts using aliases is very simple. We can create any command shortcut/aliases.

Follow below simple steps:

  1. Open the file .bashrc which is found in location  C:\Users\USERNAME\.bashrc and
  2. Add below sample commands of Git & Grunt.


# ———————-
# WP CLI
# ———————-
alias wpthl='wp theme list'
alias wppll='wp plugin list'
# ———————-
# Git Command Aliases
# ———————-
alias ga='git add'
alias gaa='git add .'
alias gaaa='git add –all'
alias gau='git add –update'
alias gb='git branch'
alias gbd='git branch –delete '
alias gc='git commit'
alias gcm='git commit –message'
alias gcf='git commit –fixup'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcom='git checkout master'
alias gcos='git checkout staging'
alias gcod='git checkout develop'
alias gd="git diff — . ':!*.min.js' ':!*.min.css' ':!*.min-rtl.css'"
alias gda='git diff HEAD'
alias gi='git init'
alias glg='git log –graph –oneline –decorate –all'
alias gld='git log –pretty=format:"%h %ad %s" –date=short –all'
alias gm='git merge –no-ff'
alias gma='git merge –abort'
alias gmc='git merge –continue'
alias gpu='git pull origin'
alias gpr='git pull –rebase'
alias gpp='git push origin'
alias gr='git rebase'
alias gs='git status'
alias gss='git status –short'
alias gst='git stash'
alias gsta='git stash apply'
alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop'
alias gsts='git stash save'
# ———————-
# Grunt Aliases
# ———————-
alias grr='grunt release'
alias grm='grunt minify'
# ———————-
# PHPCS
# ———————-
alias pb='phpcs'
alias pbf='phpcbf'

view raw

.bashrc

hosted with ❤ by GitHub

I found the article Terminal/Bash Command-Line Shortcuts with Aliases written by @jonsuh to create keyboard shortcuts for the Terminal/Git Bash.

I have added some more commands of Grunt, WP CLI & PHPCS on my local environment.

Leave a Reply