As a developer, you probably spend a decent amount of time using the terminal.
It is worth spending some time to create a development environment that will allow us to be productive and efficient.
A simple trick that can significantly affect your productivity is to create shortcuts to commands in your terminal.
These shortcuts will allow you to run commands quickly without having to remember their specific syntax. This way you can concentrate more on the important part of your work.
I use the Git Bash terminal in a Windows environment.
Creating Git Bash aliases
C:\Users\<username>folder in Windows) in your text editor (like Visual Studio Code). If you can’t find this file there, make sure the “File name extensions” and “Hidden items” options are enabled. If you still can’t find this file, create it.
- Add new shortcuts in the following format:Replace
shortcut_namewith the name that you will actually type in the terminal. Replace
full_commandwith the command that should run when using this shortcut.
- Save the file.
- Close and reopen the terminal for the changes to take effect.
From now on, you will only have to remember the
shortcut_name instead of the
full_command. Each time you type the
shortcut_name in the terminal, the
full_command will run.
Some shortcuts ideas
Some of the shortcuts I use a lot are navigation (
Instead of typing the full path of the project folder, I create an alias:
alias cdsitename='cd ~/sites/sitename'
And now I only need to type
cdsitename in my terminal to navigate to this folder, instead of the full command:
Another type of shortcuts I sometimes use is for Git commands, such as:
alias gs='git status' alias gc='git checkout' alias gl='git log'
Another useful shortcut I created is:
alias hugos='hugo server -D'
This allows me to start my local Hugo server in order to view the site.
These are just a few ideas of what can be achieved with this simple trick of creating aliases. Feel free to create shortcuts that are relevant to your workflows.