Tiny htop for your terminal
Simply drop this into your $HOME folder and add the following to your .bashrc:
node "$HOME/.htop.js"| 'use strict' | |
| const exec = require('child_process').execSync | |
| const split = Buffer.from('0D1B5B3864', 'hex') | |
| let out = exec('htop << f\nq\nf').toString() // run htop for a sec | |
| out = out.substr(80).split(String(split))[0].split(' PID USER ')[0] // get top rows | |
| console.log(out.substr(0, out.length - 3)) // strip colors, leave reset |