alias commands in Linux

In Linux, an alias is a command that executes another command or series of commands using a different name. Aliases are typically used to make it easier to run frequently used or complex commands by typing a shorter, easier-to-remember version. The alias command takes the following structure:
alias [alias-name]='[command]'
alias: Invokes thealiascommand.alias-name: An alias is a user-defined string that acts as a reference to a command, with the exception of certain special characters and the words 'alias' and 'unalias'.command: Specifies the command the alias references.
For example:
alias ll='ls -al': This alias creates a new command calledllthat is equivalent to running thels -alcommand. You could use this alias to list the contents of a directory in long format by typingllinstead ofls -al.alias df='df -h': This alias creates a new command calleddfthat is equivalent to running thedf -hcommand. The-hflag is used to display the sizes of files in "human-readable" format (e.g., in MB or GB instead of bytes).alias grep='grep --color=auto': This alias creates a new command calledgrepthat is equivalent to running thegrep --color=autocommand. The--color=autoflag tellsgrepto highlight the matching text in the output, making it easier to spot.alias shutdown='sudo shutdown -h now': This alias creates a new command calledshutdownthat is equivalent to running thesudo shutdown -h nowcommand. The-hflag tells theshutdowncommand to halt the system, and thenowargument tells it to do so immediately.alias update='sudo apt update && sudo apt upgrade -y': This alias creates a new command calledupdatethat is equivalent to running thesudo apt updateandsudo apt upgrade -ycommands. Theupdatecommand updates the package manager's list of available packages, and theupgradecommand installs any available updates for installed packages. The-yflag tellsaptto assume "yes" as the answer to all prompts.
A few ways I use the alias command in my day to day development:
Copying trading bots from wine to my documents.
I currently work on Linux but need to do MQL5 programming from time to time. With MQL5, I can write trading bots for clients. However, to compile the MQL5 code to an .ex5 executable, I need to have MT5 installed. MT5 is a Windows and Mac program; therefore, I have to install wine on Linux. Wine is a compatibility layer that allows you to run Windows applications on Linux. It does this by translating the Windows application's calls into calls that the Linux operating system can understand and processing them on behalf of the application. This allows you to run Windows applications on Linux without installing a copy of the Windows operating system. Once the code is compiled into an executable, the files are stored in the wine drive. To copy the .ex5 to a specific folder, I would normally run the following command
cd /home/wamaitha/.wine/drive_c/Program\ Files/Deriv/MQL5
The MQL5 directory has a folder that holds all the trading bots I program. Therefore, I can copy all the .ex5 files to the EAS folder with the command below.
cp -r Experts/**/*.ex5 ~/Documents/FOREX/EAS
To make my work easier, I've written an alias command that does all this
alias fxeas="cd /home/wamaitha/.wine/drive_c/Program\ Files/Deriv/MQL5 && cp -r Experts/**/*.ex5 ~/Documents/FOREX/EAS"
Activating virtual environments
In Python when using virtualenv , to activate the environment on Linux we need to type the following command:
source venv/bin/activate
Then navigate back to the project folder
cd .. && cd ..
We can write an alias for this
alias activate="source venv/bin/activate && cd .. && cd .."
Permanent aliases
Using the alias command only applies to the current terminal session. To make the commands useful on other terminal sessions, you would need to edit the .bashrc file if running bash or the .zshrc if on zsh. I'm currently on zsh , therefore I add these commands at the end of the .zshrc file.
Launch the .zshrc using the command below
nano ~/.zshrc
Add the alias commands at the end of the file
alias activate="source venv/bin/activate && cd .. && cd .."
alias fxeas="cd /home/wamaitha/.wine/drive_c/Program\ Files/Deriv/MQL5 && cp -r Experts/**/*.ex5 ~/Documents/FOREX/EAS"
Run the command below to activate the changes for all terminal sessions.
source ~/.zshrc



