Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter the output of ls command to display only files created in February?

For Linux OS, How to filter the output of ls command in terminal to display only files created in February?

like image 912
Amr Ragaey Avatar asked Apr 20 '15 00:04

Amr Ragaey


People also ask

How do I list only certain date files in Linux?

Linux find file by date using the date command Gnu find as various command line option to list files by a modification and access date/time stamp.

How do you use ls with dates?

In order to ls by date or list Unix files in last modifed date order use the -t flag which is for 'time last modified'. or to ls by date in reverse date order use the -t flag as before but this time with the -r flag which is for 'reverse'.

What ls command options sort files by date?

To sort by time in Linux ls command, we can use the -lt option. These two options will cause ls to sort files by modified time, with the most recently modified files appearing first and output is in long format. -t Sort by descending time modified (most recently modified first).

How do I filter files in Linux?

Filter Files by Name in a Directory Using grep This is the easiest way to find files (and folders) on Linux systems. grep is a program that is shipped with all Linux and FreeBSD systems (and even macOS). grep is used for filtering data using regular expressions.


1 Answers

touch --date "yyyy-mm-dd" /tmp/start touch --date "yyyy-mm-dd" /tmp/end find /my/path -type f -newer /tmp/start -not -newer /tmp/end 

or

ls -l  | grep 'yyyy-mm-dd' 
like image 153
Amr Ragaey Avatar answered Sep 28 '22 17:09

Amr Ragaey