List file creation time in seconds in Solaris

sun0 used Ask the Experts™
Hi Solaris Experts,

When I do "ls", there is no seconds displayed:
# ls -l abc
-rw-r--r--   1 root     root           0 Jan 29 14:36 abc

How could I get the seconds to be displayed as well please?

Thanks a lot!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The normal 'ls' command won't give you seconds, but GNU ls will:

# gls -l --full-time /.bashrc
-rw-r--r-- 1 root root 422 2008-03-06 17:06:02.857741000 -0800 /.bashrc

If you need to install GNU ls, look for the "coreutils" package at (

You can also use a perl command, such as this:
# 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]'  /.bashrc
06-03-2008 17:06:02

Top Expert 2007
You can use perl, eg:

 perl -MPOSIX -e 'print strftime "%Y-%m-%d %T\n",localtime(((stat(shift))[9]))' filename

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial