How do I find the last logged system boot and shutdown times?












26














I'm a Rails developer working on a web application on Ubuntu Server 10.04. Due to internal requirements, I was asked to find the last 10 system boot and shutdown times... I have no clue where to find these details. Could someone help me out?










share|improve this question





























    26














    I'm a Rails developer working on a web application on Ubuntu Server 10.04. Due to internal requirements, I was asked to find the last 10 system boot and shutdown times... I have no clue where to find these details. Could someone help me out?










    share|improve this question



























      26












      26








      26


      7





      I'm a Rails developer working on a web application on Ubuntu Server 10.04. Due to internal requirements, I was asked to find the last 10 system boot and shutdown times... I have no clue where to find these details. Could someone help me out?










      share|improve this question















      I'm a Rails developer working on a web application on Ubuntu Server 10.04. Due to internal requirements, I was asked to find the last 10 system boot and shutdown times... I have no clue where to find these details. Could someone help me out?







      boot shutdown logging events






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 28 '12 at 4:16









      Jjed

      10.7k65989




      10.7k65989










      asked Apr 26 '11 at 15:55









      Selvakumar

      131123




      131123






















          2 Answers
          2






          active

          oldest

          votes


















          46














          Use the last command.



          last -x | grep shutdown
          last -x | grep reboot


          You can pipe this to the head to read the last n instances. For example, in your case:



          last -x | grep shutdown | head -n 10


          You also should set



          BOOTLOGD_ENABLE=Yes


          in the /etc/default/bootlogd file (it could be No by default).






          share|improve this answer























          • great answer, I add | tail -10
            – enzotib
            Apr 26 '11 at 19:05










          • I have no /etc/default/bootlogd on my Ubuntu 16.04.2
            – Vadim Kotov
            Oct 24 '17 at 14:58










          • More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
            – AndyP
            Feb 17 at 0:24



















          0














          For a GUI method you can use hardinfo as described here: Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?.



          Under the section Boots you will see this:



          Hardinfo boot log.png



          Installation is straight forward using:



          sudo apt install hardinfo





          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f37132%2fhow-do-i-find-the-last-logged-system-boot-and-shutdown-times%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            46














            Use the last command.



            last -x | grep shutdown
            last -x | grep reboot


            You can pipe this to the head to read the last n instances. For example, in your case:



            last -x | grep shutdown | head -n 10


            You also should set



            BOOTLOGD_ENABLE=Yes


            in the /etc/default/bootlogd file (it could be No by default).






            share|improve this answer























            • great answer, I add | tail -10
              – enzotib
              Apr 26 '11 at 19:05










            • I have no /etc/default/bootlogd on my Ubuntu 16.04.2
              – Vadim Kotov
              Oct 24 '17 at 14:58










            • More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
              – AndyP
              Feb 17 at 0:24
















            46














            Use the last command.



            last -x | grep shutdown
            last -x | grep reboot


            You can pipe this to the head to read the last n instances. For example, in your case:



            last -x | grep shutdown | head -n 10


            You also should set



            BOOTLOGD_ENABLE=Yes


            in the /etc/default/bootlogd file (it could be No by default).






            share|improve this answer























            • great answer, I add | tail -10
              – enzotib
              Apr 26 '11 at 19:05










            • I have no /etc/default/bootlogd on my Ubuntu 16.04.2
              – Vadim Kotov
              Oct 24 '17 at 14:58










            • More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
              – AndyP
              Feb 17 at 0:24














            46












            46








            46






            Use the last command.



            last -x | grep shutdown
            last -x | grep reboot


            You can pipe this to the head to read the last n instances. For example, in your case:



            last -x | grep shutdown | head -n 10


            You also should set



            BOOTLOGD_ENABLE=Yes


            in the /etc/default/bootlogd file (it could be No by default).






            share|improve this answer














            Use the last command.



            last -x | grep shutdown
            last -x | grep reboot


            You can pipe this to the head to read the last n instances. For example, in your case:



            last -x | grep shutdown | head -n 10


            You also should set



            BOOTLOGD_ENABLE=Yes


            in the /etc/default/bootlogd file (it could be No by default).







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jul 6 '17 at 10:46









            muru

            1




            1










            answered Apr 26 '11 at 18:13









            wojox

            7,57612955




            7,57612955












            • great answer, I add | tail -10
              – enzotib
              Apr 26 '11 at 19:05










            • I have no /etc/default/bootlogd on my Ubuntu 16.04.2
              – Vadim Kotov
              Oct 24 '17 at 14:58










            • More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
              – AndyP
              Feb 17 at 0:24


















            • great answer, I add | tail -10
              – enzotib
              Apr 26 '11 at 19:05










            • I have no /etc/default/bootlogd on my Ubuntu 16.04.2
              – Vadim Kotov
              Oct 24 '17 at 14:58










            • More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
              – AndyP
              Feb 17 at 0:24
















            great answer, I add | tail -10
            – enzotib
            Apr 26 '11 at 19:05




            great answer, I add | tail -10
            – enzotib
            Apr 26 '11 at 19:05












            I have no /etc/default/bootlogd on my Ubuntu 16.04.2
            – Vadim Kotov
            Oct 24 '17 at 14:58




            I have no /etc/default/bootlogd on my Ubuntu 16.04.2
            – Vadim Kotov
            Oct 24 '17 at 14:58












            More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
            – AndyP
            Feb 17 at 0:24




            More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
            – AndyP
            Feb 17 at 0:24













            0














            For a GUI method you can use hardinfo as described here: Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?.



            Under the section Boots you will see this:



            Hardinfo boot log.png



            Installation is straight forward using:



            sudo apt install hardinfo





            share|improve this answer


























              0














              For a GUI method you can use hardinfo as described here: Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?.



              Under the section Boots you will see this:



              Hardinfo boot log.png



              Installation is straight forward using:



              sudo apt install hardinfo





              share|improve this answer
























                0












                0








                0






                For a GUI method you can use hardinfo as described here: Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?.



                Under the section Boots you will see this:



                Hardinfo boot log.png



                Installation is straight forward using:



                sudo apt install hardinfo





                share|improve this answer












                For a GUI method you can use hardinfo as described here: Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?.



                Under the section Boots you will see this:



                Hardinfo boot log.png



                Installation is straight forward using:



                sudo apt install hardinfo






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 days ago









                WinEunuuchs2Unix

                43.2k1075163




                43.2k1075163






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f37132%2fhow-do-i-find-the-last-logged-system-boot-and-shutdown-times%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Human spaceflight

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                    張江高科駅