Domanda

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?

È stato utile?

Soluzione

Try doing this :

for u in $(<temp.txt); do echo "$i processes:"; pgrep -fl -u "$u"; done
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top