Home Linux Commandline Tips How to Find Out File Creation Date and Time in Linux

How to Find Out File Creation Date and Time in Linux

Sometimes, you might be interested to know when a file was created on a Linux system. In this guide, we will check out how to do exactly that. We will explore various ways that you can find out the file creation date on a Linux system.

1. Check the File Creation Date in Linux

The stat command is a command line utility that displays detailed information about a file. It lists information that includes file size, UID (User ID), GID (Group ID), file access, modification time, and creation dates.

To check the file creation date, simply run the following command where sample1.txt is the name of the file

$ stat sample1.txt

From the output, the Birth directive shows the file creation date.

Get File Creation Date in Linux
Get File Creation Date in Linux

To narrow down to the file creation date, pass the -c %w arguments as shown.

$ stat -c %w sample1.txt
Print File Creation Date in Linux
Print File Creation Date in Linux

Let’s make a few changes to the file by adding content using the echo command.

$ echo "Some Text" >> sample1.txt

When you view the file details, you’ll observe that the Modify field changes to indicate that the modification time has changed.

Check File Modification-Time in Linux
Check File Modification-Time in Linux

2. Display File Creation Date Using Debugfs Command

The other way of checking the file creation date is by using the debugfs command. However, this is a multi-stage operation and more complex than the stat command.

First, you need to get the file’s inode number using the ls command shown.

$ ls -i sample1.txt
Check File Inode Number in Linux
Check File Inode Number in Linux

Next, find the partition where the file is located using the df command shown

$ df ./sample1.txt
Find Out What Partition a File Belongs To
Find Out What Partition a File Belongs To

Finally, run the following debugfs command to find out the file creation date.

$ sudo debugfs -R 'stat <8126822>' /dev/sda5

The crtime field displays the file creation time and date.

Check File Creation Date and Time in Linux
Check File Creation Date and Time in Linux

You are all set! In this guide, we have looked at two ways of revealing or checking the file creation date on a Linux system.

Winnie Ondara
My name is Winnie, a Linux enthusiast and passionate tech writer in Linux and DevOPs topics. I enjoy keeping abreast with the latest technologies in the Linux ecosystem and trying out new tools provided by the FOSS community.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.