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