Home Command line utilities How To Find Exact Installation Date And Time Of Your Linux OS
Find Exact Installation Date And Time Of Your Linux OS

How To Find Exact Installation Date And Time Of Your Linux OS

By sk
1042 Views

I am always curious to know small interesting things about Linux. Today, a question popped out in my mind. How long have I been using my Arch Linux OS? I have no idea when I installed my Arch Linux first. It is working very well since it was installed. I am sure it was an year ago. But, I don't know the exact day. Have you ever wondered how long have you been using your Linux OS without a reinstall? Read on to find exact installation date and time of your Linux OS.

Find Exact Installation Date And Time Of Your Linux OS

If you use Arch Linux and its derivatives like Manjaro Linux, you can easily find how long have you been using it without a reinstall by analyzing the pacman logs as shown below.

$ head -n1 /var/log/pacman.log

Sample output from my Arch Linux system:

[2016-05-05 13:10] [PACMAN] Running 'pacman -r /mnt -Sy --print-format=%s --cachedir=/mnt/var/cache/pacman/pkg --noconfirm base sudo grub wireless_tools wpa_supplicant wpa_actiond netctl dialog os-prober'

As you see in the above, I am still using my first installation from May, 05 2016. Even though Arch Linux is rolling release model, I have never had to reinstall Arch Linux. It works perfectly well without breaking anything. I have 3 Arch Linux systems (One host and two vms) over the years, and I've never had to "reinstall" even once. And, I am sure I am not going to reinstall it anytime soon.

What If the logs are deleted already? No problem. You still can find out the installation time of your Linux OS.

Switch to root user. On Debian, Ubuntu systems, simply run the following command to switch to root user.

$ sudo su

Now, run any one of the following commands as root user.

# fs=$(df / | tail -1 | cut -f1 -d' ') && tune2fs -l $fs | grep created

Or,

# dumpe2fs /dev/sda1 | grep 'Filesystem created:'

Or,

# tune2fs -l /dev/sda1 | grep 'Filesystem created:'

Replace /dev/sda1 with correct hdd drive partition.

It will display when the file system was originally created.

Sample output:

Filesystem created: Thu May 5 18:40:19 2016

These commands will work on all Linux distributions.

On Fedora, RHEL and its clones such as CentOS, you can find it using the following command:

$ sudo rpm -qi basesystem

Sample output from my CentOS 7 server:

Name : basesystem
Version : 10.0
Release : 7.el7.centos
Architecture: noarch
Install Date: Mon 24 Nov 2014 05:54:17 PM IST
Group : System Environment/Base
Size : 0
License : Public Domain
Signature : RSA/SHA256, Fri 04 Jul 2014 06:16:57 AM IST, Key ID 24c6a8a7f4a80eb5
Source RPM : basesystem-10.0-7.el7.centos.src.rpm
Build Date : Fri 27 Jun 2014 04:07:10 PM IST
Build Host : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
Summary : The skeleton package which defines a simple CentOS Linux system
Description :
Basesystem defines the components of a basic CentOS Linux
system (for example, the package installation order to use during
bootstrapping). Basesystem should be in every installation of a system,
and it should never be removed.

Or, to display the installation date only, run this:

$ sudo rpm -qi basesystem | grep Install
Install Date: Mon 24 Nov 2014 05:54:17 PM IST

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

8 comments

warsea August 5, 2017 - 7:36 am

I found that on my Fedora installation the basesystem package was updated between Fedora 25 and 26 so that might not be a reliable way to determine the original installation time.

Reply
Alan August 3, 2018 - 6:19 pm

There are much better ways. The simplest for most installations is to check where / is mounted and then do

dumpe2fs /dev/whatever |grep created

That will give you the date the filesystem itself was created

Reply
Mike August 4, 2018 - 1:10 am

Wow, my current Manjaro install is almost 2 years old. More then I remembered. System still works great!

Reply
Aman August 5, 2018 - 5:52 pm

if i want to change instalation time 5 years back then how will i do?

Reply
Neto August 3, 2019 - 9:50 pm

Is it possible tô change The date?

Reply
Tom September 17, 2019 - 12:27 pm

not reliable, it shows all the same date in rpm on may Azure VMs… probably Azure installes all from the same image

Reply
Manfred May 20, 2020 - 2:51 pm

On Ubuntu Systems you could use the date of “/var/log/installer/syslog”

Reply
Hariharasudhan July 10, 2020 - 2:21 pm

Yes Super

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More