Linux (17) View several commands for user login history

Source: Internet
Author: User

1.last, the default read is the/var/log/wtmp file content, showing the user login history and System restart history

-N #: Displays information about recent # times

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/84/4F/wKiom1eMmdKhn_XTAAHCM0K2_Qc596.jpg-wh_500x0-wm_3 -wmp_4-s_4000073811.jpg "title=" 1.jpg "alt=" Wkiom1emmdkhn_xtaahcm0k2_qc596.jpg-wh_50 "/>

2.LASTB, the default is to read the contents of the/var/log/btmp file, showing the user's wrong way of landing

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/84/4F/wKiom1eMmjjw-NSAAAJEA55cUGQ915.jpg-wh_500x0-wm_3 -wmp_4-s_2741250454.jpg "title=" 2.jpg "alt=" Wkiom1emmjjw-nsaaajea55cugq915.jpg-wh_50 "/>

3.lastlog: Displays the last successful login information for each user;

-U USERNAME: Displays recent login information for a specific user

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/84/50/wKiom1eMmvyRkLBkAAF8wKNBoIg063.jpg-wh_500x0-wm_3 -wmp_4-s_2116241765.jpg "title=" 1.jpg "alt=" Wkiom1emmvyrklbkaaf8wknboig063.jpg-wh_50 "/>

4.who Show users who are logged in

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/84/50/wKioL1eMm6ag4T1VAAB56NOTS5M803.jpg-wh_500x0-wm_3 -wmp_4-s_3237816354.jpg "title=" 1.jpg "alt=" Wkiol1emm6ag4t1vaab56nots5m803.jpg-wh_50 "/>

Test if a user is online if who | grep username&>/dev/null;then

echo "Online"


This article is from the "thick Product Thin Hair" blog, please make sure to keep this source http://joedlut.blog.51cto.com/6570198/1827455

Linux (17) View several commands for user login history

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.