Reputation: 1927
What command can I use in linux to display the time in unix format i.e. no of seconds since epoch (01/01/1970)?
Upvotes: 3
Views: 12878
Reputation: 6239
GNU and BSDs:
date +%s
With most Awk implementations:
awk 'BEGIN{srand(); print srand()}'
Probably the most portable out of Linux:
perl -le 'print time'
With shell builtin, ksh93 or Bash 4.1 or above:
printf '%(%s)T'
With shell builtin, zsh:
zmodload zsh/datetime
echo "$EPOCHSECONDS"
Upvotes: 4