
- #FIND FILES BY DATE LINUX COMPRESS OLD HOW TO#
- #FIND FILES BY DATE LINUX COMPRESS OLD UPDATE#
- #FIND FILES BY DATE LINUX COMPRESS OLD FREE#
The -daystart option measures the time from the start of the current day instead of 24 hours ago. $ find /home/james -iname "*.docx" -atime 20 -type -f The -daystart option Note that there's no minus sign before the 20 value.

To view the docx files accessed precisely 20 days ago, run the command below. To view all text files in the home directory accessed within the last 30 days, run $ find /home/james -iname "*.txt" -atime -30 -type f -mtime 90 Means you are looking for a file modified exactly 90 days.įor example, to search for txt files in the /home/james/data directory that were modified less than 90 days ago use the following command: $ find /home/james/data -iname "*.txt" -mtime -90 -printĪdditionally, you can use numerical parameters as shown:įor example, the following command displays text files modified in the last 12 hours $ find /home/james/data -iname "*.txt" -mtime -0.5 Using atime - File accessĪs we have seen previously, atime is the attribute used for showing the last time a file was accessed by a user or an application.- mtime -90 Means that you are looking for a file changed less than 90 days ago.- mtime +90 Implies that you are looking for a file changed more than 90 days ago.To list files whose timestamp changed in the last 90 days use the + mtime 90 option. In this section, we will focus on how you can go about searching for files with timestamps that fall within a certain range using the mtime option. Here we will focus more on the ' atime and ' mtime' timestamps. That's a brief overview of the timestamps. A good example is modifying file ownership or permissions which effectively changes the timestamp. It reveals when the file's properties changed. Mmin: The mmin directive reveals the last time a file was modified in minutes.Ĭtime: This is the change time or change timestamp. By 'modify' we mean that some data was appended to the file, reorganized or deleted partly or wholly. The mtime changes when the file's contents are changed or modified. It reveals when a file was last modified either by a program or a user. This implies an application was used to open the file and read its contents.Īmin: This prints out when the file was accessed in minutes. Types of file timestampsįiles in Linux bear the following timestamps:Ītime: This is the access timestamp and it reveals the last time a file was read or accessed. And this will be the focus of this tutorial and will explore various ways to retrieve files based on their timestamps. Additionally, you can find files changed in the last number of days. You can specify to locate a file based on wide criteria such as file type, file location, and file permissions to mention a few. Once you have decided that these files are no more requires then go ahead and delete it, using one of the following command.The Linux find command is a handy tool that lets you find or locate files on your system. home/linuxgeek/Downloads/preferencessystemnetwork_103783.png home/linuxgeek/Downloads/Apps-preferences-system-network-icon_31759.png home/linuxgeek/Downloads/tech_ethernet_icon_156953.png

home/linuxgeek/Downloads/Teddy-320kbps-MassTamilan.io.zip home/linuxgeek/Downloads/Karnan-320kbps-MassTamilan.fm.zip find /home/linuxgeek/Downloads -type f -mtime +30 -print If not, delete them using the below command. The below output will allow you to check whether these files are needed before they are deleted. 1) Search and Delete files older than 30 daysįirst, we will find out all files older than 30 days under the ‘/home/linuxgeek/Downloads’ directory.

For example, time 2 = 2*24 hours (2 days). The time argument consider an input value as ’24 hours’.
#FIND FILES BY DATE LINUX COMPRESS OLD UPDATE#
Mtime (File Last Modify Time) – mtime shows when you modify, append or update a file content. To delete files older than 30 days on your Linux server, you need to use multiple commands together such as find command, ‘mtime’ command, ‘exec’ command and rm command.
#FIND FILES BY DATE LINUX COMPRESS OLD HOW TO#
Please make sure these files are no longer needed, as it will not ask for your confirmation before deleting the files.Īre you wondering how to delete older files in your Linux system? This quick guide show you how to find and remove files older than 30 days in Linux.
#FIND FILES BY DATE LINUX COMPRESS OLD FREE#
It is a best practice to find and remove old or unused files from the Linux system after a certain period of time, as this will free up some space on the system, which can be used for some other purpose.
