Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [last]

`last` is a command that shows a listing of the last logged in users.

0
votes
0answers
24 views

Output of last is missing “display” column

I have a script parsing the output of last on several OpenSuse Leap machines. Everything is right except on one, and the reason is that on that machine the output is missing the column where the ...
0
votes
1answer
35 views

What causes multiple simultaneous shut down times in 'last' command output?

I am troubleshooting some outage issues on a server, with the suspicion that the server is restarting intermittently. When I run the last command, I see the following output (I added line numbers for ...
0
votes
0answers
59 views

User Lastlog login datetime did not update

I use lastlog to check latest login datetime. Here are steps I use to update my latest login datetime. 1) Try to Login to that user sudo su userA 2) Exit that user and login to root then check ...
0
votes
2answers
65 views

Get time of the last session in seconds

I'm getting the time of the last session of an specific user using the last command like below: last -aiF -n 1 fakeuser The output of this command is something like: fakeuser pts/0 Tue Nov 27 11:...
0
votes
1answer
47 views

How can I write a shell script to filter the last command?

I want to write a script for login statistics. I want to count how many times a user logged in, and then display them in ascending, or descending order, given by the end user. The problme being, i don'...
0
votes
2answers
30 views

how can i make 'last -n' return just the n lines of users?

I wrote this simple awk program: last -n 10 | awk'{print "username: " $1}' I was surprised when i got the following output: > username: someUsername1 > username: someUsername2 > username: ...
1
vote
2answers
70 views

MacOS: What file does the command `last` get its information from?

Can't seem to find where this last command gets its information from. Does anyone know what file it uses (specifically for Unix macOS) ? Tried cat /var/log/wtmp, cat /var/run/utmp, cat /var/log/...
1
vote
4answers
3k views

how to find lastlog details in solaris

I need the equivalent command of linux lastlog in solaris, need to write a script to find the the users last login date and time in solaris servers. Linux its very easy to fetch using lastlog command. ...
2
votes
2answers
57 views

Does a shortcut exist to auto scroll to the top of a command response in terminal?

Is there a shortcut (keyboard) to automatically scroll back to the beginning of a response to a command? Example: I open the terminal and type the 'last' command and press enter. A long lost of ...
1
vote
1answer
216 views

Grep regex not working [duplicate]

So I'm creating a simple grep command that gets only the last logged in people who's username starts with 161 and has 3 digits next to it: last | grep "^161[0-9]{3}" However it doesn't print ...
2
votes
1answer
269 views

How to make `last` shows also suspend/resume times?

I have notebook and want to store information for every day, when computer is running or not (with precise to minutes). Here is output from last command: dima tty1 :0 Sat ...
1
vote
0answers
978 views

Any difference between a reboot vs. shutdown/restart on AIX?

Is a reboot functionally different than performing a shutdown/restart on AIX servers? If they are the same, why are the timestamps different between the 'last system boot' and 'last reboot'? $ who -...
0
votes
1answer
219 views

Using if/else statement in awk

Normally I can detect user's last logon time if last return anything via below function. My question is : if last doesn't return anything then I want to look in the user's home directory date and ...
1
vote
0answers
52 views

Ignore certain hosts in last log

I have an ansible job that uses ssh to perform tasks on many servers. It uses an authorized key to gain entry. When I run the last command it just shows a long list of root logins from the ansible ...
0
votes
1answer
784 views

What is the meaning of “crash” from the output of the last command?

What is the meaning of "crash" from the output of the last command? root pts/0 mastrt03 Wed Jan 24 11:54 - crash (07:12) We have couple of lines with "crash" on our mastrt03 machine.
0
votes
1answer
3k views

Debian - two entries in `last reboot` in `still running`

What can be a reason for last -x reboot showing two last entries as still running? Besides, I'm pretty sure I did not reboot this server December, 16, though it could be something with power on ...
3
votes
1answer
377 views

What is the purpose of the 10th column of the `last` command's output?

