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

How does the Linux system view logs

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will introduce in detail the "Linux system how to view the log", the content steps are clear and detailed, the details are handled properly, and the editor will update different knowledge points every day, hope that this article "how to view the log in the Linux system" can give you unexpected gains, please follow the editor's ideas slowly in depth, the specific content is as follows, to harvest new knowledge.

Using the commands cal and ncal in the Linux system, you can view and calibrate the calendar, and these two commands also need parameters to achieve the calendar requirements we need.

Question 1. How to display the information of the current month

Answer: you can use the cal command directly without adding any parameters

$cal July 2013 Su Mo Tu We Th Fr Sa 12 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 18 15 22 29 Tu 29 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 date of the day is highlighted, you can use the-h parameter to turn off the highlight.

Q 2. How to arrange dates vertically

Answer: use the ncal command to add the-J parameter at the same time

Ncal-J July 2013 Su 18 15 22 29 Mo 29 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 question 3, would like to inquire about the date of Easter

Answer: use the ncal command to add the-e parameter

$ncal-e 31 March 2013 ask 4, how to display the Julian calendar

Answer: use the cal command to add the-j parameter

$cal-j July 2013 Su Mo Tu We Th Fr Sa 182 183 184 185 186 188 189 190 191 192 193 194 196 197 198 200 202 203 204 2020 207 208 209 210 211 212 question 5, how to display a calendar for a specified month

Answer: use the cal command to add the-m parameter and month

$cal-M1 January 2013 Su Mo Tu We Th Fr Sa 12 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 add is the month of the current year, and if you want to see the month of a specified year, you can add a four-digit year later.

$cal-M1 1999 January 1999 Su Mo Tu We Th Fr Sa 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 question 6, how to display the calendar of the previous month and the three months of the next month at the same time

Answer: use the cal command to add the-3 parameter

Cal-3 June 2013 July 2013 August 2013 Su Mo Tu We Th Fr Sa 11 2 3 4 5 6 6 12 3 2 3 4 5 6 7 8 8 9 10 11 12 13 4 5 5 6 7 8 9 10 9 10 9 10 11 12 13 14 15 15 16 17 19 20 12 13 14 15 16 17 16 17 18 19 20 21 22 21 23 24 25 26 27 18 18 19 20 21 22 23 24 23 24 24 25 26 27 28 29 29 30 31 25 26 27 28 29 30 31 25 27 28 29 30 31 30 You can view any three-month calendar:

Cal-3-m3 1984 February 1984 March 1984 April 1984 Su Mo Tu We Th Fr Sa 12 3 4 12 3 4 5 5 6 7 7 8 9 10 11 4 5 6 7 8 9 10 8 9 10 9 10 11 12 13 13 14 14 16 17 11 12 13 15 16 17 11 13 15 16 17 11 13 15 16 17 18 19 20 21 19 20 21 22 23 24 25 18 19 20 21 22 23 24 22 23 24 25 26 26 26 27 28 28 29 25 26 27 28 30 31 29 30 Q 7, How to display the information of orthodox Easter

Answer: use the ncal command to add the-o parameter

$ncal-o 5 May 2013 ask 8, how to display the country code

Answer: use the ncal command to add the-p parameter

$ncal-p AL Albania 1912-11-30 IT Italy 1582-10-04 AT Austria 1583-10-05 JP Japan 1918-12-18 AU Australia 1752-09-02 LI Lithuania 1918-02-01 BE Belgium 1582-12-14 LN Latin 9999-05-31 BG Bulgaria 1916-03-18 LU Luxembourg 1582-12-14 CA Canada 1752-09-02 LV Latvia 1918-02-01 CH Switzerland 1655-02-28 NL Netherlands 1582-12-14 CN China 1911-12-18 NO Norway 1700-02-18 CZ Czech Republic 1584-01-06 PL Poland 1582-10-04 DE Germany 1700-02-18 PT Portugal 1582-10-04 DK Denmark 1700-02-18 RO Romania 1919-03-31 ES Spain 1582-10-04 RU Russia 1918-01-31 FI Finland 1753-02-17 SI Slovenia 1919-03-04 FR France 1582-12-09 SW Sweden 1753-02-17 GB United Kingdom 1752-09-02 TR Turkey 1926-12-18 GR Greece 1924-03-09 * US United States 1752-09-02 HU Hungary 1587-10-21 YU Yugoslavia 1919-03-04 IS Iceland 1700-11-16 question 9, How to display weekly information by natural month

