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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
This gives you those who were seen from the 'last' command in a file called 'last.txt'.
last | cut -f1 -d' ' | uniq | sort | grep -v reboot | grep -v wtmp | egrep -v "^$" > last.txt
This gives you those all users on the system in a file called 'passwd.txt'.
cat /etc/passwd | cut -f1 -d: | uniq | sort > passwd.txt
Interpreted correctly this gives you the difference. Namely, "those who are not on the last command".
diff last.txt passwd.txt
This is easier to look at though.
sdiff last.txt passwd.txt | less