Linux Timestamps: The Difference Between atime, mtime, ctime, and crtime
The Linux filesystem keeps track of different timestamps for each file on the system:
crtime, all of which represent different file activities.
Description of Each Timestamp
atime is the last accessed time, which updates when the file contents are read through commands such as
grep or by an application.
mtime is the last modification time, which updates when you change the contents of a file.
ctime is the last change time, which updates when the file’s properties (i.e. permissions, name, location) change.
crtime is the creation time, which doesn’t update.
It’s important to remember the following:
atimecan update by itself
How to Check Each Timestamp
We can use variations of
ls to check individual timestamps.
ls -l will give us
ls -lu will give us
ls -lc will give us
We can append a filename to each of these to find the timestamp for a specific file.
In order to view all timestamps at once for a specific file, we can use
We can also use
mactime to create a timeline of file activity, which specifies, in chronological order, when each file in the specified directory was created, accessed, and modified.
Knowing this can be very helpful in a variety of situations. It can help you:
- Confirm that a file or directory was last modified on a specific date
- Quickly find files that were recently updated
- Verify if a file was ever accessed or moved
More CLI Articles
- How to Install Powerline in WSL2 Terminal
- How to Zip and Unzip Files in WSL2
- How to List All Git Aliases
- How to Add, Commit, and Push in One Git Command
- How to Replace a Local Branch with a Remote Branch in Git
- How to Revert a Specific File or Folder in Git
- How to Install Hugo on WSL2
- How to Install Node.js and npm on WSL2
- How to Revert to a Previous Commit in Git without Modifying History
- How to Merge a Branch Into Another Branch in Git
- How to Fix "xcrun error invalid active developer path" with Git on macOS
- How to Update Node to Another Version on Windows WSL
- How to Use SSH with GitHub (Instead of HTTPS) on Windows WSL
- How to Delete Files with a Specific Extension in all Subdirectories Recursively
- How to Suppress Output of npm install
- How to Pass Environment Variables to Makefiles in Subdirectories
- How to Access Environment Variables in a Makefile
- How to Reset Password on Ubuntu Linux
- How to Pull a Branch from Another User's Fork using Git
- How to Align GitHub README images in Markdown
- How to Merge Development and Production Branches in Git
- How to Quickly Push to Git with a Bash Script
- How to Change Author of Commit in Git History
- WSL2: How to Fix "Virtual hard disk files must be uncompressed and unencrypted and must not be sparse"
- How to Replace a Branch with Another Branch in Git
- How to Delete a Git Branch Locally and Remotely
- How to Schedule Recurring Deploys in Netlify
- How to View All Global Packages in npm
- How to Test an npm package locally
- How to Update an npm Package (Fixing "You cannot publish over the previously published versions")
- How to Undo Changes in a Single File in Git
- How to Fix the Netlify error: "Treating warnings as errors because process.env.CI = true"
- How to Set the Default Directory for Git Bash on Windows
- How to Search Past Terminal Commands in Linux
- How to Get the Count of Files with each File Extension in Linux
- How to Find All Files with a Specific File Extension in Linux
- How to Run Multiple Commands Simultaneously in Linux
- How to Watch a File in Linux using tail
- How To Remove Duplicate Lines While Maintaining Order in Linux
- How To Count the Number of Non-Empty Output Lines in Linux
- How To Find All IP Addresses within a File in Linux with grep
- How To Rename Every File in all Subdirectories in Windows CMD