Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching for command "stat" 2

Status
Not open for further replies.

andimue

Programmer
Jun 29, 2001
18
DE
Hi,

I need to find out the creation-,modification- and accessdate of a given file. I read in the tek-tips that there must be a command called "stat". On my Solaris 2.8 system I got a man-page for a system-call "stat" but no program. I also know there is a perl-function called stat.
I tryed it and its very "unhandy". Searching at sunfreeware.com was not successfull.
Can please someone tell where I can get the "stat" command?

Thanks everybody

andi
 
you cannot obtain creation time (ctime) ctime, is NOT the files creation date, creation date is not recorded anywhere in the Unix file system:

"mtime" - time the contents of file was last modified (written to).
"atime" - time the file was last used/accessed (read or executed)
"ctime" - time the inode of the file was last changed (like changing permissions), ctime also gets updated every time mtime is modified, but not when the atime is changed.

None of the Unix commands can do this directly, but the information can be easily obtained using the truss command,
to get all 3 time stamps for a file and to output that information:

# touch teste
# truss -vlstat -tlstat ls -l teste
lstat64("teste", 0xFFBEFC98) = 0
d=0x00000002 i=1886769 m=0100644 l=1 u=0 g=1 sz=0
at = Sep 12 02:44:07 WEST 2001 [ 1000259047 ]
mt = Sep 12 02:44:07 WEST 2001 [ 1000259047 ]
ct = Sep 12 02:44:07 WEST 2001 [ 1000259047 ]
bsz=8192 blks=0 fs=tmpfs
-rw-r--r-- 1 root other 0 Sep 12 02:44 teste

Regards,

Carlos Almeida,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top