last is a built-in tracking tool for Linux system, can list the relevant information of the login user, run through the input, do not need to install independently, the following small series will give you a detailed description of the use of the last command Introduce so that you have an understanding.
function last command is what
last show is from /var /log /wtmp file was created since all users log in (and out) of. This file is a binary file that cannot be viewed by a text editor such as vi, Joe or other software. This is very useful because the user (or root) cannot modify this file as they wish.
last gives the username, tty, IP address of all logged in users (if the user is a remote connection), date-time, and the time the user has logged in.
How to run last
Just type last in the console. Here is an example:
$ last
leni pts/0 10.0.76.162 Mon Dec 2 12:32 - 13:25 (00:53)
pungki tty1 Mon Dec 2 09:31 still logged in
reboot system boot 2.6.32-358.23.2 Mon Dec 2 09:20 - 13:25 (04:05)
Here's how to read last information :
The first column tells the user who is
The second column gives information on how the user is connected
pts/0 (pseudo-terminal) means from something like SSH or Telnet remote connection users
tty (teletypewriter) means direct connection to a computer or locally connected user
In addition to restarting activities, all statuses are displayed at startup
The third column shows where the user came from. If the user is from a remote computer, you will see a hostname or IP address. If you see: 0.0 or nothing, this means that the user is connected through the local terminal. In addition to the restart activity, the kernel version is displayed in the state.
The remaining columns show when the log activity occurred. The numbers in parentheses tell us how many hours and minutes the connection lasted.
Some examples of last in everyday operations
Limit the number of rows displayed
When you have a lot of lines to display, you can limit the number of rows you want to see. . Use the -n parameter to do this.
$ last -n 3
leni pts/0 10.0.76.162 Mon Dec 2 12:32 - 13:25 (00:53)
pungki tty1 Mon Dec 2 09:31 still logged in
reboot system boot 2.6.32-358.23.2 Mon Dec 2 09:20 - 13:25 (04:05)
-n parameter will make last display 3 records from the current time to the future.
Do not display hostnames
Use the -R parameter to do this. Here is an example:
$ last -R
leni pts/0 Mon Dec 2 12:32 - 13:25 (00:53)
pungki tty1 Mon Dec 2 09:31 still logged in
reboot system boot Mon Dec 2 09:20 - 13:25 (04:05)
As you can see, there is no host or IP address now. The information is gone.
The last column shows the hostname
To do this, we use the -a parameter
$ last -a
leni pts/0 Mon Dec 2 12 :32 - 13:25 (00:53) 10.0.76.162
pungki tty1 Mon Dec 2 09:31 still logged in :0.0
reboot system boot Mon Dec 2 09:20 - 13 :25 (04:05) 2.6.32-358.23.2.el6.i686
Now host information such as 10.0.76.162 will be placed in the last column.
Show full login logout date
For this, you can use the -F parameter. This is an example:
$ last -F
leni pts/0 10.0.76.162 Mon Dec 2 12:32:24 2013 – Mon Dec 2013 13:25:24 2013 (00: 53)
Printing a specific username
If you want to track a specific user, you can print it specifically. Enter the username after the last command.
$ last leni
leni tty1 Mon Dec 2 18-42 still logged in
leni pts/0 Mon Dec 2 12:32 - 13:25 (00:53 10.0.76.162
Or you want to know when the reboot is complete, you can also display it like this:
$ last reboot
reboot system boot Mon Dec 2 09: 20 - 16:55 (07:34)
reboot system boot Sun Dec 1 04:26 - 04:27 (00:01)
reboot system boot Wed Nov 27 20:27 - 01:24 (04:57)
reboot system boot Tue Nov 26 21:06 - 06:13 (09:06)
Print specific /pts
last same You can print information about a specific tty/pts. Just enter the tty name or pty name after the last command.
Previous12Next Total 2 Pages
Many friends have experienced serious fever problems after installing Ubuntu 12.04
Linux logs can be created by the user or automatically created by the system. The Linux log records
Users who are still having trouble installing Bumblebee for Ubuntu notebooks have a
Linux system, when using the virtual machine VirtualBox to install Windows 8.1, prompt 0x000000C4 er
Learn about the role of Linux mail commands through examples
The most detailed Linux compression decompression command
Linux method to modify the PATH path summary
Linux to view Oracle related process methods through ps command
Steps to install KVM virtual machine in CentOS5.5
How to brush the original Debian system in the set-top box
After the Ubuntu program is updated, the WiFi icon is not displayed properly. How to solve it?
How to install the whois command on the CentOS system
How to initialize the CentOS server
CentOS open Eclipse error Failed to load the JNI shared how to solve?
How to turn off Win8 graphics hardware acceleration?
Where is the WinXP search? How to find a search
Win8 system prompts to configure windows update failure is restoring changes to the solution
Win7 boot black screen prompt "explorer can not start uxtheme.dll lost" solution
Win8 IE10 Flash can not open the solution
Close the small method of win8.1 help tips
After uninstalling Win7, how to delete Win7 boot menu
Teach you to easily solve the problem of delay after XP startup.