Run TOP in Color, split 4 ways for x seconds - the ultimate ps command. Great for init scripts

G=$(stty -g);stty rows $((${LINES:-50}/2));top -n1; stty $G;unset G
One of my favorite ways to impress newbies (and old hats) to the power of the shell, is to give them an incredibly colorful and amazing version of the top command that runs once upon login, just like running fortune on login. It's pretty sweet believe me, just add this one-liner to your ~/.bash_profile -- and of course you can set the height to be anything, from 1 line to 1000! G=$(stty -g);stty rows $((${LINES:-50}/2));top -n1; stty $G;unset G Doesn't take more than the below toprc file I've added below, and you get all 4 top windows showing output at the same time.. each with a different color scheme, and each showing different info. Each window would normally take up 1/4th of your screen when run like that - TOP is designed as a full screen program. But here's where you might learn something new today on this great site.. By using the stty command to change the terminals internal understanding of the size of your terminal window, you force top to also think that way as well. # save the correct settings to G var. G=$(stty -g) # change the number of rows to half the actual amount, or 50 otherwise stty rows $((${LINES:-50}/2)) # run top non-interactively for 1 second, the output stays on the screen (half at least) top -n1 # reset the terminal back to the correct values, and clean up after yourself stty $G;unset G This trick from my [ http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html bash_profile ], though the online version will be updated soon. Just think what else you could run like this! Note 1: I had to edit the toprc file out due to this site can't handle that (uploads/including code). So you can grab it from [ http://www.askapache.com/linux-unix/bash-power-prompt.html my site ] Note 2: I had to come back and edit again because the links weren't being correctly parsed
Sample Output
1:Def - 13:30:28 up 33 days, 10:05,  1 user,  load average: 1.75, 1.97, 1.97
1TTY        PID  PPID USER     GROUP     PR  NI %CPU %MEM S WCHAN     COMMAND
 ?        20169 20030 mysql    mysql     15   0 120.1  2.2 S stext     mysqld                                                                                                                                                         
 ?        24677     1 root     root      18   0  0.0  0.8 S 429496729 clamd
 ?         2453     1 root     root      15   0  0.0  0.4 S stext     spamd
 ?         2493  2453 root     root      15   0  0.0  0.4 S stext     spamd
 ?         2494  2453 root     root      18   0  0.0  0.4 S stext     spamd



[08:1306 0:834] 02:33:33 Thu Apr 22 [askapache@DROID.vz.uk:/dev/pts/47 +1] /.chef/chroot $ 

What Others Think

You can also use htop if you want :)
thelan · 649 weeks and 5 days ago
With some of the drag-drop-flow-creator you can install a Bot to automate an action. They provides a no-code process creator, so you don't need programming skills to use it. Create an efficient online workflow without printing, manual data entry, or error-prone processes.
robinjack · 28 weeks and 4 days ago
I would not pretend to realize precisely why, however I personally could not hope to truly uncover what I was ready after. I had been perplexed and this very article cut through the common solutions that only demonstrate deficiency of content. Thank you a lot. 4dpick.com/buy-4d-online
robinjack · 26 weeks and 6 days ago
Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under $500 Near Me pug puppies for sale in texas pug puppies for sale $200 pugs for sale near me under $500 pugs for sale under $400 near me pugs for sale near me puppies for sale near me under $500 pug puppies for sale under $1,000 near me pug for sale pug puppies for sale under $300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under $500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale $200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale pug puppies indiana Amazing! This blog looks just like my old one! It's on a completely different subject but it has pretty much the same layout and design. Wonderful choice of colors!
rahimhh21 · 4 weeks and 6 days ago
In an article from www.signnow.com/ask/how-to-manage-a-trust-fund-and-e-sign-as-a-trustee-in-the-age-of-e-signature, they discussed what a trust fund is, who the people involved are, how it works, how to sign trustee documents, probates, some of the eSignature solutions available to you, and more.
robinjack · 4 weeks and 6 days ago
The webpage https://www.airslate.com/bots/docusign is the easiest automation for busy people when it come to Streamline your work in Docusign. It moves info between your web apps automatically, so you can focus on your most important work.
robinjack · 1 week and 6 days ago
There is a wealth of useful information here www.airslate.com/product/contract-management. As a result, I am really pleased with the material. There are no disadvantages!
robinjack · 3 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?

commandlinefu.com 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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: