Linux cal/ncal command operation example

  

On Linux systems, both cal and ncal commands use the calendar to display the calendar. Because these two commands are similar and not commonly used, many people will confuse them. The following small series will pass Linux. An example of the operation of the cal/ncal command is to give you an introduction so that you can have a deeper understanding.

Question 1, how to display the current month information

A: cal command can be used directly, without adding any parameters

$ cal

July 2013

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

Of course, you will get the same effect when you use ncal:

$ ncal

July 2013

Su 7 14 21 28

Mo 1 8 15 22 29

Tu 2 9 16 23 30

We 3 10 17 24 31

Th 4 11 18 25

Fr 5 12 19 26

Sa 6 13 20 27

You can See the calendar for the entire current month, the day's date is highlighted, you can use the -h parameter to turn off highlighting.

Q2, How to arrange dates vertically

Answer: Add the -J parameter with the ncal command

$ ncal -J

July 2013

Su 1 8 15 22 29

Mo 2 9 16 23 30

Tu 3 10 17 24 31

We 4 11 18 25

Th 5 12 19 26

Fr 6 13 20 27

Sa 7 14 21 28

Q3, want to check the Easter date

Answer: Add the -e parameter with the ncal command

$ ncal -e

31 March 2013

Q4, How to display the Julian calendar

Answer: Use the cal command Add -j parameter

$ cal -j

July 2013

Su Mo Tu We Th Fr Sa

182 183 184 185 186 187

188 189 190 191 192 193 194

195 196 197 198 199 200 201

202 203 204 205 206 207 208

209 210 211 212

Q5, how to display the specified month calendar

A: Use the cal command to add the -m parameter and the month

$ cal -m1

January 2013

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

By default, the -m parameter and month you added For the month of the current year, if you want to see the month of a specified year, you can add a four-digit year to the end.

$ cal -m1 1999

January 1999

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< Br>

Q6. How to display the calendar of the previous month and the next month for three months

Answer: Add the -3 parameter with the cal command

$ cal -3

June 2013 July 2013 August 2013

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 6 1 2 3

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

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

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

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

30
Previous1234Next page Total 4 pages

Copyright © Windows knowledge All Rights Reserved