User Tools

Site Tools


bash:aliases:local_vs_global_aliases

BASH - Aliases - Local vs Global Aliases

Aliases can be global, i.e. apply by default to every user on the system.

However each user can also have their own aliases which only apply to them, i.e. local aliases.


Global Aliases

Global aliases are specified in a file within the /etc/profile.d/ directory. The name of the file is irrelevant.

We use /etc/profile.d/bash_aliases.sh.

NOTE: The permissions of the file should have read permissions.

For example 644.


Local Aliases

Local aliases are specific to the user.

These aliases should be defined in a file named .bash_aliases within a users home directory.

  • ~/.bash_aliases
  • ~/.bashrc
  • ~/.bash_profile

Enable the aliases

To apply the changes immediately to your bash profile without having to log out:

source ~/.bashrc

or

~/.bash_aliases

or

. ~/.bashrc

or

. ~/.bash_profile
bash/aliases/local_vs_global_aliases.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki