Convert Unix time to human readable time

$ date; date +%s; date -d @$(date +%s)
Fri Jul 14 20:56:42 UTC 2017
1500065802
Fri Jul 14 20:56:42 UTC 2017

Display date and time

date
Fri Jul 14 20:58:12 UTC 2017

Display Unix time

date +%s
1500065900

Convert to human readable time

date -d @1500065900
Fri Jul 14 20:58:20 UTC 2017
Advertisements

How to perform floating operations with bc?

[vagrant@localhost ~]$ echo 31/2 |  bc
15
[vagrant@localhost ~]$ echo 31/2 |  bc -l
15.50000000000000000000
[vagrant@localhost ~]$ bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
31/2
15.50000000000000000000