1

How to display list of all processes preferably (with no ps header line) where processes with the same name are grouped together?

ps -A | tail +2 

prints the processes without the header but I can not find out how to group the processes that have the same name?

1
ps|pr -t|cut -d" " -f3 |sort |tee output.lst
  • ps -> gives the processes running
  • pr-> paginating files -> suppress any header
  • cut -> selecting particular column
  • sort-> sorting any column
  • tee -> stores as well as displays

First, I have retrived the processes running through ps. Since ps gives a header so have used pr -t which will remove any header. After that, I have selected the third column of file since processes name are stored in third column through cut command. After that, I have sorted the result. It will bring processes with same name together. After that I have pipelined result to tee command.

  • I am not sure if I can understand your answer well. Maybe could you give more details? – user259412 Jun 2 '18 at 16:31
  • is my answer wrong? – user293710 Jun 2 '18 at 16:32
  • To decide, first I should understand it. – user259412 Jun 2 '18 at 16:33
  • first, i have retrived the processes running through ps. since ps gives a header so have used pr -t which will remove any header .after that i have selected the third column of file since processes name are stored in third column through cut command .after that I have sorted the result . It will bring processes with same name together .after that i have pipelined result to tee command – user293710 Jun 2 '18 at 16:39
  • @peterh is it right? – user293710 Jun 2 '18 at 16:48
0

This should do it:

ps axhk comm

ax -- Display every process on the system.

h -- No header.

k comm -- Specify sorting order by command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.