To search for files in /target_directory and all its sub-directories, that have been modified in the last 60 minutes: $ find /target_directory -type f -mmin -60
If you want to examine directories as well, you can omit -type f option in the command.
#UNIX FIND FILES BY DATE MODIFIED UPDATE#
The above command sorts files in /etc (and all its subdirectories), in the reverse order of their update time, and prints out the sorted list, along with their location and update time. To find the most recently modified files, sorted in the reverse order of update time (i.e., the most recently updated files first): $ find /etc -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r If you would like to find recently updated files on Linux, you can use find command as follows. You want to verify whether/how your Linux file system has been tampered with by someone recently.
For example, as a system admin, you have done some configuration on your Linux system, but forgot where it was saved. There are various occasions where you would like to search for files that have been changed/created in your Linux system recently or within any time frame. Thanks for reading this article and please comment below if you find any other options useful.How to find recently modified files on Linux 3 root root 100 Oct 25 12:15 NetworkManager With tail combination, it shows recently updated file at the bottom. 1 root root 3 Oct 25 12:15 syslogd.pidĭrwxr-xr-x. 1 root root 4 Oct 30 18:42 dhclient-eth0.pidĭrwxr-xr-x. We will use a combination of 'ls" and 'head' command.īelow command will show modified 10 files with the recently updated file at the top $ ls -lt /run/ | head -10 -rw-rw-r.
#UNIX FIND FILES BY DATE MODIFIED HOW TO#
Let see how to check recently modified 10 files in a directory using ls commands. test/file1 5) Recently modified 10 files mmin -10 -type f -exec ls -l + -rw-r-r. We can get files modified in last 10 minutes with command below: $ find. 4) Find files modified in Last 10 minutes 1 root root 4 Oct 28 02:50 dhclient-eth0.pidĭrwxr-xr-x. We will use -halt options with ls command to list files of a specific directory in human readable file sizes, long format. It uses K, M, G, and T suffixes (or no suffix for bytes) $ ls -halt /run total 28K If you want to sort by directory, then by dates use $ ls -Rltr 3) Display in Human Readable format rw-r-r- 1 root root 9718 Jun 23 14:47 ddagent-install.log We will use -ltr options with ls command to list files of a specific directory with recently modified files at the bottom. 2 root root 60 Aug 21 13:18 tuned 2) List Files with Last Modified Date/Time (most recent at bottom) 3 root root 60 Sep 7 23:11 userĭrwxr-xr-x. 1 root root 4 Sep 8 12:41 dhclient-eth0.pidĭrwxr-xr-x. To list files and shows the last modified files at top, we will use -lt options with ls command. Hope you interested in reading: How to Sort all Files by Size Using ls command in Linux 1) List Files directory with Last Modified Date/Time In this article, I will show you how to sort files by date using ls command in Linux.
The ls command is used to list directory contents and the results can be sorted upon several criteria such as by date, alphabetical order of filenames, modification time, access time, version and file size.