I need to combine these to commands in order to have a sorted list by date created with the specified "filename".
I know that sorting files by date can be achieved with:
ls -lrt
and finding a file by name with
find . -name "filename*"
I don't know how to combine these two. I tried with a pipeline but I don't get the right result.
[EDIT] Not sorted
My best guess would be to use
xargs
:There's an upper limit on the number of arguments, but it shouldn't be a problem unless they occupy more than 32kB (read more here), in which case you will get blocks of sorted files :)
Forget xargs. "Find" and "sort" are all the tools you need.
Check the below-shared command:
1) List Files directory with Last Modified Date/Time To list files and shows the last modified files at top, we will use -lt options with ls command.
https://linoxide.com/linux-how-to/how-sort-files-date-using-ls-command-linux/
You might have to adjust the cut command depending on what your version of ls outputs.