The command aliases Bash are very useful for condensing in a single command other complex parameter commands or sequences, which you do repeatedly on a daily basis on your Linux Debian, Mint, Ubuntu, or any other distro terminal.

However, each time the terminal is closed, nicknames are lost as they are created at the terminal session only.

To avoid this, in this article I teach you how to register them permanently, so that they are loaded with each new initiation of your user session on Linux.

The command aliases presented in the article were tested in the distributions Linux Ubuntu, Mint and Debian.

Creating alias at Linux Terminal

First we will see how to create the nicknames through the command alias.

alias syntax

alias <alias-name>="commands"

Example

Frequently I use these four command nicknames in my daily work when developing my projects with Laravel framework:

  1. Shortcut for composer.phar in my standard home folder
  2. Shortcut for composer dump-autoad
  3. Shortcut for the command php artisan
  4. Shortcut to list the routes Php Artisan Route: List
alias composer="~/.composer/composer.phar"
alias comp-dump="composer dump-autoload"
alias artisan="php artisan"
alias art-route-list="php artisan route:list"

But as I said earlier, if I just enter these alias on my terminal command line console, I will have to repeat your creation by opening the next terminal session.

Permanent aliases

For these command aliases to be permanent for all terminal sessions we open, just create them as entries into your ~/.bashrc file.

This file is loaded every time the user opens the Bash console from its terminal.

The following example uses the terminal to open the nano command line editor, indicates the example lines that must be added, and then presents the source command that loads the .bashrc file to the session that is open.

nano ~/.bashrc

/* Enter the aliases at the end of the file .bashrc */
alias composer="~/.composer/composer.phar"
alias comp-dump="composer dump-autoload"
alias artisan="php artisan"
alias art-route-list="php artisan route:list"

/* Close the file saving it, Ctrl+X */

/* Run the Source command line for the .BASH to have an effect */
source ~/.bashrc

From this moment whenever you open your terminal, nicknames for commands will be available, now just use this tip to create new aliases that help you increase productivity.