What is Linux file timestamp (atime, mtime, ctime)?

Breaking News! Ubuntu 20.10 Groovy Gorilla has been released.

Ubuntu 20.10 Groovy Gorilla is "a short-term release". It comes with 9 months of security updates, significant...

How to Create Alias in Outlook?

Email alias is an email address which which we can use in addition to our primary email...

Top 5 Great Features of Pop OS Linux

Pop OS is a Linux distribution developed by an American computer manufacturer System76. Pop OS Linux has...
Ankur Gupta
Ankur Guptahttps://antarjaal.in
Web developer by profession, Over 10 years experience of building websites and web applications. Currently working on Epaper CMS Cloud (Software As Service based product). Special interest in computer and technology. After writing on the blogger platform for years, started his own tech portal Antarjaal.In.

Difference between atime, mtime and ctime Linux file timestamp

Every Linux file has three kind of file timestamps: Access Timestamp (atime), Modified Timestamp (mtime), and Changed Timestamp (ctime).

Access Timestamp indicates when the last time a file was read/accessed. If a software reads a file Access timestamp gets changed even if nothing has been removed or added to the file.

A modified timestamp indicates when the contents of a file were last modified. For example, you opened a text file and added or removed few lines and saved the file. In this case, both its access timestamp and modified timestamp will be changed.

READ  5 things to consider before the upgrading RAM

A changed timestamp indicates when a file’s metadata has been modified. For example, a change in File Permission will update its Changed Timestamp.

Viewing a timestamp of a file

To view the Modified timestamp the ls -l [Filename] command has to be entered

To view the Access timestamp the ls -lu [Filename] command has to be entered

To view the Changed timestamp the ls -lc [Filename] command has to be entered

READ  5 things to consider before the upgrading RAM
Linux File Timestamp Explained

Viewing all timestamps of a file at once

The stat [filename] command has to be given to see all the timestamps of a file simultaneously.

Linux File Timestamp Explained

As you can see in the screenshot above, the stat command not only shows us the Accessed/Modified/Changed time but also the file permissions of its user and group. It also displays the file size and file type. If you notice, the stat command also displays the timezones in Accesses/Modified/Changed time.

Changing the timestamp of a file

To change the access timestamp of a file, enter the command touch -a [filename]. To change the modified timestamp of the file, enter the command touch -m [filename].

Linux File Timestamp Explained

If you want to change the “Changed” Timestamp, you can change it by modifying file permissions of file. For example chmod +x [filename] will change your “Changed timestamp”.

If you want to keep the desired timestamp of a file, then enter the command touch -d “2020-01-15 10:30:45” [filename]. Here, you can enter any date. This command changes the access and modified timestamps.

READ  GoAccess lets you monitor how many hits your server is handling
Linux File Timestamp Explained

Importance of Linux file Timestamps.

Timestamps tell us the date and time when files are last accessed or modified. This enables the backup software to decide what files are needed to backup and what files are can be left. Backup software backup files whose timestamp has been changed. Therefore, you can also force an application to do any work with that file by changing the timestamp of a file.

READ  Create Linux Desktop Apps using PHP Desktop

See more: How to install Google Chrome in Debian Linux 10

2 COMMENTS

Comments are closed.

Breaking News! Ubuntu 20.10 Groovy Gorilla has been released.

Ubuntu 20.10 Groovy Gorilla is "a short-term release". It comes with 9 months of security updates, significant...

How to Create Alias in Outlook?

Email alias is an email address which which we can use in addition to our primary email address under our existing email...

Top 5 Great Features of Pop OS Linux

Pop OS is a Linux distribution developed by an American computer manufacturer System76. Pop OS Linux has all the goodness of Ubuntu....

Download Microsoft Edge Preview for Linux

And eventually Microsoft released its Edge browser for the Linux operating system. This is currently a preview release. But with this release,...

Watch “Revolution OS” Movie Online

Revolution OS is a documentary that is about the history of GNU, Linux and open source and free software movements. It includes...

More Articles Like This

READ  How to edit 'etc/hosts' file in non-rooted Android phone?