Black background with yellow cursive text that says 'Install Date' with a gray calendar of August 2016

How To Find The Linux Install Date

  • Adam Douglas

For the curious minds at heart, it can be interesting to know when a system was initially setup as in the installation or creation date and time. Finding the date and time of when a system was initially setup can be done in numerous ways. The unfortunate part is it all depends on each individual circumstance as to which method will work. Therefore, it can be helpful to know before hand the approximate date of when a system was initially setup, because depending on the solution used one may get a misleading data due to the data being deleted. Though I still strongly feel that it is best to use file system based solutions instead of relying on a log file data.

In exploring this topic I was surprised to learn that I’ve been running Arch Linux on my main system since 2016. That’s more than 6 years running without doing a re-install of the operating system. Believe me there has been times I’ve wanted to just re-install the operating system, but I wanted to learn from my mistakes and learn how to fix issues along the way. So for me, it makes me happy I’ve been able to keep this system going for so long.

After playing around with these solutions below, feel free to share your experience and age of a system over on Mastodon.

Arch Linux Pacman Log

This solution will only work if the data is still available in the log file. A more reliable solution would be to use “File System Creation Date” or “State Command” methods.

$ head -n1 /var/log/pacman.log
[2016-08-08 21:13] [PACMAN] Running 'pacman -r /mnt -Sy --cachedir=/mnt/var/cache/pacman/pkg base base-devel abs linux-headers efibootmgr gnome nvidia-dkms'

Debian-based Systems Syslog

If the log file has been deleted, try using the “File System Creation Date” or “State Command” methods instead.

# head -n1 /var/log/installer/syslog
Sep 15 02:20:59 syslogd started: BusyBox v1.30.1

Fedora, RHEL and Variant Basesystem

Any distribution that is based upon Fedora or Red Hat Enterprise Linux (RHEL) that uses the Basesystem can use this method. Such systems as CentOS, AlmaLinux or Rocky Linux will work.

The Basesystem defines the components of a basic operating system such as package installation order to use during bootstrapping. As a result every installation should have the Basesystem.

# rpm -qi basesystem | grep -i "install date"
Install Date: Thursday 30 June 2022 22:35:05 PM

Gentoo Linux Emerge Log

I’ve not been able to test this example as yet. It should work with Gentoo Linux and variant distributions.

$ head -n 1 /var/log/emerge.log | cut -b 31-43

Stat Command

This method is more accurate as it looks at the file system itself instead of relying on log data that maybe missing. I’ve also found this method works with NTFS (New Technology File System).

$ stat -c %w /
2016-08-08 15:10:52.049347976 0000
-c      use the specified FORMAT instead of the default; output a newline after each use of FORMAT
%w      time of file birth, human-readable; - if unknown

The output can be formatted using the date command.

$ date -d "$(stat -c %w /)"
Mon 08 Aug 2016 03:10:52 PM UTC
$ date -d "$(stat -c %w /)" +"%Y-%m-%d %H:%M:%S %z"
2016-08-08 15:10:52 0000

File System Creation Date: Ext2/Ext3/Ext4

# tune2fs -l /dev/sdd1 | grep -i 'Filesystem created:'
Filesystem created:       Tue Jan  1 15:53:19 2019
# dumpe2fs /dev/sdd1 | grep -i 'Filesystem created:'
dumpe2fs 1.46.5 (30-Dec-2021)
Filesystem created:       Tue Jan  1 15:53:19 2019

File System Creation Date: BTRFS

Find the desired subvolume.

# btrfs subvolume list -a /
ID 257 gen 1692588 top level 5 path <FS_TREE>/ROOT
ID 258 gen 1692588 top level 5 path <FS_TREE>/home
ID 259 gen 1691778 top level 5 path <FS_TREE>/srv

Display the details of the subvolume (e.g. /ROOT) to see the “Creation time”.

# btrfs subvolume show / | grep -i "creation time:"
Creation time:      2016-08-08 15:10:52 0000

Install-date Script

The install-date script by Alice (phosphorcube) is useful if one needs to do this on a variety of systems. Though I did find the script restrictive when one wants to check more than just the root file system creation date.

Download the script to the current working directory as “install-date” using one of these commands.

$ curl -JLO https://raw.githubusercontent.com/phosphorcube/install-date/main/install-date
$ wget https://raw.githubusercontent.com/phosphorcube/install-date/main/install-date

Set the execute permission.

$ chmod +x install-date

Run the script.

$ ./install-date
2016-08-08

This is post 49 of 100, and is round 2 of the 100 Days To Offload challenge.

    • change topic
    • change topic
    • change 100DaysToOffload message