Answer: use the ncal command to add the-w parameter

$ncal-w July 2013 Su 7 14 21 28 Mo 18 15 22 29 Tu 29 16 23 30 We 3 10 17 24 31 Th 4 11 25 Fr 5 12 19 26 Sa 6 13 20 27 26 27 28 29 30 the bottom line is next month's information.

Question 10. How to check the calendar for the whole year at once

Answer: use the ncal command to add the-y parameter and a four-digit year

Ncal-y 2010 2010 January February March April Su 3 10 17 24 31 7 14 21 28 7 14 21 28 4 11 18 25 Mo 4 11 18 18 18 15 22 15 29 5 12 19 26 Tu 5 12 19 26 29 16 23 29 16 23 30 6 13 20 27 We 6 13 20 27 3 10 17 24 3 10 17 24 31 7 14 21 28 Th 7 14 21 28 4 11 18 25 4 11 18 25 18 15 22 29 Fr 18 15 22 29 5 12 19 26 5 12 19 26 29 16 23 30 Sa 29 16 23 30 6 13 20 27 6 13 20 27 3 10 17 24 May June July August Su 29 16 23 30 6 13 20 27 4 11 18 25 18 15 22 29 Mo 3 10 17 24 31 7 14 21 28 5 12 19 26 29 16 23 30 Tu 4 11 18 25 18 15 22 29 6 13 20 27 3 10 17 24 31 We 5 12 19 26 29 16 23 30 7 14 21 28 4 11 18 25 Th 6 13 20 27 3 10 17 24 18 15 22 29 5 12 19 26 Fr 7 14 21 28 4 11 18 25 29 16 23 30 6 13 20 27 Sa 18 15 22 29 5 12 19 26 3 10 17 24 31 7 14 21 28 September October November December Su 5 12 19 26 3 10 17 24 31 7 14 21 28 5 12 19 26 Mo 6 13 20 27 4 11 18 25 18 15 22 29 6 13 20 27 Tu 7 14 21 28 5 12 19 26 29 16 23 30 7 14 21 28 We 18 15 22 29 6 13 20 27 3 10 17 24 18 15 22 29 Th 29 16 23 30 7 14 21 28 4 11 18 25 16 23 30 Fr 3 10 17 24 18 15 22 29 5 12 26 3 10 17 31 Sa 4 11 18 25 29 23 30 6 13 20 27 4 11 18 question 11, How to display calendars for a month and a few months before and after a month

Answer: use the cal command to add the-m-B-A parameter and the number of months

$cal-M4-B2-A2 February 2013 March 2013 April 2013 Su Mo Tu We Th Fr Sa 12 12 3 4 5 6 3 4 5 6 6 7 8 9 3 4 5 6 7 7 9 7 8 9 9 8 9 10 11 12 13 10 11 12 13 13 10 11 13 14 15 16 11 12 13 15 16 11 12 13 13 16 12 13 14 15 16 14 15 16 17 18 19 20 17 18 19 20 21 22 23 17 18 19 20 21 22 23 21 22 23 24 25 26 27 24 25 26 27 28 24 25 26 27 28 29 30 28 29 30 31 May 2013 June 2013 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 12 3 4 15 6 7 8 9 10 11 23 4 5 6 7 8 12 13 14 15 16 17 18 9 10 11 12 13 14 15 19 20 21 22 23 25 16 17 18 18 20 21 26 27 28 30 31 23 25 27 28 29 30 As you can see, we want to show the calendar for April and the first and last two months of April. If you want to display the calendar for a specified year at the same time a few months before and after the year, you need to add the-y parameter and a four-digit year:

