Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Program Code

1. Write Down Different options of cal command $man cal


CAL(1) BSD General Commands Manual CAL(1)

NAME
cal, ncal — displays a calendar and
the date of Easter

SYNOPSIS
cal [-3hjy] [-A number] [-B number]
[[month] year]
cal [-3hj] [-A number] [-B number] -m
month [year]
ncal [-3bhjJpwySM] [-A number]
[-B number] [-W number]
[-s country_code] [[month] year]
ncal [-Jeo] [-A number] [-B number]
[year]
ncal [-CN] [-H yyyy-mm-dd]
[-d yyyy-mm]

DESCRIPTION
The cal utility displays a simple
calendar in traditional format and
ncal offers an alternative layout,
more options and the date of Easter.
The new format is a little cramped
but it makes a year fit on a 25x80
terminal. If arguments are not spec‐
ified, the current month is dis‐
played.
(1) line 1 (press h for help or q to quit)
2. Write options of date command. $man date
DATE(1) User Commands DATE(1)

NAME
date - print or set the system date
and time

SYNOPSIS
date [OPTION]... [+FORMAT]
date [-u|--utc|--universal] [MMD‐
Dhhmm[[CC]YY][.ss]]

1
DESCRIPTION
Display the current time in the
given FORMAT, or set the system
date.

Mandatory arguments to long options


are mandatory for short options
too.

-d, --date=STRING
display time described by
STRING, not 'now'

--debug
annotate the parsed date,
and warn about questionable
usage to stderr

(1) line 1 (press h for help or q to quit)

Assigned Commands
root@Karunesh:~# date
Sun Aug 20 17:33:18 IST 2023
root@Karunesh:~# cal
August 2023
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

root@Karunesh:~# banner OSY


####### ##### # #
# # # # # #
# # # # #
# # ##### #
# # # #
# # # # #
####### ##### #

root@Karunesh:~# tty
/dev/pts/0

2
root@Karunesh:~# script
Script started, output log file is 'typescript'.

Exercise
XIII. 1. a. $cal 04 2019
root@Karunesh:~# cal 04 2019
April 2019
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
XIII.1. b. $date “+Today’s information %D and %B”; cal
root@Karunesh:~# date "+Today's information %D and %B"; cal
Today's information 08/20/23 and August
August 2023
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
XIII.1. c. $date “+My Clock is Showing %H hours, %M minutes &
%S seconds”
root@Karunesh:~# date "+My Clock is Showing %H hours, %M minutes & %S seconds"
My Clock is Showing 17 hours, 22 minutes & 33 seconds
XIII.1. d. $cal -3
root@Karunesh:~# cal -3
2023
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 1 2 3 4 5 1 2
2 3 4 5 6 7 8 6 7 8 9 10 11 12 3 4 5 6 7 8 9
9 10 11 12 13 14 15 13 14 15 16 17 18 19 10 11 12 13 14 15 16
16 17 18 19 20 21 22 20 21 22 23 24 25 26 17 18 19 20 21 22 23
23 24 25 26 27 28 29 27 28 29 30 31 24 25 26 27 28 29 30
30 31
XIII.1. e. $cal -5

3
root@Karunesh:~# cal -5
cal: invalid option -- '5'
Usage: cal [general options] [-jy] [[month] year]
cal [general options] [-j] [-m month] [year]
ncal -C [general options] [-jy] [[month] year]
ncal -C [general options] [-j] [-m month] [year]
ncal [general options] [-bhJjpwySM] [-H yyyy-mm-dd] [-s country_code] [-W number of d
ncal [general options] [-Jeo] [year]
General options: [-31] [-A months] [-B months] [-d yyyy-mm]
XIII.1. f. $cal -2000
root@Karunesh:~# cal -2000
cal: invalid option -- '2'
Usage: cal [general options] [-jy] [[month] year]
cal [general options] [-j] [-m month] [year]
ncal -C [general options] [-jy] [[month] year]
ncal -C [general options] [-j] [-m month] [year]
ncal [general options] [-bhJjpwySM] [-H yyyy-mm-dd] [-s country_code] [-W number of d
ncal [general options] [-Jeo] [year]
General options: [-31] [-A months] [-B months] [-d yyyy-mm]

You might also like