Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
Linux combine sort files by date created and given file name

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 enter image description here

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

find . -name "filename" -printf '%TY:%Tm:%Td %TH:%Tm %h/%f\n' | sort

Forget xargs. "Find" and "sort" are all the tools you need.

over 4 years ago · Santiago Trujillo Report

0

My best guess would be to use xargs:

find . -name 'filename*' -print0 | xargs -0 /bin/ls -ltr

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 :)

over 4 years ago · Santiago Trujillo Report

0

find . -name "filename" -exec ls --full-time \{\} \; | cut -d' ' -f7- | sort

You might have to adjust the cut command depending on what your version of ls outputs.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!