Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the lastlog command of linux to display the user's last login information

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the use of linux's lastlog command to display the user's last login information, I hope you will learn a lot after reading this article, let's discuss it together!

The lastlog file is queried every time a user logs in. You can use the lastlog command to check when a particular user last logged in and format the contents of the last login log / var/log/lastlog output. It displays the login name, port number (tty), and last login time, sorted by UID. If a user has never logged in, lastlog displays Never logged. Note that you need to run the command as root.

Syntax format: lastlog [parameters]

Common parameters:

-b displays login information before the specified number of days-t displays login information since the specified number of days-u displays the most recent login information for the specified user-h displays help information for the summoning order

Reference example

Displays the last login information for all users in the system:

[root@linuxcool ~] # lastlog

Displays login information for the specified number of days:

[root@linuxcool] # lastlog-b 7

Displays login information for the specified number of days:

[root@linuxcool ~] # lastlog-t 7

Displays the most recent login information for the specified user:

[root@linuxcool] # lastlog-u jaking

Username Port From Latest

Jaking: 0 Tue Apr 9 15:54:58 + 0800 2019 after reading this article, I believe you have a certain understanding of using linux's lastlog command to display the user's last login information. Want to know more about it. Welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report