#Create #Linux #command
The feature of creating your own Linux command is used to create codenames for the most frequently used commands. Thus, it is possible to facilitate the execution of multiple tasks.
1. Creating the bash script
Initially, you need to create your Bash script, which will be executed at the time of your command.
#afixa-se o nome da pasta atual
echo "A pasta atual é 'pwd'"
#depois a lista dos arquivos
echo "Os arquivos contidos nesta pasta são 'ls'"
Then, register this file (CTRL + O with Nano) and give it the name of your command (for example, infopasta)
2. Make the command executable
If you try to enter the name of your Bash script, you should realize that it cannot be executed yet.
Start by modifying the CHMOD of the script so that you can run it as you type
chmod +x votreScript
Now, copy your script into your directory / usr / bin in this way:
cp votreScript /usr/bin/
Ready! Now, to launch your command, type in the console the name of the script you moved to the / usr / bin.
Photo: © Arian Darvishi – Unsplash