2

I'm trying to create a script that prints top stat for some specific fields (e.g. pid, command, priority, nice value). I can print most of them by using -stats option, but there is no arg for ni and pri there...
I know, that's possible to get if i use ps, but what about top?

5
  • I'm confused, my top doesn't have a -stats option. And it displays priority and niceness by default. And ps should display all processes (if given the right arguments to select them) What system is this on? Commented Nov 27, 2012 at 15:59
  • well, macosx right now, but there is no difference between this and ubuntu at all... it does display them, but i need only them and something else, not all possible stats. Commented Nov 27, 2012 at 16:03
  • Nothing wrong with questions about Mac OS X's Unix part here, AFAIK. Definitely different than Ubuntu though, as on Ubuntu top -stats gives an error about an unknown option. Commented Nov 27, 2012 at 16:07
  • Yes, sorry, this option exists only on osx... nothing about this on archlinux. Weird. So how can I manage fields that I want to display in top command on proper linux systems? Commented Nov 27, 2012 at 16:12
  • 1
    With Linux top, the only way I know is by writing a ~/.toprc file (easily done by configuring it interactively how you'd like, then hitting W). I don't think top is really intended to be used by scripts. Commented Nov 27, 2012 at 16:19

1 Answer 1

-2

Use the latest utility htop instead of top.

2
  • How would htop help? It's just a curses version of top; he's using it from a script Commented Oct 6, 2013 at 8:00
  • htop is the advance package ... we can do multiple operations while running ... Commented Oct 6, 2013 at 8:02

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.