Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of the Linux basic command cal

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the usage of Linux basic command cal". In daily operation, I believe many people have doubts about the usage of Linux basic command cal. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "the usage of Linux basic command cal"! Next, please follow the editor to study!

Cal

The cal directive can display a calendar information, or the current month if no options and parameters are specified.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Cal [- smjy13] [day] month] year]

2. List of options

Option

Description

-V

Display command version information

-1

Displays calendar information for one month, which is the default value

-3

Display calendar information for last month, this month, and next month

S

Display Sunday as the first day

-m

Make Monday the first day of the week. By default, Sunday is the first day.

-j

Displays the Julian calendar (shows the number of days from January 1 to the current)

-y

Display calendar information for the current year

One parameter specifies the year to display (1-9999); note that the full year must be specified: "cal 89" will not display the 1989 calendar. The two parameters represent the month (1-12) and the year. The three parameters represent the date (1-31), month, and year, and if the calendar is displayed on the terminal, the date is highlighted. If there are no parameters, the calendar for the current month is displayed. The year begins on January 1st. The first day of the week is determined by the region.

3. Examples

1) display the Julian calendar

[root@localhost] # cal-j / / what is shown here is not the "day", but the day of the year

September 2018

One, two, three, four, five, six.

two hundred and forty four

245 246 247 248 249 250 251

252 253 254 255 256 257 258

259 260 261 262 263 264 265

266 267 268 269 270 271 272

two hundred and seventy three

2) display "Sunday" as the first day, showing the last 3 months

[root@localhost] # cal-3-s

August 2018 September 2018 October 2018

Day one two three four five six day one two three four five six day one two three four five six

1 2 3 4 1 1 2 3 4 5 6

5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13

12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20

19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27

26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31

thirty

[root@localhost ~] #

3) make Monday the first day of the week

[root@localhost] # cal-m

September 2018

One, two, three, four, five, six.

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

At this point, the study of "the usage of the Linux basic command cal" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report