#to show processes owned by a specific user
ps -u <username>
 
#to remove processes owned by a specific user
pkill -u <username>
w

loginctl

loginctl list-users
loginctl user-status <UID>
loginctl terminate-user <Username>
 
loginctl list-sessions
loginctl terminate-session <Session>
  • loginctl is a part of systemd, which manages users and sessions

  • One user can have multiple sessions open simultaneously

  • loginctl list-users and loginctl list-sessions shows users and sessions

  • loginctl user-status <UID> shows a tree of processes currently opened by this user

  • loginctl terminate-session and loginctl terminate-user can be used to stop current sessions or users