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 appuser -U appuser
        PID TTY          TIME CMD
       3797 ?        00:00:00 sleep
       3803 ?        00:00:00 sleep
       3809 ?        00:00:00 sleep
       3815 ?        00:00:00 sleep

    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.

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

    $ id
    uid=1002(appuser) gid=1002(appuser) groups=1002(appuser)
  2. Show processes for a single group with the ps command using group selectors.
    $ ps -g appuser -G appuser
        PID TTY          TIME CMD
       3797 ?        00:00:00 sleep
       3803 ?        00:00:00 sleep
       3809 ?        00:00:00 sleep
       3815 ?        00:00:00 sleep

    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 appuser,root -U appuser,root
        PID TTY          TIME CMD
          1 ?        00:00:01 systemd
          2 ?        00:00:00 kthreadd
          3 ?        00:00:00 pool_workqueue_release
          4 ?        00:00:00 kworker/R-rcu_g
          5 ?        00:00:00 kworker/R-rcu_p
          6 ?        00:00:00 kworker/R-slub_
          7 ?        00:00:00 kworker/R-netns
    ##### snipped #####
         13 ?        00:00:00 rcu_tasks_kthread

    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 app-worker
    appuser     3815       1  0 12:15 ?        00:00:00 app-worker 300
    user        3821    3772  0 12:15 ?        00:00:00 bash -c ps -aef | grep app-worker
    user        3823    3821  0 12:15 ?        00:00:00 grep app-worker

    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 appuser
    
    top - 12:15:52 up 6 min,  2 users,  load average: 0.41, 0.16, 0.06
    Tasks: 126 total,   1 running, 124 sleeping,   0 stopped,   1 zombie
    %Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st 
    MiB Mem :   3901.5 total,   2929.6 free,    320.2 used,    809.4 buff/cache     
    MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.   3581.3 avail Mem 
    
        PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
       3797 appuser   20   0    5256   1792   1792 S   0.0   0.0   0:00.00 sleep
       3803 appuser   20   0    5256   1792   1792 S   0.0   0.0   0:00.00 sleep
       3809 appuser   20   0    5256   1792   1792 S   0.0   0.0   0:00.00 sleep
       3815 appuser   20   0    5256   1664   1664 S   0.0   0.0   0:00.00 sleep
    ##### 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 appuser -U appuser
    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 appuser -U appuser
    3797 sleep
    3803 sleep
    3809 sleep
    3815 sleep

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