subject – print file date on solaris as format: yymmdd ( yy – year , mm – month , dd – day )
on Linux machine I type the following command in order to get: file date
as the following:
ls -l --time-style=+%Y%m%d /etc/hosts | awk '{print $6}'
20121107
.
please advice what the syntax for Solaris ? , because I get error when I try to run it on Solaris:
.
ls -l --time-style=+%Y%m%d /etc/hosts
ls: illegal option -- time-style=+%Y%m%d
Best Answer
The command you are looking for should be:
ls -l -T -D %Y%m%d /etc/hosts
Hope it helps!
Another optino is to use
stat
asstat /ets/hosts
See another solution https://stackoverflow.com/questions/1839877/how-can-i-get-files-modification-date-in-ddmmyy-format-in-perl