Login--last*

Source: Internet
Author: User

Small Q: Why hurt so far can also be done, and comfort, but must be in the side. ----Most novel

===========================================================

The last command is used to display the user's most recent logon information. The last command is executed separately, and the/var/log/wtmp file is read by default, and all the user lists of the logged-in system for the contents of the file are displayed;
Btmp can be displayed in more detail, can display remote login
The utmp file holds information about the users currently in the system
Format:
Last [-R] [-num] [-N num] [-adiowx] [-f file] [-t YYYYMMDDHHMMSS] [name ...] [TTY ...]
Options:
-A will log on to the system's host name or IP address, displayed on the last line
-D convert IP address to host name
-f Specifies the record file, the default is to display the records of the Wtmp file under the/var/log directory, but btmp can be displayed in the/var/log directory

Richer and can display remote logins, such as SSH logins, including failed login requests.
-i-i Displays the status of specific IP logins, which are tracked.
-N < Show columns > or-< Show columns > set the number of displayed columns for a list
-R does not display the host name or IP of the login system
-t display information before YYYYMMDDHHMMSS
-X shows the history of system shutdown, user login, and exit

First column: User name
Second column: End position. pts/0 (pseudo terminal) means a remote connection from a user such as SSH or Telnet. TTY (teletypewriter) means a user connected directly to a computer or locally connected
Third column: Login IP or kernel. If you see: 0.0 or nothing, this means that the user is connected via a local terminal. In addition to restarting the activity, the kernel version is displayed in the status.
Fourth column: Start time
Fifth column: End time (still login in has not exited down until normal shutdown crash until shutdown is forced)
Sixth column: Duration
Example:
Show N Records
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7D/8C/wKioL1bqfFPjbc86AABXkt4ltVI901.png "title=" 1.png " alt= "Wkiol1bqffpjbc86aabxkt4ltvi901.png"/>

the IP put it to the last display
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7D/8E/wKiom1bqe9DQUDOJAABa33DbYOI363.png "title=" 2.png " alt= "Wkiom1bqe9dqudojaaba33dbyoi363.png"/>

Specify the/var/log/btmp file to view information about users logged on to the system
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7D/8E/wKiom1bqe9vAkiQ-AAAajj5X-fE315.png "title=" 3.png " alt= "Wkiom1bqe9vakiq-aaaajj5x-fe315.png"/>

Show information prior to YYYYMMDDHHMMSS (20150110093000)
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7D/8C/wKioL1bqfM3DvflpAABwntysKYQ746.png "title=" 4.png " alt= "Wkiol1bqfm3dvflpaabwntyskyq746.png"/>

-------------------------------------------------------------------------------------------------------

The lastb command is used to display a login list of user errors, which can discover the system's logon exceptions. Executes the LASTB command separately, it reads the file in the/var/log directory named Btmp, and displays the list of users who have logged on to the file with a log-in failure.

Format: Lastb [-adrx][-f < record file >][-n < show number of columns >][account name ...] [Terminal number ...]
Options:
-A: Displays the host name or IP address from where the system was logged on to the last line;

-D: Convert IP address to host name;
-F: < record file;: Specify the record file;
-N: < shows the number of columns > or-< display columns;: Sets the number of displayed columns for the list;
-R: Does not display the host name or IP address of the login system;
-X: Displays information such as system shutdown, reboot, and execution level changes.

The first run of the LASTB command will report an error:

LASTB:/var/log/btmp:no Such file or directory perhaps this file is removed by the operator to prevent logging Lastb inf O.

Just create this nonexistent file.
Example:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7D/8E/wKiom1bqfE2RONiZAAAxgAs1dlo246.png "style=" float: none; "title=" 11.png "alt=" Wkiom1bqfe2ronizaaaxgas1dlo246.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7D/8C/wKioL1bqfNuAT-HTAAAPjWH4Kdo720.png "style=" float: none; "title=" 22.png "alt=" Wkiol1bqfnuat-htaaapjwh4kdo720.png "/>

----------------------------------------------------------------------------------------------------

The lastlog command is used to display the most recent logon information for all users in the system. The Lastlog file is queried each time a user logs on. You can use the Lastlog command to check the last logon time for a particular user and format the output of the last logon log/var/log/lastlog. It displays the login name, port number (TTY), and last logon time based on the UID sort. If a user has never logged in, Lastlog displays **never logged**. Note You need to run the command as root.

Format: Lastlog option

Options:

-b< days;: Displays the login information before the specified number of days;

-H: Displays the help information for the call-up order;

-t< days;: Displays login information since the specified number of days;

-u< user name;: Displays the most recent login information for the specified user.
Example:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7D/8C/wKioL1bqe2mBM3EAAAAoOqcAUCg900.png "style=" float: none; "title=" 333.png "alt=" Wkiol1bqe2mbm3eaaaaooqcaucg900.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7D/8E/wKiom1bqetvTv2R1AAAiI9YQPuY075.png "style=" float: none; "title=" 111.png "alt=" Wkiom1bqetvtv2r1aaaii9yqpuy075.png "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7D/8E/wKiom1bqetuSHh2HAAAZx04pUWs289.png "style=" float: none; "title=" 222.png "alt=" Wkiom1bqetushh2haaazx04puws289.png "/>




Login--last*

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.