在 Ubuntu 系统中,你可以使用多种方法来查看当前的时间戳。以下是几种常用的方法:
使用 date
命令:
date +%s
date +%s%3N
使用 python
脚本:
如果你安装了 Python,可以使用以下命令来获取当前的时间戳:
python3 -c 'import time; print(int(time.time()))'
使用 perl
脚本:
如果你有 Perl 安装,也可以通过以下命令获取时间戳:
perl -MTime::HiRes -e 'printf("%d\n", Time::HiRes::time())'
这些方法都会返回自 Unix 纪元(1970-01-01 00:00:00 UTC)以来的秒数。根据需要选择合适的方法即可。