You can create a script in /etc/profile.d/ to make aliases for all users:
Create a file called
00-aliases.sh(or any other fancy name) in/etc/profile.d:gksu gedit /etc/profile.d/00-aliases.shPut you aliases in this file. Example:
alias foo='bar --baz' alias baz='foo --bar'Save the file
Restart any open terminals to apply the changes.
How To Create Permanent Aliases In Linux?
Do you want to use your aliases even after closing the terminal and rebooting to system? If yes, you need to create a permanent alias.
To do that, you need to put your alias in the ~/.bashrc file by either opening it in a editor or by running commands:
$ echo "alias up='sudo apt update && sudo apt upgrade'" >> ~/.bashrc
$ source ~/.bashrc
If you’re using shell other than bash, you might need to put aliases in the respective shell config file such as ~/.zshrc for ZSH and ~/.config/fish/config.fish for Fish shell.
Store Aliases In A Separate File
If you use large number of aliases, it’s always better to have a separate file for it. You can create bash_aliases dot file in your home directory and put all aliases here.
$ touch ~/.bash_aliases
# add aliases to the above file