Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells

Getting Epoch Time on Solaris 10 and Older

Submitted by on September 8, 2014 – 3:57 pm

You can get the epoch time on Solaris 11 and Linux simply by running the date command:

date +'%s'

On Solaris 10 and older, you need to get creative:
/usr/bin/truss /usr/bin/date 2>&1 | nawk -F= '/^time()/ {gsub(/ /,"",$2);print $2}'

If you have to do this often, I’d suggest creating a shell script with this string and adding a soft link in /usr/bin

Print Friendly, PDF & Email

Leave a Reply