$ date // 显示当前日期
$ time // 显示程序运行的时间
$ hwclock // 显示与设定硬件时钟
$ clock // 显示与设定硬件时钟,是hwclock的链接文件
$ cal // 显示日历
(1)date 显示或设置当前日期时间
$ date 显示当前日期时间 -- 中国北京时间 CST China Standard Time UTC+8:00
2008年 05月 01日 星期四 04:28:27 CST
$ date ?u 显示当前日期时间 -- 世界标准时间 UTC
2008年 04月 30日 星期三 20:29:23 UTC
以上两个时间相比有8个小时的时差
$ date ?R 显示当前日期时间 ? RFC格式
Thu, 01 May 2008 04:30:25 +0800
$ date -s 20080501 设置日期
$ date -s 20:40:30 设置时间
(2)time 显示程序运行时消耗的实际时间,用户CPU时间和系统CPU时间。
$ time a.out 可执行程序a.out
real 0m10.081s 程序开始运行到结束的时间
user 0m0.000s 用户CPU时间
sys 0m0.004s 系统CPU时间