{"id":2352,"date":"2018-01-02T17:19:11","date_gmt":"2018-01-02T14:19:11","guid":{"rendered":"https:\/\/www.howtoforge.com\/linux-uptime-command\/"},"modified":"2018-01-02T17:19:11","modified_gmt":"2018-01-02T14:19:11","slug":"linux-uptime-command-explained-for-beginners-with-examples","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/linux-uptime-command-explained-for-beginners-with-examples\/","title":{"rendered":"Linux uptime Command Explained for Beginners with Examples"},"content":{"rendered":"<p>If you are a Linux newbie, and have interest in system administration, or you want to become a power user, then you need to have a solid knowledge of the command line. There are several commands that you should know about, and one of them is <strong>uptime<\/strong>. In this article, we will discuss the basics of this command using some easy to understand examples.<\/p>\n<p>But before that, it&#8217;s worth mentioning that all examples used in this tutorial have been tested on an Ubuntu 16.04 machine.<\/p>\n<h2 id=\"linux-uptime-command\">Linux uptime command<\/h2>\n<p>As the name suggests, the uptime command gives you the time for which the system has been up (or running). Here&#8217;s its syntax:<\/p>\n<p class=\"command\">uptime [options]\n<p>And here&#8217;s is the way the tool&#8217;s man page explains it:<\/p>\n<pre>uptime gives a one line display of the following information. The current time, how long the system<br\/>has been running, how many users are currently logged on, and the system load averages for the past<br\/>1, 5, and 15 minutes.<\/pre>\n<p>The following Q&amp;A-styled examples should give you a better idea on how the uptime command works.<\/p>\n<h2 id=\"q-how-to-use-the-uptime-command\">Q1. How to use the uptime command<\/h2>\n<p>Uptime&#8217;s basic usage is very easy &#8211; just write the command&#8217;s name and press enter.<\/p>\n<p class=\"command\">uptime<\/p>\n<p>Here&#8217;s the kind of output the tool produces:<\/p>\n<p><a class=\"fancybox\" id=\"img-uptime-basic-usage1\" href=\"https:\/\/www.howtoforge.com\/images\/usage_of_pfsense_to_block_dos_attack_\/big\/uptime-basic-usage1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/linux-uptime-command-explained-for-beginners-with-examples.png\" alt=\"How to use the uptime command\" width=\"500\" height=\"31\" title=\"\"><\/a><\/p>\n<p>So the first entry is the current time, then &#8216;up&#8217; shows the system is running, 5:53 is the total time for which the system has been up, and then finally are the system load averages. Just in case you want to know more, here&#8217;s what the uptime man page says about the last entry:<\/p>\n<pre readability=\"8\">System load averages is the average number of processes that are either in a runnable or <br\/>uninterruptable state. A process in a runnable state is\u00a0 either using the CPU or waiting to use the<br\/>CPU. A process in uninterruptable state is waiting for some I\/O access, eg waiting for\u00a0 disk.<p>The\u00a0 averages are taken over the three time intervals. Load averages are not normalized for the <br\/>number of CPUs in a system, so a load\u00a0 average\u00a0 of 1 means a single CPU system is loaded all the <br\/>time while on a 4 CPU system it means it was idle 75% of the time.<\/p><\/pre>\n<p>In case you just want to know the time for which the system has been up, and that too in a more human-readable format, use the <strong>-p<\/strong> command line option.<\/p>\n<p class=\"command\">uptime -p<\/p>\n<p>Here&#8217;s the output this command produced in our case:<\/p>\n<p><a class=\"fancybox\" id=\"img-uptime-p-option\" href=\"https:\/\/www.howtoforge.com\/images\/usage_of_pfsense_to_block_dos_attack_\/big\/uptime-p-option.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/linux-uptime-command-explained-for-beginners-with-examples-1.png\" alt=\"make the tool show up time in pretty format\" width=\"235\" height=\"38\" title=\"\"><\/a><\/p>\n<h2 id=\"q-how-to-make-uptime-display-datetime-since-when-system-is-up\">Q3. How to make uptime display date\/time since when system is up<\/h2>\n<p>You can also make uptime specifically display the time\/date since when the system has been running. This can be done using the <strong>-s<\/strong> command line option.<\/p>\n<p class=\"command\">uptime -s<\/p>\n<p>Here&#8217;s the output the command produced in our case:<\/p>\n<p><a class=\"fancybox\" id=\"img-uptime-s\" href=\"https:\/\/www.howtoforge.com\/images\/usage_of_pfsense_to_block_dos_attack_\/big\/uptime-s.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/linux-uptime-command-explained-for-beginners-with-examples-2.png\" alt=\"make uptime display date\/time since when system is up\" width=\"234\" height=\"34\" title=\"\"><\/a><\/p>\n<h2 id=\"q-how-to-get-version-information-and-help-in-general\">Q4. How to get version information and help in general<\/h2>\n<p>Use the -V option to get version information, and -h for general help.<\/p>\n<p class=\"command\">uptime -V<\/p>\n<p class=\"command\">uptime -h<\/p>\n<p><a class=\"fancybox\" id=\"img-uptime-v-h\" href=\"https:\/\/www.howtoforge.com\/images\/usage_of_pfsense_to_block_dos_attack_\/big\/uptime-v-h.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/01\/linux-uptime-command-explained-for-beginners-with-examples-3.png\" alt=\"How to get version information and help\" width=\"462\" height=\"237\" title=\"\"><\/a><\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>As you&#8217;d have observed, the uptime command is easy to understand and use. It doesn&#8217;t offer many features (or command line options). What all it offers have been discussed here. So just practice these options and you should be ready to use uptime in your day-to-day work. Just in case you require, here&#8217;s the tool&#8217;s <a href=\"https:\/\/linux.die.net\/man\/1\/uptime\" target=\"_blank\" rel=\"noopener noreferrer\">man page<\/a>.<\/p>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you are a Linux newbie, and have interest in system administration, or you want to become a power user, then you need to have a solid knowledge of the command line. There are several commands that you should know about, and one of them is uptime. In this article, we will discuss the basics &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-2352","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/2352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=2352"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/2352\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=2352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=2352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=2352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}