See OpenVZ Container id's of top 10 running processes by %cpu

ps -e h -o pid --sort -pcpu | head -10 | vzpid -
This command will list the PID, VEID, and Name of the 10 highest cpu using processes on a openvz host. You must have vzpid installed.
Sample Output
Pid     VEID    Name
2860    1014040 ruby
5647    0       htop
5143    1013101 mysqld
6095    1013151 mysqld
2922    1014040 ruby
3043    0       ruby
4252    1014045 freshclam
3488    1014045 amavisd-new
1       0       init
9       0       events/0

By: mrkmg
2012-05-24 14:16:40

What Others Think

I find myself wrapping it in "watch", to keep an eye on things. watch "ps -e h -o pid --sort -pcpu | head -10 | vzpid -"
mrkmg · 403 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: