S
S
Sergey Burduzha2017-08-31 08:09:37
ubuntu
Sergey Burduzha, 2017-08-31 08:09:37

How to sort output twice in Ubuntu?

I want to sort the output of processes

2712 ?        00:00:04 alarm-clock-app
 2514 ?        00:00:00 at-spi2-registr
 2506 ?        00:00:00 at-spi-bus-laun
 2476 ?        00:00:04 bamfdaemon
16431 ?        00:06:24 chromium-browse
16440 ?        00:00:00 chromium-browse
16442 ?        00:00:00 chromium-browse
16502 ?        00:06:51 chromium-browse
16520 ?        00:00:01 chromium-browse
16536 ?        00:00:42 chromium-browse
16540 ?        00:00:00 chromium-browse
16547 ?        00:00:00 chromium-browse
16548 ?        00:00:00 chromium-browse
16560 ?        00:00:05 chromium-browse
16583 ?        00:00:02 chromium-browse
16662 ?        00:00:00 chromium-browse
19872 ?        00:31:10 chromium-browse

To sort by the third field, I enter the command
ps -U | sort -k2 -n
And how to sort inside this column by the second field again to see only active processes, because after the usual sorting that I prescribed, in the third column it is sorted by the first field, and there all values ​​are 00.
I hope that I clearly explained))
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2017-08-31
@serii81

Try
ps -U | tr -s " " " " | sort -k3.5 -n

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question