1

This question already has an answer here:

I’m looking for a command on AIX 7.1 that can give me filenames, size, and complete date/time (in a uniform format).

  • ls -l and similar commands have the drawback that they give date (month and day) and time (hour and minute), if the file is not older than 6 months, and date and year otherwise.  (I want year, month, day, hour, minutes and seconds for all files.)
  • The AIX version of ls does not support --full-time, reporting

    ls: Not a recognized flag: -
    ls: Not a recognized flag: -
    Usage: ls [-1ACFHLNRSabcdefgiklmnopqrstuxEUX] [File...]
    

What command that exists on AIX will give me the full date/time, in a consistent format, and the file size?

marked as duplicate by Stephen Rauch, Romeo Ninov, Stéphane Chazelas files Oct 14 '17 at 12:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Does AIX have the stat command? Have you looked closely at the capabilities of find? – Scott Oct 14 '17 at 4:32
  • Could you tell the syntax once – surya amala Vungarala Oct 14 '17 at 4:32
  • If you don't have stat, you could just print it up with perl or similar. Example: perl -le 'print scalar localtime ((lstat "filename")[9])' – BowlOfRed Oct 14 '17 at 5:29
  • See also: unix.stackexchange.com/a/291183/117549 – Jeff Schaller Oct 14 '17 at 11:53
1

Indeed, istat appears to solve your problem; from the man page:

$ istat /usr/bin/ksh

Inode 10360 on device 10/6    File
Protection: r-xr-xr-x
Owner: 2(bin)     Group: 2(bin)
Link count: 2     Length 372298 bytes

Last updated:  Wed May 13 14:08:13 1992
Last modified: Wed May 13 13:57:00 1992
Last accessed: Sun Jan 31 15:49:23 1993

... gives the file size and full timestamps.

1

Both istat and perl may be of help:

#!/usr/bin/env bash

echo
rm -f f1
touch f1

echo
echo " With perl:"
perl -e '@d=localtime ((stat(shift))[9]); printf "%02d-%02d-%04d %02d:%02d:%02d\n", $d[3],$d[4]+1,$d[5]+1900,$d[2],$d[1],$d[0]' f1

echo
echo " With istat:"
istat f1

producing:

$ ./s1


 With perl:
14-10-2017 14:26:01

 With istat:
Inode 1371634 on device 45/3    File
Protection: rw-r--r--   
Owner: 1296(drl)                Group: 100(usr)
Link count:   1         Length 0 bytes

Last updated:   Sat Oct 14 14:26:01 DFT 2017
Last modified:  Sat Oct 14 14:26:01 DFT 2017
Last accessed:  Sat Oct 14 14:26:01 DFT 2017

On a system like:

aix 7.1.0.0
istat - ( /usr/bin/istat, Aug 08 2010 )
perl 5.10.1

Best wishes ... cheers, drl

( With advice from http://www.unix.com/shell-programming-and-scripting/41325-command-get-file-timestamp-including-seconds-aix-5-3-a.html )

Not the answer you're looking for? Browse other questions tagged or ask your own question.