Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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? –  derobert Nov 27 '12 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. –  dreamzor Nov 27 '12 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. –  derobert Nov 27 '12 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? –  dreamzor Nov 27 '12 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. –  derobert Nov 27 '12 at 16:19

1 Answer 1

Use the latest utility htop instead of top.

share|improve this answer
    
How would htop help? It's just a curses version of top; he's using it from a script –  Michael Mrozek Oct 6 '13 at 8:00
    
htop is the advance package ... we can do multiple operations while running ... –  Ganesh Chaudhari Oct 6 '13 at 8:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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