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
    Commented Jan 14, 2020 at 7:37
  • Difficult to believe "not getting any results". When does your wtmp begin`?
    – RudiC
    Commented Jan 14, 2020 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 Commented Jan 14, 2020 at 9:53
  • I am trying to subtract who -b with current date. Commented Jan 14, 2020 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
    Commented Jan 14, 2020 at 11:52

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .