Sometimes you need to use a long command over and over again, and type it every time is a big pain.
You can save a lots of time by using the “alias” command.
1 2 3 4 5 | alias short_name="custom command" |
For instance, if you need to switch between directories, you can add each to the alias and run the shortcode.
1 2 3 4 5 6 | alias p1="cd /path/to/first/directory" alias p2="cd /path/to/second/directory" |
From now, you can type p1 to go to first directory and p2 to go to second directory.
you can also check the defined alias in the system by typing this
1 2 3 4 5 | alias |
Please note: alias created are session based and temporarily and will be deleted after you close the terminal.
To save them and use the shortcode in future, you need to add them into Bash file or one of the following paths:
- Bash – ~/.bashrc
- ZSH – ~/.zshrc
- Fish – ~/.config/fish/config.fish
Open the .bashrc file and add the alias at the end of it.
Access the windows file via ubuntu
To access the windows file, you need to go to “mnt” folder
1 2 3 4 5 | cd /mnt/c |