1.查看/proc/uptime
root@master1565:~# cat /proc/uptime 673.83 1327.68 root@master1565:~# date -d "`cut -f1 -d. /proc/uptime` seconds ago" Mon Apr 9 09:36:31 CST 2018 root@master1565:~# date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S" 2018-04-09 09:36:31
推荐简单明了
date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
2. who 命令查看
who -b 查看最后一次系统启动的时间。who -r 查看当前系统运行时间
root@master1565:~# who -b system boot 2018-03-30 23:20 root@master1565:~# who -r run-level 5 2018-03-30 23:20
3. last reboot 可以看到Linux系统历史启动的时间
root@master1565:~# last reboot reboot system boot 4.4.0-116-generi Mon Apr 9 09:36 still running reboot system boot 4.4.0-116-generi Mon Apr 9 09:32 - 09:36 (00:03) wtmp begins Sun Apr 1 21:24:06 2018
查看最后一次Linux系统启动的时间
root@master1565:~# last reboot | head -1 reboot system boot 4.4.0-116-generi Mon Apr 9 09:36 still running
4.TOP命令查看
root@master1565:~# top
5.w命令查看
root@master1565:~# w
6.uptime 命令查看
root@master1565:~# uptime