Linux Installation Date: How to Discover Your System’s Age

Want to know when your Linux system was installed? Don't wonder anymore! Here's how to do it quickly with a single simple command.

Have you ever found yourself pondering the age of your Linux system? Perhaps you’ve inherited a computer or are curious about when you first set up your trusty Linux machine.

In this article, we’ll show you a straightforward and efficient method to uncover the installation date of your Linux system using just a single command.

So, let’s embark on this short journey, and you’ll soon have a clear answer to the question, “When was my Linux system installed?”

Find Date and Time Linux OS Was Installed

Finding this information can be done in many different ways, and below, we present you with the best ones, both valid for any Linux distribution and specific to a particular one.

A Universal Method

First, we must clarify that there is no dedicated setting, variable, log file entry, or similar in Linux designed to expressly store information about the actual day and time when the system was installed.

However, it can be easily retrieved by determining when the root (“/”) file system was created.

This can be accomplished with the help of the stat command, which displays detailed information about a file or directory, including metadata such as create, access, and modification timestamps, file type, permissions, and more.

So, to find the exact day and time when your Linux system was installed, run the following:

stat / | awk '/Birth: /{print $2 " " substr($3,1,5)}'Code language: JavaScript (javascript)
Find the exact date and time when Linux was installed.
Find the exact date and time when Linux was installed.

And that’s all! We get the information we need right away. According to the command’s output above, the system was installed on December 22, 2020, at 2:14 AM.

In the above example, to display in a convenient way only the information we need, we have piped the stat command’s output to the awk and further formatted it using the substr function.

However, if you want to keep things as simple as possible, you can run the stat command below and look at the “Birth” row, indicating the moment the item was created on the file system.

stat /
Find the exact date and time when Linux was installed using the stat command.
Find the exact date and time when Linux was installed using the stat command.

Need more details? Check the stat command man page.

Another alternative approach to get information about when the file system was created, which is the Linux system’s installation time, is to use the command below. Remember that you must switch to the root user before running it.

fsname=$(df / | tail -1 | cut -f1 -d' ') && tune2fs -l $fsname | grep 'created'Code language: JavaScript (javascript)
Get information about when the file system was created.
Get information about when the file system was created.

Of course, other ways exist to discover when the Linux operating system was installed. Still, unlike the distro-agnostic ones shown above, they are tied to the particular distribution used. Here they are.

Debian / Ubuntu

On Debian and Ubuntu systems and all their derivatives like Linux Mint and others, you can see the exact day and time they were installed by displaying the first line of the installer syslog file.

sudo head -n1 /var/log/installer/syslogCode language: JavaScript (javascript)
Find the installation date and time on Debian / Ubuntu / Linux Mint.
Find the installation date and time on Debian / Ubuntu / Linux Mint.

Fedora / Rocky Linux / AlmaLinux

In Fedora, Red Hat Enterprise Linux and all its forks, such as Rocky Linux, AlmaLinux, Oracle Linux, etc., we can use it as a reliable marker of when the operating system was installed by checking the installation date of the “basesystem” package.

sudo rpm -qi basesystem | grep -i "install date"Code language: JavaScript (javascript)
Find the exact OS's installation date and time on Fedora / RHEL / Rocky Linux / AlmaLinux / Oracle Linux.
Find the exact OS’s installation date and time on Fedora / RHEL / Rocky Linux / AlmaLinux / Oracle Linux.

Keep in mind, however, that if you were performing an in-place upgrade, say from Fedora 38 to Fedora 39, Rocky 9.1 to Rocky 9.2, etc., the date that will be displayed when retrieving the “basesystem” package information will be that of the time of the upgrade.

In this case, to get the actual date of the initial installation, use some of the first two universal methods based on the stat command mentioned at the beginning of the article.

Arch Linux

If you’re running Arch or one of its derivatives like Manjaro or EndeavourOS, the first line of the “pacman.log” file will tell you when your Linux system was installed.

head -n1 /var/log/pacman.logCode language: JavaScript (javascript)
Find the exact OS's installation date and time on Arch Linux / Manjaro / EndeavourOS.
Find the exact OS’s installation date and time on Arch Linux / Manjaro / EndeavourOS.

Bottom Line

The quest to determine the installation date of your Linux system need not be shrouded in uncertainty any longer. Using the methods outlined in this guide, you can swiftly and effortlessly unveil your Linux system’s birthdate.

So, when is your Linux system installed? We can’t wait for you to let us know in the comments below.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%

4 Comments

  1. Dear sir,

    Your command
    stat / | awk ‘/Birth: /{print $2 ” ” substr($3,1,5)}’
    will succeed only and only if you know in advance
    that the string “Birth” is inside the return of stat.
    But if your system is French, Italian, Spanish, etc…
    your command will not succeed.

    For a system with french, the following command will succeed:

    stat / | awk ‘/Créé/{print $2 ” ” substr($3,1,5)}’

    Gérard

  2. On my Rocky 9.2 system:

    The first recipe returns “2023-03-07 23:47”
    The one using stat returns the same value.

    the second one returns: fsname=$(df / | tail -1 | cut -f1 -d’ ‘) && tune2fs -l $fsname | grep ‘created’
    tune2fs: Permission denied while trying to open /dev/md125
    Couldn’t find valid filesystem superblock.

    the one using RPM (I’m using Rocky Linux 9.2) returns:
    sudo rpm -qi basesystem | grep -i “install date”
    Install Date: Thu 24 Nov 2022 01:46:00 AM EST

    You will note that 2023-03-07 23:47 is not even in the same neighborhood as Thu 24 Nov 2022 01:46:00 AM EST. I would guess that the ‘install date’ field refers to some other event, maybe something to do with the creation of the installable image?

    I will assume that the failure of the one using tune2fs has to do with / being on a Linux Raid member rather than an actual partition.

    Fred

  3. rpm -qi basesystems only works if you’ve never done an in-place upgrade on an rpm based OS. For example, on my fedora system:

    [cmrdr@aptiva]$ stat / | grep -i birth
    Birth: 2019-11-30 01:46:37.000000000 -0600
    [cmdr@aptiva]$ rpm -qi basesystem | grep -i install\ date
    Install Date: Fri 12 May 2023 10:27:24 PM CDT

    The original installation was in November 2019 but has been upgraded through multiple Fedora releases.

Leave a Reply

Your email address will not be published. Required fields are marked *