jezmck jezmck - 1 year ago 119
Linux Question

Linux: cat matching files in date order?

I have a few files in a directory with names similar to

  • _system1.log

  • _system2.log

  • _system3.log

  • other.log

but they are not created in that order.

Is there a simple, non-hardcoded, way to
the files starting with the underscore in date order?

Answer Source

Quick 'n' dirty:

cat `ls -t _system*.log`


ls -1t _system*.log | xargs -d'\n' cat
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download