Question

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?

Était-ce utile?

La solution

Try doing this :

for u in $(<temp.txt); do echo "$i processes:"; pgrep -fl -u "$u"; done
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top