With the command stat * --format='%A %h %U %G %s %z %n' I get:
-rwxrwxrwx 1 myuser mygroup 131072 2021-11-12 14:52:23.495595927 +0100 myfile
Is it possible to have a stat output like the following? Note that the date is in another format.
-rwxrwxrwx 1 myuser mygroup 131072 Nov 12 14:52:23 2021 myfile
This is the like the output of ls -l, but in another post they told me not to parse the output of ls -l myfile, that's why I asked if it is possibile to do it with stat.
ls -l myfile. So you can just use that command.ls -l myfile: unix.stackexchange.com/questions/684171/…, that's why I asked if it is possibile to do it withstat.dateto convert it to another format.lstostatwon't help you with the main issue, which is filenames that can contain any character, even newline.stat --format="%n"happily prints the embedded newline and messes up your output. You need something likestat --printf='%A %h %U %G %s %z %n\0'to get an unambiguous output with a NUL separator. Or use%Nfor quoted output, if you can deal with that. Then there's also the question of why you'd want thelsdate format anyway, since the ISO 8601 one, or just plain seconds after the epoch are far easier to parse.ls. It's not about what the tool is called, but about having parsable, unambiguous and issue-free output.