在 Ubuntu 系统中,你可以使用多种方法来获取当前的时间戳。以下是一些常用的方法:
使用 date
命令:
date +%s
date +%s%3N
使用 python
脚本:
如果你安装了 Python,可以使用以下命令获取时间戳:
python3 -c 'import time; print(int(time.time()))'
python3 -c 'import time; print(int(time.time() * 1000))'
使用 perl
脚本:
如果你安装了 Perl,也可以用来获取时间戳:
perl -e 'print time(), "\n"'
perl -e 'printf("%d\n", time() * 1000)'
这些方法都可以有效地获取系统当前的时间戳,选择你觉得最方便的方式即可。