Skip to content

Instantly share code, notes, and snippets.

@mkg20001
Created April 8, 2019 12:13
Show Gist options
  • Save mkg20001/c45b85796aa59d5ebaf4ec34d49a9450 to your computer and use it in GitHub Desktop.
Save mkg20001/c45b85796aa59d5ebaf4ec34d49a9450 to your computer and use it in GitHub Desktop.
Tiny htop header for you terminal

htop.js

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment