How To Save Alias Permanently In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Create the desired alias in your current shell session:
alias myalias=”echo ‘Hello World!'”
2. Add the alias to your bash profile by entering the following command into your shell:
echo “alias myalias=’echo ‘Hello World!”“ >> ~/.bashrc
3. Reload the .bashrc file to apply the changes: source ~/.bashrc
4. Verify that your alias is working by typing myalias into the shell and pressing enter.
To save an alias permanently in Linux, you will need to add the alias command to your bashrc or bash_aliases file. The bashrc file is a script that is executed each time you open a terminal window. To add an alias to the bashrc file, open the file in a text editor and add the alias command at the end. You can also create a separate file called bash_aliases and add the alias command to it. Once you have saved the changes, close the terminal window and open a new one for the aliases to take effect.