How to use the command 'uprecords' (with examples)
- Linux
- November 5, 2023
The ‘uprecords’ command is used to display a summary of historical uptime records. It provides information about the duration of the system’s uptime and the kernel version. This can be useful for keeping track of the system’s reliability and understanding its historical performance.
Use case 1: Display a summary of the top 10 historical uptime records
Code:
uprecords
Motivation: This use case allows users to quickly view a summary of the top 10 uptime records, which can provide insight into the system’s historical performance. It can help identify any patterns or trends in uptime and downtime.
Explanation: In this use case, the ‘uprecords’ command is executed without any arguments. This defaults to displaying the top 10 historical uptime records.
Example Output:
# Uptime System Unfortunate
- IDLE kernel version Contests
---------------------------------------------------------------------------------------------------------------------
1 370 days, 13:06 Linux 5.11.0-34-generic
2 345 days, 22:11 Linux 5.11.0-27-generic
3 316 days, 11:28 Linux 5.11.0-22-generic
4 301 days, 03:30 Linux 5.11.0-16-generic
5 282 days, 18:26 Linux 5.11.0-14-generic
6 260 days, 05:30 Linux 5.11.0-12-generic
7 224 days, 17:17 Linux 5.11.0-11-generic
8 201 days, 09:43 Linux 5.11.0-10-generic
9 181 days, 09:40 Linux 5.11.0-6-generic
10 170 days, 12:16 Linux 5.11.0-5-generic
Use case 2: Display the top 25 records
Code:
uprecords -m 25
Motivation: This use case is helpful when more detailed information about historical uptime records is required. By increasing the number of records displayed, users can get a broader picture of the system’s performance.
Explanation: The ‘-m’ option is used to specify the maximum number of records to display. In this case, the value is set to 25, indicating that the top 25 uptime records should be shown.
Example Output:
# Uptime System Unfortunate
- IDLE kernel version Contests
---------------------------------------------------------------------------------------------------------------------
1 370 days, 13:06 Linux 5.11.0-34-generic
2 345 days, 22:11 Linux 5.11.0-27-generic
3 316 days, 11:28 Linux 5.11.0-22-generic
4 301 days, 03:30 Linux 5.11.0-16-generic
5 282 days, 18:26 Linux 5.11.0-14-generic
6 260 days, 05:30 Linux 5.11.0-12-generic
7 224 days, 17:17 Linux 5.11.0-11-generic
8 201 days, 09:43 Linux 5.11.0-10-generic
9 181 days, 09:40 Linux 5.11.0-6-generic
10 170 days, 12:16 Linux 5.11.0-5-generic
11 162 days, 07:18 Linux 5.11.0-4-generic
12 151 days, 18:14 Linux 5.8.0-59-generic
13 137 days, 17:19 Linux 5.11.0-3-generic
14 126 days, 07:57 Linux 5.8.0-58-generic
15 119 days, 09:35 Linux 5.8.0-55-generic
16 113 days, 14:37 Linux 5.8.0-53-generic
17 105 days, 08:30 Linux 5.11.0-2-generic
18 103 days, 07:23 Linux 5.8.0-54-generic
19 97 days, 09:49 Linux 5.8.0-56-generic
20 91 days, 14:41 Linux 5.8.0-57-generic
21 66 days, 05:28 Linux 5.8.0-48-generic
22 61 days, 03:45 Linux 5.8.0-49-generic
23 53 days, 22:47 Linux 5.8.0-50-generic
24 50 days, 10:36 Linux 5.8.0-51-generic
25 45 days, 21:04 Linux 5.8.0-52-generic
Use case 3: Display the downtime between reboots instead of the kernel version
Code:
uprecords -d
Motivation: By showing the downtime between reboots instead of the kernel version, users can focus on analyzing the periods when the system was inactive or had experienced downtime. This can be valuable for identifying potential issues and understanding the system’s reliability.
Explanation: The ‘-d’ option is used to change the displayed information from the kernel version to the downtime between reboots.
Example Output:
# Uptime System Unfortunate
- IDLE downtime between reboots Contests
---------------------------------------------------------------------------------------------------------------------
1 370 days, 13:06 0 days, 01:01
2 345 days, 22:11 0 days, 01:02
3 316 days, 11:28 0 days, 01:03
4 301 days, 03:30 0 days, 01:04
5 282 days, 18:26 0 days, 01:05
6 260 days, 05:30 0 days, 01:06
7 224 days, 17:17 0 days, 01:07
8 201 days, 09:43 0 days, 01:08
9 181 days, 09:40 0 days, 01:09
10 170 days, 12:16 0 days, 02:10
Use case 4: Show the most recent reboots
Code:
uprecords -B
Motivation: This use case specifically focuses on displaying the most recent reboots recorded by ‘uprecords’. It can be particularly useful when troubleshooting or investigating recent system issues.
Explanation: The ‘-B’ option is used to show the most recent reboots instead of the long historical records.
Example Output:
# Uptime System Unfortunate
- IDLE kernel version Contests
---------------------------------------------------------------------------------------------------------------------
1 1:34 hours Linux 5.11.0-34-generic
2 18:42 hours Linux 5.11.0-27-generic
3 20:03 hours Linux 5.11.0-22-generic
4 22:14 hours Linux 5.11.0-16-generic
5 6:04 hours Linux 5.11.0-14-generic
6 6:54 hours Linux 5.11.0-12-generic
7 3:03 hours Linux 5.11.0-11-generic
8 3:05 hours Linux 5.11.0-10-generic
9 3:36 hours Linux 5.11.0-6-generic
10 3:33 hours Linux 5.11.0-5-generic
Use case 5: Don’t truncate information
Code:
uprecords -w
Motivation: By default, ‘uprecords’ truncates the uptime and downtime values, which can make it difficult to view the complete information, especially when identifying patterns. This use case ensures that the information is not truncated, providing a comprehensive summary.
Explanation: The ‘-w’ option is used to prevent the truncation of information, allowing the display of complete and untruncated uptime and downtime values.
Example Output:
# Uptime System Unfortunate
- IDLE kernel version Contests
---------------------------------------------------------------------------------------------------------------------
1 122 days, 14:39:30 Linux 5.8.0-50-generic IDD-12345789
2 104 days, 12:49:51 Linux 5.8.0-59-generic 6th-33ca72a8
3 99 days, 07:27:53 Linux 5.8.0-53-generic 7th-203cb447
4 89 days, 02:25:02 Linux 5.8.0-56-generic 1st-8f56fdcc
5 85 days, 08:53:42 Linux 5.8.0-58-generic nxt-a576cb1b
6 76 days, 01:18:14 Linux 5.8.0-54-generic olg-398cb46e
7 72 days, 07:46:15 Linux 5.8.0-55-generic ree-e8335651
8 66 days, 06:44:11 Linux 5.8.0-57-generic ttl-5c4e8be8
9 42 days, 13:07:18 Linux 5.11.0-27-generic syf-eb840e57
10 40 days, 19:45:52 Linux 5.11.0-34-generic rat-2894ace0
Conclusion:
The ‘uprecords’ command is a useful tool for viewing and analyzing historical uptime records. By using different options like ‘-m’, ‘-d’, ‘-B’, and ‘-w’, users can customize the output to suit their specific needs. Whether it’s understanding the system’s performance, identifying patterns, troubleshooting issues, or obtaining complete untruncated information, the ‘uprecords’ command provides valuable insights into the system’s uptime history.