> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Find mtime of File in Linux
- URL: https://linuxhandbook.com/find-mtime/
- Published: 2024-03-30T14:30:12.000Z
- Updated: 2024-03-30T14:30:12.000Z
- Description: See when was the file last modified with mtime in Linux.
- Author: Sagar Sharma
- Tags: Quick Tip

The mtime is a timestamp in Linux that tells you when the file was modified last time. 

There are two ways you can find the mtime in Linux: You can either use commands that give you mtime by default or use the `mtime` flag. 

In this tutorial, I will walk you through 3 ways you can find mtime in Linux:

1. Using the stat command (easy)
2. Using the ls command

I'll also discuss using the find command with the `mtime` flag.

## Find mtime using the stat command 

The stat command in Linux is used to get detailed information about the filesystem or file in Linux. 

But the best part is it shows the mtime along with the ctime and atime by default without any additional flags so all you have to do is append the filename to the stat command as shown:

```
stat Filename
```

![Use the stat command to get the mtime in Linux](https://linuxhandbook.com/content/images/2023/12/Use-the-stat-command-to-get-the-mtime-in-Linux-1.png)

To learn more about the mtime, ctime and atime timestaps, refer to our [detailed guide on timestamps in Linux](https://linuxhandbook.com/file-timestamps/):

[File Timestamps in Linux: atime, mtime, ctime ExplainedLet’s see what are the various kinds of file timestamps in Linux, how to see the timestamps for a file and how to change the timestamps.![](https://linuxhandbook.com/content/images/size/w256h256/2021/08/Linux-Handbook-New-Logo.png)Linux HandbookAbhishek Prakash![](https://linuxhandbook.com/content/images/2020/06/linux-timestamps.jpg)](https://linuxhandbook.com/file-timestamps/)

## Find mtime using the ls command 

When you use the ls command with the `-l` flag to get the list view, it also shows the mtime of the file. 

The best part of using the ls command for this purpose is you can use a directory as a target and list down mtime of multiple files at once.

To use the ls command to find the mtime, all you have to do is use the following command syntax: 

```
ls -l filename/directory
```

![Get the mtime in Linux using the ls command ](https://linuxhandbook.com/content/images/2023/12/Get-the-mtime-in-Linux-using-the-ls-command-.png)

## Additional Tip: Find files based on mtime with find command 

While the find command may look super complex to use (cough regex cough), once you get used to it, there's no going back. 

But this time, you are required to use the `-mtime` flag with the find command, and being one of the most powerful commands of Linux, it is obvious that you get multiple options there. 

To find files that were modified **exactly** `n` days ago:

```
find /path/to/search -mtime n

```

To find files that were modified **less than** `n` days ago:

```
find /path/to/search -mtime -n
```

To find files that were modified more than `n` days ago:

```
find /path/to/search -mtime +n

```

So let's say I want to list down files inside the `/usr` directory which was modified 5 days ago, then I will be using the following command:

```
find /usr -mtime 5
```

![](https://linuxhandbook.com/content/images/2023/12/Use-the-find-command-to-get-the-mtime.png)

If you are interested, you can check our detailed guide explaining [how to find directories that were modified N days ago](https://linuxhandbook.com/find-modified-files/):

[Find Files Modified in Last N Minutes in LinuxFinding recently modified files is a helpful parameter when troubleshooting your code or server. Learn how to find modified files in Linux command line.![](https://linuxhandbook.com/content/images/size/w256h256/2021/08/Linux-Handbook-New-Logo.png)Linux HandbookSagar Sharma![](https://linuxhandbook.com/content/images/2022/08/find-modified-files-linux.png)](https://linuxhandbook.com/find-modified-files/)

## Wrapping Up...

This was a quick tutorial on how you can find the modified time (mtime) in Linux in 3 different ways.

I've tried to keep this short and helpful so you can get the most out of it in the least time possible. I hope you will find this helpful and less time-consuming.

If you have questions or want to suggest what should be covered next, then leave a comment.