0

I have extracted all usernames of /etc/passwd by command below and save them in another file:

cat /etc/passwd | awk -F ":" {print $5} > temp.txt

and now I want to get process information of each username of "temp.txt" but I don't know how to do it. Furthermore how to examine who have logged in the system during the last day and which command(s) s/he has executed?

chaos
  • 8,162
  • 3
  • 33
  • 40
MSH
  • 429
  • 3
  • 7
  • 20

1 Answers1

1

Try doing this :

for u in $(<temp.txt); do echo "$i processes:"; pgrep -fl -u "$u"; done
Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223