For Linux OS, How to filter the output of ls command in terminal to display only files created in February?
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.
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'.
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).
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.
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'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With