上一篇
⏰ 时间管理 | 命令行工具 | Linux查询时间常用方法与操作指南
计划任务
cron
at
时间日志
番茄钟
date
timedatectl
hwclock
cal
time
系统时间
时区设置
时间同步
UTC/GMT
时间戳转换
查看当前时间
date # 显示系统时间(含时区) date +"%Y-%m-%d %H:%M:%S" # 自定义格式
时区管理 🌐
timedatectl list-timezones # 列出所有时区 sudo timedatectl set-timezone Asia/Shanghai # 设置时区
硬件时钟 vs 系统时钟 ⚙️
hwclock --show # 查看硬件时钟(BIOS时间) sudo hwclock --systohc # 同步系统时间到硬件
时间同步 🔄
sudo timedatectl set-ntp true # 启用NTP自动同步 ntpdate pool.ntp.org # 手动同步(需安装ntpdate)
计划任务工具 ⏳
crontab -e
) * * * * * /path/to/script.sh # 每分钟执行
echo "shutdown -h now" | at 23:00 # 今晚23点关机
趣味小工具 🎯
cal -3 # 显示上月/本月/下月日历 time ls # 统计命令执行时间
date -d @1620000000 # 时间戳→日期 date +%s # 当前时间戳
sleep 1500 && notify-send "休息时间到!🍅"
📅 最后更新参考:2025-08
本文由 纳喇晓兰 于2025-08-02发表在【云服务器提供商】,文中图片由(纳喇晓兰)上传,本平台仅提供信息存储服务;作者观点、意见不代表本站立场,如有侵权,请联系我们删除;若有图片侵权,请您准备原始证明材料和公证书后联系我方删除!
本文链接:https://vps.7tqx.com/wenda/514954.html
发表评论