The last of Linux shell induction

Source: Internet
Author: User

How to use:

Format 1:last-n

N Specify the number of accounts, the latest first n login information (user, terminal, IP, date, time and duration)

Format 2:last-n <number of the latest account>

Purpose: In daily work, if you want to troubleshoot the most recent years who are or have logged in, learn about the information including (user, terminal, IP, date, time and duration).

Example 1: Show the top 5 accounts logged in recently

> last-5

test     pts/3         122.20.30.233    Mon oct  6 10:24   still logged in  

test     pts/2        122.20.30.233     Mon oct  6 10:23   still logged in  

test  & nbsp;  pts/2        122.20.30.233    Mon Oct  6 10:21-10:22  (00:00)    

test     pts/1         122.20.30.233    Mon oct  6 10:18   still logged in   

test     pts/1         122.20.30.233    Wed oct  1 14:59-09:49  (18:49)  

> Last-n 5

Test PTS/1 122.20.30.233 Tue Oct 7 13:45 still logged in

Test PTS/2 122.20.30.233 Mon Oct 6 13:35-18:14 (04:38)

Test PTS/3 122.20.30.233 Mon Oct 6 10:24-11:23 (00:59)

Test PTS/2 122.20.30.233 Mon Oct 6 10:23-11:23 (00:59)

Test PTS/2 122.20.30.233 Mon Oct 6 10:21-10:22 (00:00)

As you can see from the above results, there is a total of 4 columns, with spaces between each column.

    • 1th column: Test, which represents the user name
    • The 2nd Column: psts/0, represents pseudo terminal or virtual terminal, the concrete manifestation is you open a terminal, this terminal is called pts/0, if you open a terminal again, this new terminal is called PTS/1

For example: Open the first session window (PST/1), the Second session window (PST/2), then close the second session window, then open the second session (PST/2), and open a third session Window (PST/3). such as:

    • The first session of WINDOW:PST/1
    • A second session WINDOW:PST/2
    • A third session WINDOW:PST/3

    • The 3rd column: the IP address of the user login machine
    • 4th Column: Login time, exit time and duration
      • If the user has logged in, but has now exited: Thu Sep 25 11:23-23:34 (2+12:11)
      • If the current user is logged in, but does not exit the conversation: Sun Sep 09:52 still logged in

The last of Linux shell induction

Related Article

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.