Skip to main content

getting Getting files for the current date in Linux?

Usually the date +%d gives the output 08 for the current date, 08/10/2017. But when I do the ls -lrt on a path, the date format is like Oct 8 15:03, so, how todo I get the files of the current date?

I'm using athe command

ls -lrt XYZ.LOG* |grep "$(date +'%b %d')" |awk '{print $9}'

but it's not giving me the file of today's date (08/10/2017) although it gives me correct output for the dates 10 - 31st of any month.

getting files for the current date in Linux?

Usually the date +%d gives the output 08 for current date, 08/10/2017. But when I do the ls -lrt on a path, the date format is like Oct 8 15:03, so, how to get the files of the current date?

I'm using a command

ls -lrt XYZ.LOG* |grep "$(date +'%b %d')" |awk '{print $9}'

but it's not giving me the file of today's date (08/10/2017) although it gives me correct output for the dates 10 - 31st of any month.

Getting files for the current date in Linux?

Usually the date +%d gives the output 08 for the current date, 08/10/2017. But when I do the ls -lrt on a path, the date format is like Oct 8 15:03, so, how do I get the files of the current date?

I'm using the command

ls -lrt XYZ.LOG* |grep "$(date +'%b %d')" |awk '{print $9}'

but it's not giving me the file of today's date (08/10/2017) although it gives me correct output for the dates 10 - 31st of any month.

Aligned the title with the tag
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 265

getting files for the current date in unixLinux?

Formatting and markup.
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Usually the date +%ddate +%d gives the output : 0808 for current date :, 08/10/2017. But when iI do the ls -lrtls -lrt on a path,the the date format is like Oct 8 15:03Oct 8 15:03, so, how to get the files of the current date.?

I'm using a command : ls -lrt XYZ.LOG* |grep "$(date +'%b %d')" |awk '{print $9}'

ls -lrt XYZ.LOG* |grep "$(date +'%b %d')" |awk '{print $9}'

but it's not giving me the file of today's date  (08/10/2017) although it gives me correct output for the dates 10 - 31st of any month.

Usually the date +%d gives the output : 08 for current date : 08/10/2017. But when i do the ls -lrt on a path,the date format is like Oct 8 15:03, so, how to get the files of the current date. I'm using a command : ls -lrt XYZ.LOG* |grep "$(date +'%b %d')" |awk '{print $9}' but it's not giving me the file of today's date(08/10/2017) although it gives me correct output for the dates 10 - 31st of any month.

Usually the date +%d gives the output 08 for current date, 08/10/2017. But when I do the ls -lrt on a path, the date format is like Oct 8 15:03, so, how to get the files of the current date?

I'm using a command

ls -lrt XYZ.LOG* |grep "$(date +'%b %d')" |awk '{print $9}'

but it's not giving me the file of today's date  (08/10/2017) although it gives me correct output for the dates 10 - 31st of any month.

added 5 characters in body
Source Link
ashish_k
  • 375
  • 1
  • 7
  • 18
Loading
Formatting and markup.
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading
Source Link
ashish_k
  • 375
  • 1
  • 7
  • 18
Loading