You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于last命令中负登录时间含义的咨询

关于last命令中负登录时间含义的咨询

Hey there! I’ve dealt with this weird last command behavior before, so let me walk you through what’s going on.

When you see a negative time value in the last output, it usually boils down to one of two common scenarios:

  • System clock was adjusted recently: If someone (or a script) changed the system time to an earlier point, any active user sessions that were supposed to end at a "future" time (before the clock rollback) will show up with a negative duration. For example, if you set the clock back 10 minutes while a user is logged in, their session time will display as -00:10.
  • Abnormally terminated sessions: Sometimes when a user’s connection drops abruptly (like a sudden network outage) or their terminal process gets force-killed, the system fails to properly record the session end time. This can mess up the duration calculation, resulting in a negative value.

Here’s what that might look like in your last output:

jane pts/2 192.168.0.45 Thu Oct 12 09:15 still logged in (-00:07)

A quick way to troubleshoot:

  • Run date to check your current system time, then hwclock --show to compare it with the hardware clock—if they don’t match, that’s likely the culprit.
  • Use the who command to list currently active users. If a session showing a negative time in last doesn’t appear in who, it’s probably a leftover from an abnormal disconnect.

备注:内容来源于stack exchange,提问作者3088 K

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 08:27:58