How to Read Mail in Ubuntu 16.04 With Command Line
Provided by: bsd-mailx_8.ane.2-0.20160123cvs-4_amd64
NAME
post, mailx, Mail — ship and receive postal service
SYNOPSIS
mail [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-r from-addr] [-due south discipline] [--] to-addr ... mail [-dEIiNnv] -f [file] mail [-dEIiNnv] [-u user]
Clarification
postal service is an intelligent mail processing system which has a command syntax reminiscent of ed(ane) with lines replaced by letters. The options are equally follows: -a Specify boosted header fields on the command line such as "X-Loop: foo@bar" etc. It can be also used to override MIME headers mail adds by default to each approachable mail, come across Character sets and MIME below. You have to use quotes if the string contains spaces. This argument may be specified more than one time, the headers will and so be concatenated. -b bcc-addr Send blind carbon copies to bcc-addr. -c cc-addr Ship carbon copies to list of users. cc-addr should be a comma separated list of names. -d Causes mail service to output all sorts of data useful for debugging mail. -Due east Don't send letters with an empty body. -f Employ an alternate mailbox. Defaults to the user's mbox if no file is specified. When quit, mail writes undeleted messages back to this file. -I Forces mail to run in interactive way, even when input is not a final. In particular, the special ~ command character, used when sending mail, is only bachelor interactively. -i Ignore tty interrupt signals. This is peculiarly useful when using postal service on noisy phone lines. -N Inhibits initial display of message headers when reading mail or editing a postal service folder. -north Inhibits reading /etc/mail.rc upon startup. -r from-addr Utilize from-addr as the from address in the bulletin and envelope. Overrides any from options in the startup files. -southward bailiwick Specify subject area on control line (only the first argument subsequently the -due south flag is used as a subject; be conscientious to quote subjects containing spaces). -u user Equivalent to: $ mail -f /var/post/user except that locking is done. -5 Verbose manner. The details of delivery are displayed on the user'southward terminal. -- End of options. Whatever further statement is treated as a direct receipient address. Annotation: For security reasons the -- separator is strongly recommended for scripts that need to send mails to addresses obtained from untrusted sources (such equally web forms). Startup actions At startup time, mail will execute commands in the system control file, /etc/mail.rc, unless explicitly told non to past using the -n choice. Next, the commands in the user'southward personal control file ~/.mailrc are executed. post then examines its command line options to decide whether the user requested a new message to be sent or existing letters in a mailbox to be examined. Sending post To send a message to one or more people, mail can exist invoked with arguments which are the names of people to whom the mail will exist sent. You are then expected to type in your message, followed past a control-D ('^D') at the outset of a line. The section below, Replying to or originating mail, describes some features of mail available to help y'all compose your letter. Reading mail service In normal usage, mail is given no arguments and checks your postal service out of the mail service part, then prints out a one line header of each message found. The current message is initially set to the first message (numbered ane) and tin can be printed using the impress command (which can exist abbreviated p). Moving among the messages is much like moving between lines in ed(i); you may use + and - to shift forwards and backwards, or but enter a message number to move directly. Disposing of mail Afterward examining a bulletin you can delete (d) or reply (r) to information technology. Deletion causes the mail program to forget about the message. This is not irreversible; the bulletin tin be undeleted (u) by giving its number, or the mail session tin be aborted past giving the leave (10) command. Deleted messages, however, volition unremarkably disappear, never to be seen again. Specifying messages Commands such as print and delete tin be given a list of bulletin numbers as arguments to apply to a number of letters at once. Thus delete 1 2 deletes messages 1 and 2, while delete 1-5 deletes messages 1 through 5. Messages may also be selected using one of the following categories: * all letters $ concluding message :d deleted letters :n new messages :o old messages :r read messages :u unread messages Thus the command top, which prints the commencement few lines of a bulletin, could be used in tiptop * to print the first few lines of all messages. Replying to or originating mail You lot tin use the reply command to set up a response to a message, sending it dorsum to the person who it was from. Text you then blazon in, up to an end-of-file, defines the contents of the message. While you are composing a bulletin, post treats lines start with the tilde ('~') character particularly. For instance, typing ~m (alone on a line) will identify a re-create of the current message into the response, right shifting it by a single tab-stop (meet the indentprefix variable, beneath). Other escapes will set subject fields, add together and delete recipients to the bulletin, and allow you to escape to an editor to revise the message or to a shell to run some commands. (These options are given in the summary below.) Ending a post processing session You lot can stop a mail session with the quit (q) command. Messages which take been examined go to your mbox file unless they have been deleted, in which case they are discarded. Unexamined messages become back to the post office (see the -f option to a higher place). Personal and organisation wide distribution lists Information technology is also possible to create personal distribution lists so that, for instance, yous can ship mail to "cohorts" and have information technology go to a grouping of people. Such lists can be defined by placing a line like alias cohorts bill ozalp jkf mark kridle@ucbcory in the file .mailrc in your home directory. The current list of such aliases can be displayed with the alias control in post. System wide distribution lists can exist created past editing /etc/aliases, (meet aliases(five)); these are kept in a different syntax. In postal service you send, personal aliases volition be expanded in mail sent to others so that they will be able to respond to the recipients. System wide aliases are non expanded when the mail is sent, but any answer returned to the machine will have the system wide allonym expanded as all mail service goes through an MTA. Recipient address specifications Recipient addresses (any of the "To", "Cc" or "Bcc" header fields) are subject to expansion when the expandaddr option is gear up. An accost may be expanded as follows: · An address that starts with a piping ('|') grapheme is treated as a control to run. The control immediately following the '|' is executed with the message as its standard input. · An accost that starts with a '+' grapheme is treated as a folder. · An address that contains a '/' graphic symbol merely no '!', '%', or '@' characters is likewise treated as a folder. · If none of the to a higher place employ, the recipient is treated every bit a local or network mail accost. If the expandaddr choice is not ready (the default), no expansion is performed and the recipient is treated as a local or network mail address. Character sets and MIME More often than not mail does not handle neither different character sets nor whatsoever other MIME feature. Especially it does not perform any any conversions between character sets while displaying or sending mails. Starting from April 2017, withal, every bit a Debian extension this version of post adds a few MIME headers to every approachable mail service in order to indicate that the mail is sent as 8-flake obviously text information that uses character set up encoding detected from the electric current locale(vii) settings. The -a command-line option can be used to override those headers, for example: $ mail -a 'Content-Type: text/manifestly; charset="ISO-8859-1"' sets header indicating legacy graphic symbol encoding. Network mail (ARPA, UUCP, Berknet) See mailaddr(7) for a description of network addresses. mail has a number of options which can be set in the .mailrc file to modify its behavior; thus set askcc enables the askcc feature. (These options are summarized below.)
SUMMARY
(Adapted from the "Mail Reference Manual".) Each control is typed on a line past itself, and may take arguments following the control give-and-take. The command demand not be typed in its entirety -- the first command which matches the typed prefix is used. For commands which take message lists as arguments, if no bulletin list is given, then the adjacent message forward which satisfies the command'southward requirements is used. If there are no messages forrard of the current bulletin, the search gain backwards, and if there are no practiced messages at all, post types "No applicable messages" and aborts the command. - Impress out the preceding message. If given a numeric argument n, goes to the nth previous message and prints it. = Prints the currently selected message number. ? Prints a brief summary of commands. ! Executes the shell (see sh(1) and csh(1)) command which follows. alias (a) With no arguments, prints out all currently divers aliases. With one argument, prints out that alias. With more than one statement, creates a new alias or changes an quondam ane. alternates (alt) The alternates control is useful if you lot have accounts on several machines. Information technology can be used to inform mail that the listed addresses are really you. When y'all respond to messages, mail service will not send a copy of the message to whatsoever of the addresses listed on the alternates list. If the alternates command is given with no argument, the electric current set of alternate names is displayed. chdir (cd or ch) Changes the user'south working directory to that specified, if given. If no directory is given, and so changes to the user's login directory. copy (c) The copy control does the aforementioned thing that save does, except that it does not mark the messages it is used on for deletion when you quit. delete (d) Takes a listing of messages as argument and marks them all equally deleted. Deleted messages will not be saved in mbox, nor will they be available for well-nigh other commands. dp (also dt) Deletes the electric current bulletin and prints the side by side message. If there is no next message, mail says "No more than letters." edit (due east) Takes a list of messages and points the text editor at each one in plough. On render from the editor, the message is read back in. exit (ex or x) Effects an immediate render to the shell without modifying the user's organisation mailbox, his mbox file, or his edit file in -f. file (fi) The aforementioned as folder. binder (fo) The folder control switches to a new mail file or binder. With no arguments, it tells you which file y'all are currently reading. If y'all requite it an argument, it volition write out changes (such as deletions) yous have made in the electric current file and read in the new file. Some special conventions are recognized for the name. # means the previous file, % means your system mailbox, %user means user's organization mailbox, & means your mbox file, and +folder means a file in your folder directory. folders List the names of the folders in your folder directory. from (f) Takes a list of letters and prints their bulletin headers. headers (h) Lists the current windowful of headers. To view the next or previous grouping of headers, see the z command. help A synonym for ?. hold (ho, also preserve) Takes a message list and marks each message therein to be saved in the user's organization mailbox instead of in mbox. Does not override the delete control. ignore Add together the listing of header fields named to the ignored listing. Header fields in the ignore list are non printed on your terminal when yous impress a bulletin. This command is very handy for suppression of certain motorcar-generated header fields. The Type and Print commands tin be used to print a bulletin in its entirety, including ignored fields. If ignore is executed with no arguments, it lists the electric current set of ignored fields. inc Contain any new messages that have arrived while mail is being read. The new letters are added to the end of the message list, and the current message is reset to be the first new mail message. This does non renumber the existing message list, nor does it crusade any changes made so far to exist saved. listing (fifty) List the valid mail commands. post (m) Takes equally argument login names and distribution grouping names and sends mail to those people. mbox Betoken that a listing of messages be sent to mbox in your home directory when you quit. This is the default activity for messages if you exercise not have the concord option fix. more (mo) Takes a message list and invokes the pager on that list. side by side (n) (like + or CR) Goes to the next message in sequence and types it. With an argument list, types the next matching message. preserve (pre) A synonym for concord. Print (P) Similar print only also prints out ignored header fields. See as well print, ignore, and retain. print (p) Takes a message listing and types out each bulletin on the user's terminal. quit (q) Terminates the session, saving all undeleted, unsaved messages in the user'due south mbox file in his login directory, preserving all messages marked with agree or preserve or never referenced in his system mailbox, and removing all other letters from his system mailbox. If new mail has arrived during the session, the message "You accept new mail" is given. If given while editing a mailbox file with the -f flag, and then the edit file is rewritten. A return to the shell is effected, unless the rewrite of edit file fails, in which case the user tin escape with the exit control. Reply (R) Reply to originator. Does non respond to other recipients of the original bulletin. reply (r) Takes a message listing and sends mail to the sender and all recipients of the specified bulletin. The default message must not be deleted. reply A synonym for reply. retain Add the list of header fields named to the retained list. But the header fields in the retain list are shown on your terminal when you print a bulletin. All other header fields are suppressed. The Blazon and Print commands tin exist used to impress a bulletin in its entirety. If retain is executed with no arguments, it lists the electric current set of retained fields. salvage (s) Takes a bulletin list and a filename and appends each message in plow to the end of the file. The filename in quotes, followed past the line count and character count is echoed on the user's last. saveignore saveignore is to save what ignore is to print and type. Header fields thus marked are filtered out when saving a bulletin by save or when automatically saving to mbox. saveretain saveretain is to save what retain is to impress and blazon. Header fields thus marked are the only ones saved with a message when saving by relieve or when automatically saving to mbox. saveretain overrides saveignore. set (se) With no arguments, prints all variable values. Otherwise, sets option. Arguments are of the form pick=value (no space before or after =) or option. Quotation marks may be placed around whatsoever function of the consignment statement to quote blanks or tabs, i.e., set up indentprefix="->". shell (sh) Invokes an interactive version of the crush. size Takes a bulletin listing and prints out the size in characters of each bulletin. source The source control reads commands from a file. top Takes a message list and prints the top few lines of each. The number of lines printed is controlled by the variable toplines and defaults to 5. Type (T) Identical to the Print command. blazon (t) A synonym for print. unalias Takes a list of names divers by alias commands and discards the remembered groups of users. The group names no longer have any significance. undelete (u) Takes a message listing and marks each bulletin equally non being deleted. unread (U) Takes a message list and marks each message as non having been read. unset Takes a list of choice names and discards their remembered values; the inverse of gear up. visual (5) Takes a bulletin listing and invokes the display editor on each message. write (w) Similar to relieve, except that only the bulletin torso (without the header) is saved. Extremely useful for such tasks equally sending and receiving source program text over the message system. xit (x) A synonym for exit. z mail presents message headers in windowfuls as described under the headers command. You lot tin move postal service's attention forrard to the side by side window with the z command. Also, you tin move to the previous window by using z-. Tilde/escapes Here is a summary of the tilde escapes, which are used when composing messages to perform special functions. Tilde escapes are merely recognized at the offset of lines. The name "tilde escape" is somewhat of a misnomer since the actual escape character tin be fix by the pick escape. ~b proper noun ... Add the given names to the list of carbon copy recipients but do non brand the names visible in the Cc: line ("bullheaded" carbon copy). ~c name ... Add the given names to the listing of carbon re-create recipients. ~d Read the file expressionless.letter of the alphabet from your home directory into the bulletin. ~due east Invoke the text editor on the bulletin collected and so far. After the editing session is finished, you may continue appending text to the message. ~F letters Identical to ~f, except all message headers are included. ~f messages Read the named letters into the message being sent. If no messages are specified, read in the current message. Message headers currently being ignored (by the ignore or retain command) are not included. ~h Edit the message header fields past typing each one in turn and allowing the user to suspend text to the end or modify the field by using the current terminal erase and kill characters. ~Thou messages Identical to ~m, except all message headers are included. ~m messages Read the named letters into the message being sent, indented by a tab or by the value of indentprefix. If no messages are specified, read the current message. Bulletin headers currently being ignored (past the ignore or retain command) are non included. ~p Print out the bulletin collected and then far, prefaced past the message header fields. ~q Abort the bulletin being sent, copying the bulletin to dead.letter in your home directory if save is set. ~R string Employ string equally the Answer-To field. ~r filename ~< filename Read the named file into the bulletin. ~s string Cause the named cord to get the current subject field. ~t proper name ... Add the given names to the direct recipient list. ~5 Invoke an alternate editor (defined by the VISUAL option) on the bulletin collected so far. Usually, the alternating editor will be a screen editor. Subsequently yous quit the editor, yous may resume appending text to the end of your message. ~w filename Write the message onto the named file. ~x Abort the message existence sent. No message is copied to ~/dead.letter, even if save is set. ~? Prints a brief summary of tilde escapes. ~! command Execute the indicated vanquish command, and then return to the message. ~| command Pipe the message through the control equally a filter. If the command gives no output or terminates abnormally, retain the original text of the message. The command fmt(i) is frequently used as command to rejustify the bulletin. ~: mail service-command ~_ mail-control Execute the given mail command. Non all commands, withal, are immune. ~~ string Insert the string of text in the message prefaced by a single ~. If y'all take inverse the escape graphic symbol, and then you should double that grapheme in order to send information technology. ~. Simulate end of file on input. Mail options Options are controlled via fix and unset commands. Options may exist either binary, in which case it is merely pregnant to run into whether they are set or non; or cord, in which case the bodily value is of involvement. The binary options include the following: append Causes letters saved in mbox to be appended to the end rather than prepended. This should always exist ready (mayhap in /etc/mail service.rc). enquire, asksub Causes mail to prompt y'all for the field of study of each bulletin you lot transport. If you answer with simply a newline, no subject field field will exist sent. askbcc Causes you to be prompted for boosted blind carbon re-create recipients at the end of each bulletin. Responding with a newline indicates your satisfaction with the electric current list. askcc Causes you to be prompted for additional carbon copy recipients at the end of each message. Responding with a newline indicates your satisfaction with the current list. autoinc Causes new mail to be automatically incorporated when information technology arrives. Setting this is similar to issuing the inc command at each prompt, except that the current message is not reset when new mail service arrives. autoprint Causes the delete command to behave similar dp; thus, afterwards deleting a message, the next one volition be typed automatically. debug Setting the binary selection debug is the same every bit specifying -d on the command line and causes mail to output all sorts of information useful for debugging post. dot The binary option dot causes mail service to interpret a period alone on a line equally the terminator of a message yous are sending. expandaddr Causes mail to expand message recipient addresses, as explained in the section Recipient address specifications. from Causes postal service to use the specified sender address in the "From:" field of the message header. A stripped down version of the address is too used in the message envelope. If unset, the message will not include an explicit sender accost and a default value will be added by the MTA, typically "user@host". This value tin be overridden past specifying the -r flag on the control line. hold This option is used to hold messages in the system mailbox by default. ignore Causes interrupt signals from your final to exist ignored and echoed as @'s. ignoreeof An option related to dot is ignoreeof which makes postal service refuse to take a control-D as the cease of a bulletin. ignoreeof also applies to mail command style. proceed Setting this option causes postal service to truncate your system mailbox instead of deleting it when information technology'due south empty. keepsave Messages saved with the relieve command are not normally saved in mbox at quit fourth dimension. Use this option to retain those messages. metoo Unremarkably, when a group is expanded that contains the sender, the sender is removed from the expansion. Setting this selection causes the sender to be included in the grouping. noheader Setting the selection noheader is the aforementioned as giving the -N flag on the command line. nosave Normally, when you abort a bulletin with 2 interrupt characters (usually control- C), mail copies the fractional letter to the file dead.alphabetic character in your dwelling house directory. Setting the binary selection nosave prevents this. quiet Suppresses the printing of the version when first invoked. Replyall Reverses the sense of reply and Reply commands. searchheaders If this choice is set, so a bulletin-list specifier in the course "/x:y" volition expand to all letters containing the substring 'y' in the header field 'x'. The string search is case insensitive. If 'x' is omitted, it will default to the "Subject" header field. The form "/to:y" is a special case, and volition expand to all messages containing the substring 'y' in the "To", "Cc" or "Bcc" header fields. The check for "to" is example sensitive, so that "/To:y" can be used to limit the search for 'y' to just the "To:" field. skipempty Don't send messages with an empty trunk. verbose Setting the selection verbose is the same as using the -5 flag on the command line. When mail runs in verbose way, the actual delivery of letters is displayed on the user'southward terminal. Selection string values EDITOR Pathname of the text editor to use in the edit command and ~e escape. If not defined, /usr/bin/ex is used. LISTER Pathname of the directory lister to utilize in the folders control. Default is /bin/ls. MBOX The proper name of the mbox file. Information technology can be the name of a folder. The default is "mbox" in the user'south home directory. PAGER Pathname of the plan to use in the more than command or when the crt variable is prepare. The default paginator more(ane) is used if this choice is not divers. REPLYTO If set, will be used to initialize the Answer-To field for outgoing messages. Trounce Pathname of the vanquish to use in the ! command and the ~! escape. A default beat out is used if this option is not defined. TMPDIR Directory in which temporary files are stored. VISUAL Pathname of the text editor to utilize in the visual command and ~v escape. If not defined, /usr/bin/half dozen is used. crt The valued option crt is used as a threshold to determine how long a bulletin must be before PAGER is used to read it. If crt is set up without a value, then the height of the terminal screen stored in the system is used to compute the threshold (see stty(1)). escape If divers, the first character of this selection gives the character to use in the identify of ~ to denote escapes. folder The proper name of the directory to utilize for storing folders of messages. If this name begins with a '/', mail considers it to be an absolute pathname; otherwise, the binder directory is institute relative to your abode directory. indentprefix String used by the ~m tilde escape for indenting letters, in place of the normal tab character ('^I'). Be sure to quote the value if information technology contains spaces or tabs. record If defined, gives the pathname of the file used to record all approachable mail. If not divers, then outgoing mail is not and so saved. screen Size of window of message headers for z. sendmail Pathname to an alternative postal service delivery system. toplines If divers, gives the number of lines of a bulletin to be printed out with the elevation command; ordinarily, the outset five lines are printed.
ENVIRONMENT
mail service utilizes the HOME, LOGNAME, USER, SHELL, Expressionless, PAGER, LISTER, EDITOR, VISUAL, REPLYTO, MAIL, MAILRC, and MBOX environment variables. If the MAIL environment variable is ready, its value is used equally the path to the user's mail spool.
FILES
/var/mail/* post part (unless overridden past the MAIL environment variable) ~/mbox user's one-time mail ~/.mailrc file giving initial post commands; tin exist overridden by setting the MAILRC surround variable /tmp/R* temporary files /usr/share/bsd-mailx/mail.*assist help files /etc/mail.rc system initialization file
EXIT Status
The mail utility exits 0 on success, and >0 if an error occurs.
Meet ALSO
fmt(ane), newaliases(1), vacation(1), aliases(5), mailaddr(vii), post.local(viii), newaliases(viii), sendmail(8), smtpd(8)
STANDARDS
The mailx utility is compliant with the IEEE Std 1003.1-2008 ("POSIX.1") specification. The flags [-iNnu] are marked past IEEE Std 1003.1-2008 ("POSIX.1") as being optional. The flags [-eFH] are marked by IEEE Std 1003.1-2008 ("POSIX.i") every bit existence optional, and are not supported past this implementation of mailx. The flags [-abcdEIrv] are extensions to the specification.
HISTORY
A post control appeared in Version three AT&T UNIX. This man folio is derived from the Mail service Reference Manual originally written past Kurt Shoens.
BUGS
Ordinarily, Mail and mailx are but links to mail, which can be confusing.
Source: http://manpages.ubuntu.com/manpages/bionic/man1/bsd-mailx.1.html
0 Response to "How to Read Mail in Ubuntu 16.04 With Command Line"
Post a Comment