Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the last command on Linux system

Shulou Source: shulou.com Published: 2022-06-01 20:08:25 09月15日 Update

Editor to share with you how to use the last command of the Linux system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Last is a command-line tool that displays information about the last login session of the system user. This command is very useful, especially if you need to track user activity or investigate a possible security breach.

Syntax shell > > last [options] parameter description:

-R omits the hostname field

-num before num presentation

Username displays login messages of username

Tty restriction login message includes terminal code

Example shell > > last-R-2johnney pts/1 Mon Aug 14 20:42 still logged injohnney pts/0 Mon Aug 14 19:59 still logged inwtmp begins Tue Aug 1 09:01:10 2000 # / var/log/wtmpshell > > last-2 mineryminery pts/0 140.119.217.115 Mon Aug 14 18:37-18:40 (00:03) minery pts/0 140.119.217.115 Mon Aug 14 17:22-17:24 wtmp begins Tue Aug 1 09:01:10 2000 General display method

# last brief display, and specify the number of displays

# last-n 5-Rroot pts/4 Thu May 13 17:25 still logged in root pts/2 Thu May 13 17:23-17:25 (00:02) root pts/1 Thu May 13 16:46 still logged in root pts/7 Thu May 13 15:36 still logged in root pts/9 Thu May 13 15:35 still logged in wtmp begins Thu May 13 18:55:40 2014 shows the last column showing the host IP address

# last-n 5-a-iroot pts/4 Thu May 13 17:25 still logged in 192.168.1.10root pts/2 Thu May 13 17:23-17:25 (00:02) 192.168.1.10root pts/1 Thu May 13 16:46 still logged in 192.168.1.10root pts/7 Thu May 13 15:36 still logged in 192.168.1.10root pts/9 Thu May 13 15:35 still logged in 192.168.1. 10wtmp begins Thu May 13 18:55:40 2014 is all the content of the article "how to use last commands in Linux system" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Commands systems articles content users messages abbreviations security not so many numbers hosts codes messages parameters addresses most instances tools methods more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Tech Info macOS OPPO Reno Docker