Cal-y 2012-B2-A2 November 2011 December 2011 January 2012 Su Mo Tu We Th Fr Sa 12 3 4 5 12 3 12 3 4 5 6 6 7 7 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 13 14 15 16 17 19 11 13 14 14 15 16 17 19 11 13 14 15 16 17 19 11 13 14 15 16 17 19 11 13 14 15 16 17 18 19 19 13 14 15 16 17 17 18 19 20 21 20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28 27 28 29 30 25 26 27 28 29 30 31 29 30 31 February 2012 March 2012 April 2012 Su Mo Tu We Th Fr Sa 12 3 4 12 31 23 4 5 6 7 5 6 7 8 9 10 11 4 5 6 7 8 9 10 8 9 10 11 12 13 14 12 13 14 15 16 17 18 11 12 13 14 15 16 17 15 16 17 18 19 20 21 19 20 21 22 23 24 25 18 19 20 21 22 23 24 22 23 24 25 26 27 28 26 27 28 29 25 26 27 28 29 30 31 29 30 May 2012 June 2012 July 2012 Su Mo Tu We Th Fr Sa 12 3 4 5 12 12 3 4 5 6 7 6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14 13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21 20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31 August 2012 September 2012 October 2012 Su Mo Tu We Th Fr Sa 12 3 4 11 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 30 November 2012 December 2012 January 2013 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 12 3 11 23 4 5 4 5 6 7 8 9 10 23 4 5 6 7 8 6 7 8 9 10 11 12 11 12 13 14 15 16 17 9 10 11 12 13 14 15 13 14 15 16 17 18 19 18 19 20 21 22 23 24 16 17 18 19 20 21 22 20 21 22 23 24 25 26 25 26 27 28 29 30 23 24 25 26 27 28 29 28 29 30 31 30 31 February 2013 Su Mo Tu We Th Fr Sa 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 18 21 22 23 25 26 27 28 from the results we can see In addition to 2012, we can also see the calendars for the last two months of 2011 and the first two months of 2013.

Question 12. How to display the ncal command as the result of the cal command

A: you can do this using the-C parameter

$ncal July 2013 Su 7 14 21 28 Mo 18 15 22 29 Tu 29 16 23 30 We 3 10 17 24 31 Th 4 11 18 25 Fr 5 12 19 26 Sa 6 13 20 27$ cal July 2013 Su Mo Tu We Th Fr Sa 12 3 4 5 6 7 8 9 10 11 12 13 14 16 17 18 20 21 23 24 26 27 28 29 30 31 Ncal-C July 2013 Su Mo Tu We Th Fr Sa 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 the same You can use the-N parameter to make the cal command look like ncal:

Cal July 2013 Su Mo Tu We Th Fr Sa 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 18 20 21 23 24 26 27 28 29 30 31$ ncal July 2013 Su 7 14 21 28 Mo 18 15 22 29 Tu 29 16 23 30 We 3 10 24 31 Th 4 11 18 25 Fr 5 12 26 Sa 6 13 20 27 $cal-N July 2013 Su 7 14 21 28 Mo 18 15 22 29 Tu 29 16 23 30 We 3 10 17 24 31 Th 4 11 18 25 Fr 5 12 19 26 Sa 6 13 20 27, How to make the calendar look like Monday as the first day of the week

Answer: use the ncal command to add the-M parameter

Ncal-M July 2013 Mo 18 15 22 29 Tu 29 16 23 30 We 3 10 17 24 31 Th 4 11 18 25 Fr 5 12 19 26 Sa 6 13 20 27 Su 7 14 21 28 there is also a-S parameter that can be displayed on Sunday as the first day

Q14. How to switch the ncal command to the previous display mode

Answer: use the ncal command to add the-b parameter

$ncal July 2013 Su 7 14 21 28 Mo 18 15 22 29 Tu 29 16 23 30 We 3 10 17 24 31 Th 4 11 18 25 Fr 5 12 19 26 Sa 6 13 20 27$ ncal-b July 2013 Su Mo Tu We Th Fr Sa 12 3 4 5 6 7 8 9 11 12 13 14 16 17 18 20 21 22 23 25 26 27 28 29 30 31cal And some other relevant information about the ncal command

Although we can check the man page of these two commands for more information, I have some other information to tell you here. When we need to specify a year, we need a four-digit year. Not all parameters can be used at the same time, such as-y,-3,-1 there is a conflict between them, if used at the same time, the following parameters will overwrite the previous parameters.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

Thank you for reading here. I hope you have the most profound experience on the key issue of "how to view the log of the Linux system" from the practical level, and you need to practice and use it yourself to understand it. If you want to read more related articles, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report