Linux newalias command

Updated: 05/04/2019 by Computer Hope
newalias command

On Unix-like operating systems, the newalias command is used to install new aliases for the elm mail reader program.


newalias creates new hash and data files from a text file. If the program is invoked with the -g (global) flag, the program updates the system alias files. Otherwise, the program looks for a file called $HOME/.elm/aliases.text and, upon finding it, creates files $HOME/.elm/aliases.dir, $HOME/.elm/aliases.pag and $HOME/.elm/aliases for the elm program.

The format that the program expects is:

alias, alias, .. = comment = address 


alias, alias, .. = comment = alias, alias, ... 

The first form is for an individual user such as:

dave, taylor = Dave Taylor = veeger!hpcnou!dat 

or optionally as:

dave, taylor = Taylor; Dave = veeger!hpcnou!dat 

to allow the aliases to be properly sorted by last name. The second is for defining a group alias such as:

gurus = Unix Gurus = alan, john, dave, mike, I richard, larry, t_richardson 

Note that lines can be continued at will, blank lines are accepted without error, and that any line starting with '#' is considered a comment and is not processed.

If the 'comment', or 'address' fields need to contain '=' characters, those characters must either be escaped using a backslash character or the address must be inside doublequotes (").

Aliases are not case sensitive so dave and Dave are both the same alias.

Finally, aliases can contain other aliases, and/or groups. For example:

unix = Unix people = gurus, taylor, jonboy


newalias [-g]


$HOME/.elm/aliases.text alias source for user
$HOME/.elm/aliases.dir alias dbz directory for user
$HOME/.elm/aliases.pag alias dbz hash file for user
$HOME/.elm/aliases alias data file for user
/usr/lib/elm-me+/aliases.text alias source for system
/usr/lib/elm-me+/aliases.dir alias dbz directory for system
/usr/lib/elm-me+/aliases.pag alias data hash table for system
/usr/lib/elm-me+/aliases alias data file for system

elm — A mail client.
mail — Read, compose, and manage mail.
mailx — Process mail messages.