I see a suspicious pattern in a last command output on RHEL: $ last reboot reboot system boot 3.10.0-514.21.1. Wed Dec 13 10:25 - 11:53 (01:28) reboot system boot 3.10.0-514.21.1. Mon Oct ...
1
vote
0answers
30 views

Command ‘last’ - problems [duplicate]

I have this problem using the command ‘last’. My task is to find names of people, that have been logged in at night hours (22:00 - 5:00). So I’ve tried to save the first number (22) to a variable and ...
5
votes
1answer
443 views

Understanding the output of last reboot shutdown

When I use the command last -x reboot shutdown I get an output like this: reboot system boot 2.6.32-279.14.1. Tue Jul 18 22:03 - 03:20 (05:17) shutdown system down 2.6.32-279.14.1. Tue Jul 18 ...
3
votes
0answers
459 views

What could 'unknown' user in the output of the `last` command mean?

Occasionally I will see an odd entry like this one in my last ouput: (unknown :0 :0 Tues Jul 4 06:51 - 06:51 (00:00) Afaik, this should not happen ever, and I cannot find ...
2
votes
1answer
69 views

LinuxMint - `who`, `w` and `last` don't report terminal-emulators anylonger

I'm running an up-to-date version of LinuxMint (an Ubuntu-fork), and I've noticed that who, w and last have all stopped registering activity on terminal-emulators (like xterm) - eg. if you open a ...
4
votes
1answer
694 views

utmp, wtmp and btmp: what is the 'tmp'

From the earlier question: why are utmp, wtmp and btmp called as they are? I would like to now what the 'tmp' part is. Is it 'temp/temporary'. As you can see from the earlier question, that part ...
1
vote
1answer
145 views

Why do I get this at the end of a `last` command?

When I run the last command on one of my Raspberry Pi's running Raspbian I get this at the end: wtmp begins Thu Jan 1 01:00:01 1970 When I run the last command on a proper operating system, such as ...
1
vote
0answers
60 views

Last users logged in the past 30 minutes

I used this command in ubuntu to find the last ussers logged in the past 30 minutes: last -s -30m --fullnames |head -n -1|awk '{print $1}' | sort -u I need the equivalent for Centos 7. For CentOS ...
2
votes
0answers
37 views

How to view users logged in since last 5 minutes in linux command line? [duplicate]

I am fairly new to linux and trying to learn the terminal commands. I want to see the list of users who logged in since last 5 minutes. I searched the internet but almost every place solution uses a ...
1
vote
1answer
310 views

last reboot -F shows overlapping timespans

I just found some odd behaviour on one of our servers that I can't explain myself. It is about both middle lines. I would assume that the timespans for the boot user must not overlap, however, they do:...
1
vote
0answers
456 views

Why is there a difference between the last and lastlog command records, and why is there no recent login record for user in lastlog records?

While testing the last command on my system I got the following result and could not make sense of the lines with down and crash at their ends, as all seem to be connected to a tty7 login: george ...
1
vote
2answers
603 views

last - user reboot - logged-in period

I have the following lines extracted from the output of last. It shows two reboots, and that userA was logged in right up to the reboot. So far, I am able to interpret the data. However, what I do ...
0
votes
1answer
111 views

how to read ssh output from 'last' and 'who' command

I have just used the command 'last' to see who has logged into my server. I am unsure how to read some of the output, particularly in Column 2 where it states pts/l and :0. Instead of spoon feeding ...
0
votes
1answer
828 views

last reboot in local time zone?

Is there a way to tell this command to output the data in local time (not UTC)? last reboot Version: last --version last von util-linux 2.27.1
1
vote
0answers
53 views

Lots of ftpdxxx users on last command

When I execute "last" command to see users that have logged on my system, I have many connections like these: ftp ftpd28575 66.249.66.179 Thu Aug 11 20:41 - 20:42 (00:00) ftp ...
0
votes
1answer
296 views

Does “last” command in linux reset after a specific amount of time?

I maintain a Debian multipurpose server and I'm the sole admin. I execute the lastcommand every time I ssh into the server to check if I recognize every user who have used its service and if they're ...
0
votes
1answer
52 views

running “last” printed suspicious output

I invoked last from bash on my personal computer and I have this output user pts/2 :0 Wed Jul 27 09:15 still logged in user pts/1 :0 Wed Jul ...
1
vote
2answers
5k views

How to find Directories that updated last day in linux?

I have a problem, like I need to find the directories that got updated yesterday. I tried using find command but its listing all the files that got updated in the directories. But I need only the ...
1
vote
0answers
58 views

Send new login & logout logs to a database

I want to know how to send new login and logout logs to a database. I know that last command outputs the "lasts" login info. But, I found the following problems: How to filter to only get new logs? ...
0
votes
1answer
336 views

The last log for reboot appeared twice

Does anyone know what's the meaning of my last command? reboot system boot 2.6.32-431.11.2. Sat May 28 15:06 - 05:01 (1+13:54) reboot system boot 2.6.32-431.11.2. Sat May 28 05:03 - 05:01 (1+23:...
1
vote
1answer
29 views

Logins in an interval?

How can I get who was logged in in an interval? I tried last -t, but it was not what I was looking for. I want to get who was logged in between May 11. 10:00:00 and May 15. 22:00:00 for example.
0
votes
1answer
1k views

ssh PrintLastLog prints actual login

I connect with my server via ssh and always it shows the last log: Last login: Sat Mar 19 14:05:17 2016 from... but that login is my actual login. What's the utility of this info? It should print the ...
2
votes
2answers
303 views

`last` alternative showing logins only for current user

I'm aware that I can use last $USER, however this won't work correctly or securely on machines with many users - no user should know another users IP or when they logged in. Is there a known solution ...
-1
votes
2answers
4k views

How to lists all users who logged in on a specific day using grep and last

I need to write a command or sequence of commands that lists all users who logged in on a monday by using last and grep. I came up with this but it didnt work: grep -i /var/log/wtmp | last -t ...
1
vote
0answers
112 views

Last reboot shown few rows at the same time?

I had got this from my server logs. I wonder what does it mean by that? ("Last reboot", The repetition of the same day and time) reboot system boot 3.13.0-35-generi Fri Jul 10 17:15 - 12:06 (18:...
2
votes
2answers
7k views

How to find out last run time of shell script?

I am trying to find out at what time the shell script ran last time within the shell script. I tried: ls -laru ls -lart but all these commands give me the last modified time and last accessed ...
3
votes
1answer
4k views

Difference between last and lastlog?

last | grep IPADDRESS doesn't shows any line, but: lastlog | grep IPADDRESS does. Why?
-2
votes
1answer
94 views

How do I get a list of users that are not on the last command? (Not logged in recently)

I need a list of users that I cannot find by using the last command (i.e. they were not logged in recently). Would a temporary file be useful for this?
4
votes
1answer
359 views

Where does 'last' store user hostnames?

I was looking into: 'last -d' command. -d: For non-local logins, Linux stores not only the host name of the remote host but its IP number as well. This option translates the IP number back into a ...
0
votes
0answers
102 views

Seems that my router accessed one of my Linux systems, what does it mean?

I just ran the last command on two of my systems and there are weird entries: user pts/2 dsldevice.lan Sun Dec 28 22:59:35 2014 - Tue Dec 30 00:40:41 2014 (1+01:41) Notice: dsldevice.lan ...
1
vote
1answer
184 views

Unable to get last connection info for SSH users (locked, no shell, public key) is there an alternative?

I have several remote systems connecting to my server via SSH to establish tunnels. They authenticate using a public key, their user is locked and their shell is set to /usr/sbin/nologin It all ...
1
vote
2answers
1k views

delete multiple users

I am the root user and I am setting up a menu for another user to use. This other user will only get this menu. There are two options that are interlinked: the first option is to search users. The ...
0
votes
1answer
151 views

Does an SFTP login get accounted for with `last`?

At first glance it doesn't show, but I also just learned about the existence of last as well.
1
vote
1answer
982 views

why does “last” command show reboots

According its own man page, the last command: shows listing of last logged in users This is exactly what I need. But why does it spam the output and list the reboots as well? I want to see who ...