In Linux environments with multiple users and long‑running services, understanding which processes belong to which accounts is essential for troubleshooting and capacity planning. Focusing output on a specific user or group makes it easier to spot runaway tasks, stuck daemons, or resource‑heavy applications without scrolling through the entire process table.

Each process is tagged with real and effective user and group identifiers, and common utilities such as ps, pgrep, and top can filter on these attributes. Options like -u and -U select processes based on usernames or user IDs, while -g and -G narrow results to particular groups or process group leaders to match exactly the context being investigated.

Security settings on some distributions restrict how much detail is visible for processes owned by other users, and inspecting system‑wide activity often requires elevated privileges. Using the correct selectors avoids accidentally hiding important processes and helps keep focus on the accounts or groups that matter, especially when working on remote servers or shared Linux systems.

Steps to list processes by user and group in Linux:

  1. Show processes for a single user with the ps command using both real and effective user selectors.
    $ ps -u user -U user
        PID TTY          TIME CMD
       1423 ?        00:00:00 systemd
       1424 ?        00:00:00 (sd-pam)
       1430 ?        00:00:00 pipewire
       1431 ?        00:00:00 pipewire-media-
       1432 ?        00:00:00 pulseaudio
       1434 ?        00:00:00 tracker-miner-f
       1437 ?        00:00:00 dbus-daemon
       1439 ?        00:00:00 gnome-keyring-d
       1459 ?        00:00:00 gvfsd
       1464 ?        00:00:00 gvfsd-fuse
    ##### snipped #####

    The -u option lists processes for a specific user by username, while -U filters by real user ID.

    -U      Display the processes belonging to the specified real user IDs.
    -u      Display the processes belonging to the specified usernames.

    user is a real user and group name in the system.

    $ id
    uid=1000(user) gid=1000(user) groups=1000(user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),121(lpadmin),132(lxd),133(sambashare)
  2. Show processes for a single group with the ps command using group selectors.
    $ ps -g user -G user
        PID TTY          TIME CMD
       1418 ?        00:00:00 gdm-session-wor
       1423 ?        00:00:00 systemd
       1424 ?        00:00:00 (sd-pam)
       1430 ?        00:00:00 pipewire
       1431 ?        00:00:00 pipewire-media-
       1432 ?        00:00:00 pulseaudio
       1434 ?        00:00:00 tracker-miner-f
       1437 ?        00:00:00 dbus-daemon
       1439 ?        00:00:00 gnome-keyring-d
       1459 ?        00:00:00 gvfsd
    ##### snipped #####

    The -g option selects by session or process group leader, and -G selects by real group ID or group name.

    -G      Display information about processes which are running with the specified real group IDs.
    -g      Display information about processes with the specified process group leaders.
  3. List processes for multiple users at once with the ps command.
    $ ps -u user,root -U user,root
        PID TTY          TIME CMD
          1 ?        00:00:02 systemd
          2 ?        00:00:00 kthreadd
          3 ?        00:00:00 rcu_gp
          4 ?        00:00:00 rcu_par_gp
          6 ?        00:00:00 kworker/0:0H-events_highpri
          7 ?        00:00:00 kworker/0:1-events
          8 ?        00:00:00 kworker/u256:0-ext4-rsv-conversion
          9 ?        00:00:00 mm_percpu_wq
         10 ?        00:00:00 rcu_tasks_rude_
         11 ?        00:00:00 rcu_tasks_trace
    ##### snipped #####

    Multiple usernames or IDs can be provided as comma‑separated lists to combine filters for -u, -U, -g, and -G.

  4. Filter the ps process list by name or user with the grep command.
    $ ps -aef | grep avahi
    avahi        746       1  0 07:06 ?        00:00:00 avahi-daemon: running [host.local]
    avahi        815     746  0 07:06 ?        00:00:00 avahi-daemon: chroot helper
    user        2403    2184  0 07:12 pts/0    00:00:00 grep --color=auto avahi

    The grep command filters process output by keyword, which can be a username, group name, or process name.

  5. Show processes for a specific user interactively with the top command.
    $ top -u user
    
    top - 07:12:59 up 6 min,  1 user,  load average: 0.01, 0.13, 0.09
    Tasks: 286 total,   1 running, 285 sleeping,   0 stopped,   0 zombie
    %Cpu0  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    %Cpu1  : 33.3 us,  0.0 sy,  0.0 ni, 66.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    MiB Mem :   3894.9 total,   2352.8 free,    866.0 used,    676.0 buff/cache
    MiB Swap:    923.2 total,    923.2 free,      0.0 used.   2781.2 avail Mem 
    
        PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND 
       1960 user      20   0  411896  50404  38024 S  33.3   1.3   0:02.06 gnome-+ 
       1423 user      20   0   16196   9704   7424 S   0.0   0.2   0:00.34 systemd 
       1424 user      20   0  102304   3620     24 S   0.0   0.1   0:00.00 (sd-pa+ 
       1430 user       9 -11   90940   5876   4776 S   0.0   0.1   0:00.02 pipewi+ 
       1431 user       9 -11   82964   5888   4872 S   0.0   0.1   0:00.02 pipewi+ 
       1432 user       9 -11 1491348  19356  14788 S   0.0   0.5   0:00.97 pulsea+ 
    ##### snipped #####

    The top command provides real‑time monitoring of CPU and memory usage for processes owned by the specified user.

    top accepts either -u or -U, but not both at the same time, and combining them results in a selection error.

    $ top -u user -U user
    top: conflicting process selections (U/p/u)
  6. Display processes for a user using pgrep and include process names in the output.
    $ pgrep -l -u user -U user
    1423 systemd
    1424 (sd-pam)
    1430 pipewire
    1431 pipewire-media-
    1432 pulseaudio
    1434 tracker-miner-f
    1437 dbus-daemon
    1439 gnome-keyring-d
    1459 gvfsd
    1464 gvfsd-fuse
    1466 gvfs-udisks2-vo
    1477 gvfs-goa-volume
    1482 goa-daemon
    1492 goa-identity-se
    1499 gvfs-gphoto2-vo
    1503 gvfs-mtp-volume
    1509 gdm-wayland-ses
    1511 gvfs-afc-volume
    1517 gnome-session-b
    1568 gnome-session-c
    1576 gnome-session-b
    1593 gnome-shell
    1597 at-spi-bus-laun
    1605 dbus-daemon
    1613 Xwayland
    1634 xdg-permission-
    1636 gnome-shell-cal
    1645 evolution-sourc
    1652 evolution-calen
    1660 dconf-service
    1664 evolution-addre
    1682 gjs
    1684 at-spi2-registr
    1694 gvfsd-trash
    1699 gsd-a11y-settin
    1700 gsd-color
    1702 gsd-datetime
    1703 gsd-housekeepin
    1705 gsd-keyboard
    1719 gsd-media-keys
    1722 gsd-power
    1723 gsd-print-notif
    1724 gsd-rfkill
    1728 gsd-screensaver
    1735 gsd-sharing
    1736 gsd-smartcard
    1752 gsd-sound
    1754 gsd-wacom
    1761 gsd-disk-utilit
    1774 evolution-alarm
    1778 gsd-printer
    1781 vmtoolsd
    1861 ibus-daemon
    1862 gsd-xsettings
    1885 ibus-dconf
    1887 ibus-extension-
    1889 ibus-x11
    1900 ibus-portal
    1919 ibus-engine-sim
    1929 gjs
    1960 gnome-terminal-
    1962 gnome-calendar
    2184 bash
    2213 gvfsd-metadata
    2216 update-notifier

    The pgrep command lists process IDs filtered by user or group, and the -l flag adds the associated process names to the output.

Discuss the article:

Comment anonymously. Login not required.