What is /etc/aliases?
/etc/aliases is a text file used to store email aliases on a Linux system. Email aliases are basically nicknames for email addresses. They allow you to send emails to a group of people using a single address, or to redirect emails from one address to another.
/etc/aliases are typically used to store aliases for the system’s mail server. However, it can also be used to store aliases for any other purpose.
For example, you could use /etc/aliases to create an alias for your own email address. This file is stored in the /etc directory, which is the standard location for system-wide configuration files. /etc/aliases are usually managed by the system administrator. However, you can also edit /etc/aliases yourself if you need to add or change an alias.
Adding entry to /etc/aliases
To add a new alias to /etc/aliases, simply open the file in a text editor and add a new line with the following format:
alias_name: [email protected]
Replace the alias_name with the desired alias, and [email protected] with the actual email address you wish to forward messages to. You can also forward one user’s email to another user.
Once you have saved your changes, run the newaliases command to update the aliases database.
newaliases
Your new alias will now be active and forward messages as expected.
Hope this tutorial helps you to understand the uses of /etc/aliases file.