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?

Was it helpful?

Solution

Try doing this :

for u in $(<temp.txt); do echo "$i processes:"; pgrep -fl -u "$u"; done
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top