The
mailx
program has a large set of commands, some of which are described in
Appendix D
and
Appendix E.
The commands in
Table F-1
can help you to use the
mailx
environment more effectively. The
mailx(1)
reference page lists some other commands that are useful only
under special circumstances.
| Command | Description |
=
|
Echoes the number of the current message. |
#
|
Allows the user to write comments in mail script files. |
!
|
Executes the shell command you enter. |
|
Selects and displays the previous message or the nth previous
message. For example,
-4
backs up four messages.
|
alias
|
With no arguments, lists the current aliases. With one argument,
displays only that alias. With two or more arguments, creates an alias
with the first argument as its name and all subsequent arguments as the
members of the alias. The
group
command is an alternate for
alias.
|
alternates
[
|
Informs mailx that the addresses listed in
alternate_list
refer to the user. If no
alternate_list
is specified in the command, the command displays the
current list of alternates.
|
chdir
|
Changes your current directory to the pathname specified, as if you
had executed the
cd
shell command except that the directory you specify with
chdir
prevails only while you are in the mail environment.
|
copy
[
|
Copies the current message or the specified messages into a file. If
file
exists, the messages are appended. This command works like
save
except that it does not mark copied messages for deletion when you quit
from
mailx.
|
Copy
[
|
Saves the specified messages in a file whose name is
derived from the author of the first message in the
message_list.
This command will not mark the messages as being
saved. Otherwise equivalent to the
Save
command.
|
delete
[
|
Deletes the current message or the specified messages. You can use the
undelete
command to recover messages you have accidentally deleted.
|
discard
[
|
Identical to the
ignore
subcommand.
|
dp
|
Deletes the current message and prints the next active message. |
echo
|
Echo the given string. Similar to the shell
echo
command.
|
edit
[
|
Invokes the editor specified by
EDITOR
and loads
message_list
into the editor. When you exit, any changes
made are saved back into
message_list.
|
exit
|
Exits mail without updating your system mailbox. |
file
[
|
Selects a mail file or folder. If you do not specify a file, this command prints your current path and file name and the number of messages in your current file. If you specify a file or folder, this command displays any changes you have made to your current file and switches to the specified file for reading. |
folders
|
Lists the names of the folders in your folder directory. |
followup
|
Responds to a message and record the response in a file
whose name is derived from the author of the message.
This command overrides the
record
option if set.
|
Followup
[
|
Responds to the first message in
message_list
and sends the message to the author of each message in
message_list.
The subject line is taken from the first
message and the response is recorded in a file whose
name is derived from the author of the first message.
|
from
[
|
Prints the active message header. If you specify a login name, this command prints all the active messages from the specified name. |
headers
[
|
Lists active message headers, using the value of the
screen
variable as the number of headers to display. See Appendix D
for a description of the
screen
variable. If you have more than one screenful of messages, you can move
forward or backward one screenful with the
z
command. If you specify a message number, the
headers
command displays the screenful that includes the specified message.
|
help
|
Displays help information. |
hold
[
|
Holds, or preserves, the current message or the specified specified
messages in your system mailbox instead of moving them to your
mbox
file.
|
if condition
|
Construction for conditional execution of
mailx
subcommands. Subcommands following
if
are executed if
condition
is True. Subcommands following
else
are
executed if
condition
is not True. An
else
is not
required but the
endif
is required. The condition can be
send
for sending mail, or
receive
for receiving mail.
|
ignore
[
|
Sets
mailx
to display messages without the specified fields of the header when you
use the
print
or
type
command. Note that this command is different from the
ignore
variable described in Appendix D. If you enter the
ignore
command with no arguments, the current list of ignored
fields is displayed.
|
list
|
Displays a list of valid mailx subcommands. |
local
|
List other names for the local host. |
mail
|
Sends a message to the specified user. |
mbox
[
|
Marks the current message or the specified messages to be moved to your
mbox
file. This is helpful if you have set the
hold
variable in your
.mailrc
file.
|
more
[
|
Displays the messages in
message_list
using the defined
pager program in
PAGER.
Identical to the
page
subcommand.
|
More
[
|
Similar to the
more
subcommand, but also displays the ignored header fields.
See
more
and
ignore
subcommands.
|
new
[
|
Marks each message in the
message_list
as not having been read.
Identical to
New,
unread,
and
Unread
subcommands.
|
New
[
|
Marks each message in the
message_list
as not having been read. Identical to
new,
unread,
and
Unread
subcommands.
|
page
[
|
Displays the messages in
message_list
using the defined
pager program in
PAGER.
Identical to the
more
subcommand.
|
Page
[
|
Similar to
page
but also displays the ignored header fields.
Identical to the
More
subcommand.
|
Command
|
Description |
pipe
[
|
Pipes the
message_list
through the
shell_command.
The message is treated as being
read. If no arguments are given, the current
message is piped through the command given in
cmd.
If the
page
option is set, a formfeed is inserted after
each message.
|
next
|
Displays the next message. |
Print
[
|
Displays the current message or the specified message, including any
header fields specified by the
ignore
command.
|
print
[
|
Displays the current message or the specified message without any
header fields specified by the
ignore
command.
|
quit
|
Leaves the
mailx
program and updates your system mailbox. If you do not have the
hold
variable set, all messages that you have not deleted, saved, or preserved
are moved to your
mbox
file. If you do have
hold
set, all these messages will be left in your system mailbox and marked
as having been read.
|
Reply
|
Replies to a message. If the original message
was addressed to a group of people, replies sent with the
Reply
command are sent only to the originator of the message.
|
reply
|
Replies to a message. If the original message was addressed to a group
of people, replies sent with the
reply
and
respond
commands are sent to everyone who received the original message.
|
retain
[
|
Adds the header fields in
field_list
to the list of headers to be retained when displaying message with the
print
or
type
subcommands. Use
type
and
print
to view
messages in their entirety, including fields that are
not retained. If
retain
is executed with no arguments,
it lists the current set of retained fields.
|
save
[
|
Saves the current message or the specified messages in the file. Note that the messages are added to the specified file so that you will not delete the contents of the file. |
Save
[
|
Saves the specified messages in a file whose name is derived from the author of the first messages. The name of the file is assumed to be the author's name with all network addressing stripped off. |
set
[
|
If entered with no variables, the
set
command displays all the options you have set. If you
specify a variable, the option will be set.
(Appendix E lists the available variables.)
|
shell
|
Invokes the shell interactively. |
source
|
Reads mail commands from a file (usually
.mailrc).
|
size
[
|
Displays the size in lines and characters of the
messages in
message_list.
|
top
[
|
Displays the first five lines in the current message or each of the specified messages. |
touch
[
|
Marks the messages in
message_list
to be moved from your system mailbox to your personal mbox when
you quit the
mailx
program even though you have not read the
listed messages. The messages appear in your mbox as
unread messages. When you use touch, the last message in
message_list
becomes the current message.
|
unalias
|
Deletes the specified alias names. |
undelete
|
Undeletes the specified messages. |
unread
[
|
Marks each message in
message_list
as not having been read. Identical to the
new,
New,
and
Unread
subcommands.
|
Unread
[
|
Marks each message in
message_list
as not having been
read. Identical to the
new,
New,
and
unread
subcommands.
|
unset
|
Unsets (turns off) options. For example, if your
.mailrc
file includes a
set hold
command, you can use the
unset
command to disable the
hold
variable for the current
mailx
session.
|
version
|
Displays the version banner for the
mailx
command.
|
visual
|
Invokes the editor specified by the
VISUAL
mail variable to edit the current message.
|
write
[
|
Saves the current message or the specified messages in the named file.
This is similar to the
save
command, except that
write
saves only the body of each message; the headers are deleted.
|
z[+]
|
Moves forward or backward one screenful of messages. You can specify
the number of messages in a screenful with the
screen
variable. (See Appendix D.)
To move forward one full screen, enter
z
or
z+;
to move backward, enter
z-.
|