UNIX Command to display

UNIX Command to display

UNIX Command to display:In this blog post we will see some UNIX display commands with example. Some important commands are Cal [ [ month ] year ], date [ +format ] and Echo[-n]text.

UNIX Command to display Calendar

Cal print a calendar
Cal [ [ month ] year ]
Where year is a number between 1 and 9999 and month is a number between 1 and 12:
Example 1: No arguments are specified
The current, previous, and following months are printed, along with the current date and time.
$ cal
Only month is specified
$cal jan
Example 3:
Calendar for the year 2005 is displayed
$ cal 2005

UNIX Command to display system date and time

Date to see date and time S
Syntax: date [ +format ]
The format specifier is proceeded by a +followed by a%. Some of the format specifiers are as follows:
What is specifies
Specifies the month number (1 to 12)
Specifies the abbreviated month(jan-dec)
Specifies the full month name
Specifies the day of the month (1 to 31)
Specifies the year (2 digits)
+%H, +%M and +%S
Specifies the hour, minute and seconds
Specifies the date as mm/dd/yy
Specifies the time as hh:mm:ss
Example 1: without arguments, date displays the current date and time.
$ date
Thu Dec 16 13:25:00 IST 2004
Example 2:
$ date +%D
Example 3:
$date + ‘%d%h%y’
27 Dec 04

UNIX Command to display message: echo

Echo: writes it arguments separated by blanks and terminated by a new line on the slandered output
The n option points a line without a new line.
$ echo Hello
An alternative to echo: printf
Write formatted output
Printf format [argument]

Leave a Reply

Your email address will not be published.