For Linux OS, How to filter the output of ls command in terminal to display only files created in February?
Asked
Active
Viewed 9.3k times
40
-
It's an off-topic as it related to superuser. – Vaibhav Mule Apr 20 '15 at 00:17
-
try this: find Folder_name -type f -ls |grep 'Feb' – danidee Apr 20 '15 at 00:29
-
1Although it is related to superuser, there are a lot of answers to question. I would go with `ls -l` ? `| grep Feb`. I add the question mark because this will setup your time. Here you can print based on modification time, creation time, etc. It's up to you, read the man pages. – jiveturkey Apr 20 '15 at 13:58
-
Don't parse ls: http://mywiki.wooledge.org/ParsingLs – Alex Ixeras Sep 03 '21 at 05:42
2 Answers
43
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'

Amr Ragaey
- 1,043
- 1
- 10
- 16
22
You can simple grep the output to filter out only Feb files
ls -l | grep "Feb"
If you want to filter out files in the sub directories also then
ls -l -R | grep "Feb"
Note
- R flag means recursive

PalFS
- 731
- 6
- 16