How to exit from mail command in unix

There are a few ways to exit from the mail command in Unix:

  1. Type q and press Enter: This is the most common way to exit from the mail command. Simply type q and press Enter to quit the program.
  2. Type exit and press Enter: You can also type exit and press Enter to exit from the mail command.
  3. Press Ctrl+D: If you're using a terminal emulator, you can press Ctrl+D to exit from the mail command.
  4. Use the quit command: Some versions of the mail command may also respond to the quit command. You can type quit and press Enter to exit from the program.

Note that if you're reading a message and want to exit without saving any changes, you can type q or exit to quit the program. If you're composing a new message and want to exit without sending it, you can type q or exit to quit the program and discard any unsaved changes.