Visit Our UNIX and Linux User Community

Equalent of Linux "stat" in AIX

Thread Tools Search this Thread
Operating Systems AIX Equalent of Linux "stat" in AIX
# 1  
Old 09-13-2012
Equalent of Linux "stat" in AIX

i would like to know the equivalent of
stat -c %Y <file>

command in AIX.

i tried "

" but its not giving the epoch time and also tried with perl

perl -le'printf "%o", 07777 & (stat)[2] for @ARGV' <file>

it not also provding the timing .

if you have any other suggestion to get the time in seconds of the file from the current time , pls help me out ..

Thanks in Advance .

Last edited by expert; 09-13-2012 at 03:57 AM.. Reason: Code tags re-formatted
# 2  
Old 09-13-2012
Originally Posted by expert
i tried "istat" but its not giving the epoch time
"istat" is displaying the mtime, atime and ctime down to the seconds.

You can easily calculate the epoch time from a given date: POSIX.1 defines it as the seconds passed since Jan 1st, 1970, 0:00:00. The following additional rules apply:
  • leap seconds are not taken into account, each day is exactly 86400 seconds
  • leap years are: all years divisible by 4, save for the years divisible by 100 but not by 400
  • notice that non-synchronous NTP time is NOT POSIX-compatible

Many systems in fact are not POSIX-compatible in this regard, because they use Mills-algorithm-based NTP Stratum-2-servers.

I hope this helps.

# 3  
Old 09-13-2012
thanks for the information Bakunin ! !
since both file timing are going to be incorporate the above, i dont think this is going to be OK to use.

but my question is how we can do that in AIX.
# 4  
Old 09-13-2012
perl -e ' $mtime = (stat("$ARGV[0]"))[9]; printf("%d", $mtime); ' filename

try without octal numbers.

Previous Thread | Next Thread
Test Your Knowledge in Computers #976
Difficulty: Medium
In April 2014, Linus Torvalds banned Kay Sievers from submitting patches to the Linux kernel for failing to deal with bugs that caused systemd to negatively interact with the kernel.
True or False?

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Is "stat: illegal option -- -" an issue with hyphenated filename or flag problem?

Hi. I'm trying to install VMWare Workstation to run a virtual machine on my Mac OS, but running the bundle from bash(xterm) sh VMware-workstation-Full-11.0.0-2305329.x86_64.bundle (as suggested in install guide) comes up with error:stat: illegal option -- - usage: stat Digging... (5 Replies)
Discussion started by: defeated
5 Replies

2. AIX

How to enable "TCP MD5 Signatures" and "https" on AIX?

I have searched many times but nothing found. Somebody help please :(:(:( (1 Reply)
Discussion started by: bobochacha29
1 Replies

3. UNIX for Advanced & Expert Users

AIX - io info get from "libperfstat" not match "iostat"

Hi, everyone. I need to write a program to get io info based on libperfstat. But the "write time" of a disk is just half of the value get from iostat. I'm confused and can't explain. Help please. How I calculate "write service time per sec": In iostat: write service... (0 Replies)
Discussion started by: jackliang
0 Replies

4. Shell Programming and Scripting

Intermittent "cp: cannot stat" error with nested loop

I have a bash script that has been running (on SUSE 9.3) dozens of times over the past couple of years without error. Recently it has been hitting intermittent “cp: cannot stat FILE: No such file or directory” errors. The script has nested loops that continuously process files in a... (2 Replies)
Discussion started by: jcart
2 Replies

5. Shell Programming and Scripting

Ignoring mv commands "cannot stat" error ?

So, my third thread here ^^ and still asking questions. Thanks for you patience and help, I really appreciated it ;) I currently use a shell script to move folders of songs from one to another location on my harddrive. I use something like this: sudo mv /var/mobile/Media/"My Music"/"Vasco... (3 Replies)
Discussion started by: pasc
3 Replies

6. Solaris

How to resolve error "INIT: Cannot stat /etc/inittab, errno: 2"

Hi All, I am getting an error message when I execute command “zlogin -C sunsrv4z5” on my root server. INIT: Cannot stat /etc/inittab, errno: 2 INIT: Cannot stat /etc/inittab, errno: 2 As per my analysis it seems that some files inside /etc folder are deleted. This server was... (14 Replies)
Discussion started by: surbhit4u
14 Replies

Featured Tech Videos