How to create Aliases in Ubuntu? If you have a command that you run all the time in Ubuntu like pwd to print your working directory, you can create an alias for that specific command. In otherwords a shorter version for the pwd command.
- Open a Terminal Window (CLI = Command Line Interface)
- Type the command cd to take you to your home directory.
- Now you need to edit the .bashrc file.
- To edit the .bashrc file, type in the following command:
- This will open the .bashrc file in GEdit for editing.
- Now we want to assign a alias for the pwd command. We want to name the alias“p“
- Add the following line at the bottom of the .bashrc file: alias p=’pwd’
- Close GEdit.
- Log out and log in again to make the alias active.
- Type in p in the command line and it should give the same results as pwd.