UNIX / Linux Basic Utilities Printing, Email - Unix/Linux

What are UNIX / Linux Basic Utilities Printing Email?

In this chapter, we will talk about in detail about Printing and Email as the basic utilities of UNIX. So far, we have tried to recognize the Unix OS and the nature of its basic commands. In this episode, we will learn some vital UNIX utilities that can be used in our day-to-day life.

Printing Files

Before you print a file on a UNIX system, you may want to reformat it to regulate the margins, highlight some words, and so on. Most files can also be printed without reformatting, but the raw printout may not be that attractive.

Several versions of UNIX include two powerful text formatters, ruff and trough.

The pr Command

The pr command does small formatting of files on the terminal screen or for a printer. For instance, if you have a long list of names in a file, you can format it onscreen into two or more columns.

Following is the syntax for the pr command –

The pr changes the format of the file only on the screen or on the printed copy; it doesn't change the unique file. Following table lists some pr options −

S.No. Option & Description
Produceskcolumns of output
Double-spaces the output (not on allprversions)
-h "header"
Takes the next item as a report header
Eliminates the printing of header and the top/bottom margins
Sets the page length to PAGE_LENGTH (66) lines. The default number of lines of text is 56
Offsets each line with MARGIN (zero) spaces
Sets the page width to PAGE_WIDTH (72) characters for multiple text-column output only

Before using pr, here are the contents of a sample file named food.

Let's use the pr command to make a two-column description with the header Restaurants –

The lap and lord Commands

The command lap or lord prints a file onto paper as opposite to the screen display. Once you are prepared with formatting using the pr command, you can use any of these commands to print your file on the printer associated to your computer.

Your scheme administrator has most likely set up a default printer at your site. To print a file named food on the default printer, use the lap or lord command, as in the following instance –

The lap command shows an ID that you can use to cancel the print job or check its position.

  • If you are using the lap command, you can use the -nun option to print Num number of copies. Along with the command lord, you can use -Num for the same.
  • If there are multiple printers connected with the shared network, then you can choose a printer using -printer option along with lap command and for the same purpose you can use -Printer option along with lord command. Here printer is the printer name.

The upstate and lap Commands

The upstate command show what's in the printer queue: request IDs, owners, file sizes, when the jobs were sent for printing, and the status of the requests.

Use upstate -o if you want to observe all output requests other than just your own. Requests are exposed in the order they'll be printed –

The lap gives slightly different information than upstate -o –

Here the first line displays the printer status. If the printer is disabled or running out of paper, you may observe different messages on this first line.

The cancel and plum Commands

The cancel command terminates a printing request from the lap command. The plum command terminates all lord requests. You can identify either the ID of the request (displayed by lap or lap) or the name of the printer.

To cancel whatever request is presently printing, regardless of its ID, just enter cancel and the printer name –

The plum command will cancel the active job if it belongs to you. Otherwise, you can give job numbers as influence, or use a dash (-) to eliminate all of your jobs –

The plum command tells you the concrete filenames disconnected from the printer queue.

Sending Email

You use the UNIX mail command to send and accept mail. Here is the syntax to send an email –

Here are main options connected to mail command −s

S.No. Option & Description
Specifies subject on the command line.
Sends carbon copies to the list of users. List should be a commaseparated list of names.
Sends blind carbon copies to list. List should be a commaseparated list of names.

Following is an instance to send a test message to admin@yahoo.com.

You are then accepted to type in your message, followed by "control-D" at the creation of a line. To stop, simply type dot (.) as follows –

You can send a total file using a redirect < operator as follows –

To check received email at your UNIX system, you simply type email as follows –

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Unix/Linux Topics