Contents of my dir are
$ ls -lrt
total 0
-rw-r--r-- 1 user1 admin 19 Oct 8 12:31 night.txt
-rw-r--r-- 1 user1 admin 19 Oct 8 12:31 noon.txt
-rw-r--r-- 1 user1 admin 38 Oct 8 12:31 day.txt
I would like to list out details of files that have a word in the filename as specified.
Example :
$ ls -lrt *day|night*
ls: *day: No such file or directory
bash: night.txt: command not found
Expected output
-rw-r--r-- 1 user1 admin 19 Oct 8 12:31 night.txt
-rw-r--r-- 1 user1 admin 38 Oct 8 12:31 day.txt
How to list out different files matching 2 different partterns, or in short how to use regex with ls
, so that I could OR
the filename parts.
Original scenarion, there are many file in the directory, have shortened the case for asking.