Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 876941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:31:14+00:00 2026-05-15T11:31:14+00:00

Often I want to get a nice readout what process are running and their

  • 0

Often I want to get a nice readout what process are running and their relationship; I usually by habit runs ps auxfww and eventual grep for the process in question.

Having been thinking about the problem I tried to create an oneliner to get the process tree in ps ufww format for all processes which has the session id specified by arbitrary process name(s); ending up in following code:

ps ufww --sid=$(ps -C apache2 -o sess --no-headers | sort | uniq | grep -v -E '^ +0$' | awk 'NR==1{x=$0;next}NF{x=x","$0};END{gsub(/[[:space:]]*/,"",x);print x}')

giving for example following output:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      4157  0.0  0.1  41264  3120 ?        Ss   Jun11   0:00 /usr/sbin/apache2 -k start
www-data  4329  0.0  0.0  41264  1976 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start
www-data  4330  0.0  0.0  41264  2028 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start
www-data  4331  0.0  0.0  41264  2028 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start
www-data  4332  0.0  0.0  41264  2028 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start
www-data  4333  0.0  0.0  41264  2032 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start
www-data  6648  0.0  0.0  41264  1884 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start
www-data  6654  0.0  0.0  41264  1884 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start
www-data  6655  0.0  0.0  41264  1884 ?        S    Jun11   0:00  \_ /usr/sbin/apache2 -k start

I do wonder now if anyone has an better idea to solve this issue? Are there anything out there that is easier to “oneline” and gives above or better information? For example I would actually want to have included all childs relative any parent.

(uncertain if this should be on SF instead, but felt it was more like an programming question)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:31:15+00:00Added an answer on May 15, 2026 at 11:31 am

    Here is a slightly shorter and possibly slightly faster version of yours. It probably relies on some GNU-specific features:

    ps ufww --sid=$(ps -C apache2 -o sess= | sort -u | grep -v -E '^ +0$' | tr $'\n' ',' | sed 's/,$/\n/; s/ //g')
    

    Over 50 characters shorter.

    Shorter yet and with no convoluted machinations:

    ps -C apache2 fww -o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,cmd
    

    Look! No scrollbar!

    I don’t understand what you mean by:

    For example I would actually want to have included all childs relative any parent.

    Isn’t that what ps auxfww does?

    If you want to easily specify a process name as a parameter, you could create a ps “family” function:

    psf () { ps -C $1 fww -o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,cmd; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the Google Chrome debugger, I often want to get a reference to a
I usually write python in emacs. I'll often want to re-evaluate my file, which
I often want to process a file resulting in a modified output file. I
I want a nice way to get the current unix timestamp from a java
I often want to change to the directory where a particular executable is located.
I often want to send sample apps to friends & colleages that work with
I'm putting together a Swing application where I often want to replace the contents
As an artist and musician, I often want to sit down and just let
When I load data in my code-behind, I find that often I want to
I often run into the situation where I want to disable some code while

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.