Basic commands for handling mailx

Mailx is the command-line Mail User Agent installed by default on a Debian Squeeze machine. It comes with the bsd-mailx package.
If not installed :

root@localhost:~# apt-get install bsd-mailx

A symlink is then created between the commands mail and mailx :

root@localhost:~#ls -l $(which mail)
lrwxrwxrwx 1 root root 23 Sep 13  2008 /usr/bin/mail -> /etc/alternatives/mail
root@localhost:~#ls -l /etc/alternatives/mail
lrwxrwxrwx 1 root root 18 Sep 13  2008 /etc/alternatives/mail -> /usr/bin/bsd-mailx

The command mail may be very handy when you can quickly read the mails issued by applications such apt-listchanges or rkhunter.
Here are some shortcuts/tips to use mailx more efficiently :

->All the available commands : ? or list
->Reading the previous mail : –
->Reading the next mail : n or + / CR (type enter)
->Executing a system command : !ls (for instance)
->Changing the current working repository : chdir new_rep
->Editing the N email with your default editor : e N
->Getting the header of the current email : top
->Getting the headers of all the emails : (to continue reading : z ; to go back to the previous page : z-)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s