To create an alias of a Linux command, you can follow these steps:
- Open your terminal.
- Type nano ~/.bashrc command to open the .bashrc file in the nano text editor. This file is executed every time you open a new terminal window.
- Scroll to the bottom of the file and add the following line: alias
- Save the changes using Ctrl + X, then Y, and finally press Enter to confirm the changes.
- In order to make the changes take effect, either close the terminal and open a new one, or run the command source ~/.bashrc to reload the .bashrc file in the current terminal.
Now you can use your created alias. In our example, you can simply use
ll instead of
ls -l to list files and directories in long format.