How To Find Exact Installation Date And Time Of Your Linux OS
by sk - Published August 2, 2017 - Updated August 3, 2019
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
---
|03B|09lack |03P|09anther|03(|09RCS|03)|07
--- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
* Origin: Castle Rock BBS - bbs.castlerockbbs.com - (77:1/102)