I am trying to find out when was my machine was up last time.

Currently my machine is started at 11:00 pm. But i want to find when it was started last time(reboot/normal boot).

I tried using "last" command. but not getting any results.


  • Did you try who -b? Because the man page states: -b, --boot: time of last system boot. – mnille Jan 14 '20 at 7:37
  • Difficult to believe "not getting any results". When does your wtmp begin`? – RudiC Jan 14 '20 at 9:20
  • @mnille Thanks who -b is working. Any chance i can get the number of minutes elapsed between last login and now. means – sampat nayak Jan 14 '20 at 9:53
  • I am trying to subtract who -b with current date. – sampat nayak Jan 14 '20 at 9:54
  • 1
    @sampatnayak: This is just a suggestion, you have to tweak it to fit your needs: who -b | xargs | cut -d" " -f 3- | date -d - +%s. who -b => get date of last startup, xargs => get rid of leading and trailing spaces, cut -d" " -f 3- => get only the date, date -d - +%s => convert date to milliseconds since 1970. Check the man page of date to find out how to convert the date in a format you need. – mnille Jan 14 '20 at 11:52

According to the man page for the last command:

The files wtmp and btmp might not be found. The system only logs information in these files if they are present. This is a local configuration issue. If you want the files to be used, they can be created with a simple touch(1) command (for example, touch /var/log/wtmp).

So, check to see if you have the file /var/log/wtmp. If not, then the information that you are looking for is not going to be available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.