Pregunta

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?

¿Fue útil?

Solución

Try doing this :

for u in $(<temp.txt); do echo "$i processes:"; pgrep -fl -u "$u"; done
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top