How To Find Exact Installation Date And Time Of Your Linux OS
I am always curious to know small interesting things about Linux. Today, this 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. 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 Antergos or Manjaro Linux, you can easily find how long have you been 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 using the following command as root user:
# fs=$(df / | tail -1 | cut -f1 -d' ') && tune2fs -l $fs | grep created
# 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.
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, Scientific Linux, Oracle Linux, 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, just the install date only:
$ sudo rpm -qi basesystem | grep Install Install Date: Mon 24 Nov 2014 05:54:17 PM IST
Cool, yeah? What are you waiting for? Go and find out when you installed your Linux OS.
Hope this helps. If you find out guides useful, please spend a moment to share it on your social, professional networks. More good stuffs to come. Stay tuned!
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!