Answer
The list
command you are looking for is not a shell command, but a command internal to the mail
program. So you need to first run the mail
command in your shell in order to run the mail
program, and then you can use its list
command:
firas@wakaba ~ % mail
Mail version 8.1.2 01/15/2001. Type ? for help.
"/var/mail/firas": 1 message 1 unread
>U 1 firas@wakaba Mon Nov 28 09:41 15/396 Test
& list
Commands are:
next, alias, print, type, Type, Print, visual, top, touch, preserve,
delete, dp, dt, undelete, unset, mail, mbox, pipe, |, more, page, More,
Page, unread, Unread, !, copy, chdir, cd, save, source, set, shell,
version, group, write, from, file, folder, folders, ?, z, headers,
help, =, Reply, Respond, reply, respond, edit, echo, quit, list, xit,
exit, size, hold, if, else, endif, alternates, ignore, discard, retain,
saveignore, savediscard, saveretain, #, inc, new
& quit
Held 1 message in /var/mail/firas
If mail
just answers “no mail”, you can send yourself a mail first:
firas@wakaba ~ % mail
No mail for firas
firas@wakaba ~ % echo "Test." | mail -s Test firas
firas@wakaba ~ % mail
Mail version 8.1.2 01/15/2001. Type ? for help.
"/var/mail/firas": 1 message 1 new
>N 1 firas@wakaba Mon Nov 28 09:42 14/386 Test
& list
Commands are:
next, alias, print, type, Type, Print, visual, top, touch, preserve,
delete, dp, dt, undelete, unset, mail, mbox, pipe, |, more, page, More,
Page, unread, Unread, !, copy, chdir, cd, save, source, set, shell,
version, group, write, from, file, folder, folders, ?, z, headers,
help, =, Reply, Respond, reply, respond, edit, echo, quit, list, xit,
exit, size, hold, if, else, endif, alternates, ignore, discard, retain,
saveignore, savediscard, saveretain, #, inc, new
& quit
Held 1 message in /var/mail/firas
Attribution
Source : Link , Question Author : Community , Answer Author : fkraiem