MQ-Jr
MQ-Jr
unixcop Admin

How To Find Installation Date and Time of Linux OS

Introduction

Hi guys, In this tutorial, We will illustrate a few ways to find Linux OS’s installation date and time.

Find Installation Date and Time

Here are some methods below to get the OS’s installation date and time

  • Check Linux OS installation date with stat command as follows
stat / | grep "Birth" | sed 's/Birth: //g' | cut -b 2-11

stat command will display file status in Linux with some manipulation tools such as sed editor and cut as shown above.

  • Also you can use awk with stat to display Linux installation date as shown below
stat / | awk '/Birth: /{print $1,$2}'

The installation date and time of my Linux OS is Jul 26, 2021.

  • Also you can use stat command without sed, cut and awk as per stat command has a flag to check Linux installation date and time, just run the below command
stat -c %w /
  • On Debian based systems, search in the syslog to get Linux OS installation date and time as shown below
sudo head -n1 /var/log/installer/syslog
  •  If these logs were deleted or you couldn’t find them, you can find the installation date with another way like below, just run the command:
fs=$(df / | tail -1 | cut -f1 -d' ') && tune2fs -l $fs | grep created
  • You can get Installation date with the Basesystem which defines the components of a basic Linux system such as the package installation, to use the Basesystem to find the Installation date and time, run the command below:
rpm -qi basesystem
  • Also you can use grep with the previous command as follows to only get the needed output:
rpm -qi basesystem | grep -i date
  • Or use the command below:
rpm -q basesystem --qf '%{installtime:date}\n'
  • Also you can download this script and run it then you will get the Installation date, So download it with the command belwo
wget -O installdate.sh https://raw.githubusercontent.com/alicela1n/install-date/main/install-date
  • Make the script executable
chmod +x installdate.sh
  • Run the script to get the date and time of Linux OS installation
./installdate.sh 

Conclusion

That’s it

We showed you how to find Linux OS’s installation date and time with some ways, you can choose one of them to do that.

Thanks

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook