Table of Contents

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.


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