4

I often used the following command,

ps -eo pid,cmd,pcpu,pmem --sort=-pcpu | head

But in the man page I saw the following to output modifiers,

   --lines n
          Set screen height.
   --rows n
          Set screen height.

As if these modifiers can limit row height then I don't have to use any kind of piping which gives me a bit comfort on writing scripts with python subprocess.

But I have no idea how can I use them. As I have already tried adding them at the end of the command.

9

The screen height doesn’t limit the total output, it determines how often the header is repeated (if requested):

ps -eo pid,cmd,pcpu,pmem --sort=-pcpu --lines=20 --header

will repeat the header every twenty lines (so you’ll get a header, nineteen lines of output, a header, etc.).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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