I like htop interactive process viewer. Recently I found another one called gtop. It is similar to top, but fancier. Let us see how to install and use gtop on a Linux or macOS Unix based system.

Installation

First you need to install npm using apt command/apt-get command on an Ubuntu or Debian based system:
$ sudo apt install npm nodejs
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gyp javascript-common libicu55 libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libssl-dev libssl-doc libuv1 libuv1-dev node-abbrev
  node-ansi node-ansi-color-table node-archy node-async node-block-stream node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore
  node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid
  node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar
  node-tunnel-agent node-underscore node-which nodejs nodejs-dev python python-minimal python-pkg-resources python2.7 python2.7-minimal zlib1g-dev
Suggested packages:
  apache2 | lighttpd | httpd node-hawk node-aws-sign node-oauth-sign node-http-signature debhelper python-doc python-tk python-setuptools python2.7-doc binfmt-support
The following NEW packages will be installed:
  gyp javascript-common libicu55 libjs-inherits libjs-jquery libjs-node-uuid libjs-underscore libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libssl-dev libssl-doc libuv1 libuv1-dev node-abbrev
  node-ansi node-ansi-color-table node-archy node-async node-block-stream node-combined-stream node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fstream node-fstream-ignore
  node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid
  node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-sigmund node-slide node-tar
  node-tunnel-agent node-underscore node-which nodejs nodejs-dev npm python python-minimal python-pkg-resources python2.7 python2.7-minimal zlib1g-dev
0 upgraded, 69 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.2 MB of archives.
After this operation, 88.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.2 [338 kB]

A note about CentOS/RHEL 7 users

If you are using a RHEL/CentOS Linux 7, first install a package named epel-release and followed by nodejs and npm using the yum command:
# yum install epel-release
# yum install nodejs npm

A note about Fedora Linux users

If you are using a Fedora Linux, install nodejs and npm using the dnf command:
$ sudo dnf install epel-release
$ sudo dnf yum install nodejs npm

A note about macOS Unix users

First, install Homebrew on macOS and then type the following brew command:
$ brew install node

Installing gtop

To install gtop, type the following command:
npm install gtop -g
Sample outputs:

/usr/local/bin/gtop -> /usr/local/lib/node_modules/gtop/bin/gtop
/usr/local/lib
└─┬ gtop@0.1.5 
  β”œβ”€β”€ blessed@0.1.81 
  β”œβ”€β”¬ blessed-contrib@4.8.5 
  β”‚ β”œβ”€β”€ ansi-term@0.0.2 
  β”‚ β”œβ”€β”¬ chalk@1.1.3 
  β”‚ β”‚ β”œβ”€β”€ ansi-styles@2.2.1 
  β”‚ β”‚ β”œβ”€β”€ escape-string-regexp@1.0.5 
  β”‚ β”‚ β”œβ”€β”€ has-ansi@2.0.0 
  β”‚ β”‚ └── supports-color@2.0.0 
  β”‚ β”œβ”€β”¬ drawille-canvas-blessed-contrib@0.1.3 
  β”‚ β”‚ β”œβ”€β”€ bresenham@0.0.3 
  β”‚ β”‚ β”œβ”€β”€ drawille-blessed-contrib@1.0.0 
  β”‚ β”‚ └── gl-matrix@2.4.0 
  β”‚ β”œβ”€β”€ lodash@4.17.4 
  β”‚ β”œβ”€β”¬ map-canvas@0.1.5 
  β”‚ β”‚ └─┬ xml2js@0.4.19 
  β”‚ β”‚   β”œβ”€β”€ sax@1.2.4 
  β”‚ β”‚   └── xmlbuilder@9.0.4 
  β”‚ β”œβ”€β”€ marked@0.3.7 
  β”‚ β”œβ”€β”¬ marked-terminal@1.7.0 
  β”‚ β”‚ β”œβ”€β”¬ cardinal@1.0.0 
  β”‚ β”‚ β”‚ β”œβ”€β”€ ansicolors@0.2.1 
  β”‚ β”‚ β”‚ └─┬ redeyed@1.0.1 
  β”‚ β”‚ β”‚   └── esprima@3.0.0 
  β”‚ β”‚ β”œβ”€β”¬ cli-table@0.3.1 
  β”‚ β”‚ β”‚ └── colors@1.0.3 
  β”‚ β”‚ β”œβ”€β”€ lodash.assign@4.2.0 
  β”‚ β”‚ └─┬ node-emoji@1.8.1 
  β”‚ β”‚   └── lodash.toarray@4.4.0 
  β”‚ β”œβ”€β”¬ memory-streams@0.1.2 
  β”‚ β”‚ └─┬ readable-stream@1.0.34 
  β”‚ β”‚   β”œβ”€β”€ core-util-is@1.0.2 
  β”‚ β”‚   β”œβ”€β”€ inherits@2.0.3 
  β”‚ β”‚   β”œβ”€β”€ isarray@0.0.1 
  β”‚ β”‚   └── string_decoder@0.10.31 
  β”‚ β”œβ”€β”€ memorystream@0.3.1 
  β”‚ β”œβ”€β”¬ picture-tube@0.0.4 
  β”‚ β”‚ β”œβ”€β”€ buffers@0.1.1 
  β”‚ β”‚ β”œβ”€β”€ charm@0.1.2 
  β”‚ β”‚ β”œβ”€β”¬ event-stream@0.9.8 
  β”‚ β”‚ β”‚ └── optimist@0.2.8 
  β”‚ β”‚ β”œβ”€β”¬ optimist@0.3.7 
  β”‚ β”‚ β”‚ └── wordwrap@0.0.3 
  β”‚ β”‚ β”œβ”€β”€ png-js@0.1.1 
  β”‚ β”‚ └── request@2.9.203 
  β”‚ β”œβ”€β”¬ request@2.83.0 
  β”‚ β”‚ β”œβ”€β”€ aws-sign2@0.7.0 
  β”‚ β”‚ β”œβ”€β”€ aws4@1.6.0 
  β”‚ β”‚ β”œβ”€β”€ caseless@0.12.0 
  β”‚ β”‚ β”œβ”€β”¬ combined-stream@1.0.5 
  β”‚ β”‚ β”‚ └── delayed-stream@1.0.0 
  β”‚ β”‚ β”œβ”€β”€ extend@3.0.1 
  β”‚ β”‚ β”œβ”€β”€ forever-agent@0.6.1 
  β”‚ β”‚ β”œβ”€β”¬ form-data@2.3.1 
  β”‚ β”‚ β”‚ └── asynckit@0.4.0 
  β”‚ β”‚ β”œβ”€β”¬ har-validator@5.0.3 
  β”‚ β”‚ β”‚ β”œβ”€β”¬ ajv@5.5.1 
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ co@4.6.0 
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ fast-deep-equal@1.0.0 
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ fast-json-stable-stringify@2.0.0 
  β”‚ β”‚ β”‚ β”‚ └── json-schema-traverse@0.3.1 
  β”‚ β”‚ β”‚ └── har-schema@2.0.0 
  β”‚ β”‚ β”œβ”€β”¬ hawk@6.0.2 
  β”‚ β”‚ β”‚ β”œβ”€β”€ boom@4.3.1 
  β”‚ β”‚ β”‚ β”œβ”€β”¬ cryptiles@3.1.2 
  β”‚ β”‚ β”‚ β”‚ └── boom@5.2.0 
  β”‚ β”‚ β”‚ β”œβ”€β”€ hoek@4.2.0 
  β”‚ β”‚ β”‚ └── sntp@2.1.0 
  β”‚ β”‚ β”œβ”€β”¬ http-signature@1.2.0 
  β”‚ β”‚ β”‚ β”œβ”€β”€ assert-plus@1.0.0 
  β”‚ β”‚ β”‚ β”œβ”€β”¬ jsprim@1.4.1 
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ extsprintf@1.3.0 
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ json-schema@0.2.3 
  β”‚ β”‚ β”‚ β”‚ └── verror@1.10.0 
  β”‚ β”‚ β”‚ └─┬ sshpk@1.13.1 
  β”‚ β”‚ β”‚   β”œβ”€β”€ asn1@0.2.3 
  β”‚ β”‚ β”‚   β”œβ”€β”€ bcrypt-pbkdf@1.0.1 
  β”‚ β”‚ β”‚   β”œβ”€β”€ dashdash@1.14.1 
  β”‚ β”‚ β”‚   β”œβ”€β”€ ecc-jsbn@0.1.1 
  β”‚ β”‚ β”‚   β”œβ”€β”€ getpass@0.1.7 
  β”‚ β”‚ β”‚   β”œβ”€β”€ jsbn@0.1.1 
  β”‚ β”‚ β”‚   └── tweetnacl@0.14.5 
  β”‚ β”‚ β”œβ”€β”€ is-typedarray@1.0.0 
  β”‚ β”‚ β”œβ”€β”€ isstream@0.1.2 
  β”‚ β”‚ β”œβ”€β”€ json-stringify-safe@5.0.1 
  β”‚ β”‚ β”œβ”€β”¬ mime-types@2.1.17 
  β”‚ β”‚ β”‚ └── mime-db@1.30.0 
  β”‚ β”‚ β”œβ”€β”€ oauth-sign@0.8.2 
  β”‚ β”‚ β”œβ”€β”€ performance-now@2.1.0 
  β”‚ β”‚ β”œβ”€β”€ qs@6.5.1 
  β”‚ β”‚ β”œβ”€β”€ safe-buffer@5.1.1 
  β”‚ β”‚ β”œβ”€β”€ stringstream@0.0.5 
  β”‚ β”‚ β”œβ”€β”¬ tough-cookie@2.3.3 
  β”‚ β”‚ β”‚ └── punycode@1.4.1 
  β”‚ β”‚ β”œβ”€β”€ tunnel-agent@0.6.0 
  β”‚ β”‚ └── uuid@3.1.0 
  β”‚ β”œβ”€β”¬ sparkline@0.1.2 
  β”‚ β”‚ β”œβ”€β”€ here@0.0.2 
  β”‚ β”‚ └─┬ nopt@2.1.2 
  β”‚ β”‚   └── abbrev@1.1.1 
  β”‚ β”œβ”€β”¬ strip-ansi@3.0.1 
  β”‚ β”‚ └── ansi-regex@2.1.1 
  β”‚ β”œβ”€β”€ term-canvas@0.0.5 
  β”‚ └── x256@0.0.2 
  └── systeminformation@3.33.8

Usage

Simply type the following command:
gtop
OR
nodejs /usr/local/bin/gtop
Sample outputs:

Fig.01: gtop in action

You can sort the process table by pressing the following keys:

  1. Press p to sort by process ID (PID).
  2. Press c to sort by CPU usage.
  3. Press m to sort by memory usage.

Even though gtop is pretty fancy. I recommend htop tool or atop utility or top command only for server usage.

See also


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one ↓

CategoryList of Unix and Linux commands
Disk space analyzersncdu β€’ pydf
File Managementcat
FirewallAlpine Awall β€’ CentOS 8 β€’ OpenSUSE β€’ RHEL 8 β€’ Ubuntu 16.04 β€’ Ubuntu 18.04 β€’ Ubuntu 20.04
Network UtilitiesNetHogs β€’ dig β€’ host β€’ ip β€’ nmap
OpenVPNCentOS 7 β€’ CentOS 8 β€’ Debian 10 β€’ Debian 8/9 β€’ Ubuntu 18.04 β€’ Ubuntu 20.04
Package Managerapk β€’ apt
Processes Managementbg β€’ chroot β€’ cron β€’ disown β€’ fg β€’ jobs β€’ killall β€’ kill β€’ pidof β€’ pstree β€’ pwdx β€’ time
Searchinggrep β€’ whereis β€’ which
User Informationgroups β€’ id β€’ lastcomm β€’ last β€’ lid/libuser-lid β€’ logname β€’ members β€’ users β€’ whoami β€’ who β€’ w
WireGuard VPNAlpine β€’ CentOS 8 β€’ Debian 10 β€’ Firewall β€’ Ubuntu 20.04
6 comments… add one
  • Michal Dec 6, 2017 @ 10:20

    Writing tools in nodejs has always been very lightweight approach :-D
    http://npm.anvaka.com/#/view/2d/gtop

  • Rezacalmaz Tayyocalar Dec 6, 2017 @ 11:30

    Debian :-(

    npm WARN engine gtop@0.1.5: wanted: {β€œnode”:”>=4.0.0β€³} (current: {β€œnode”:”0.10.29β€³,”npm”:”1.4.21β€³})

  • Warchylde Dec 7, 2017 @ 5:37

    This is a rocking tool. Just one teensy little thing, they may want to look at why it’s using so much CPU…. my test box with 2 x 3.3Ghz vCPU’s allocated is sitting at 10% or more just for gtop.

  • Ignacio AgullΓ³ Dec 8, 2017 @ 17:12

    On GNU/Linux Trisquel 7 (libre version of Ubuntu 14.04 LTS), something fails:
    # apt install npm nodejs -> OK
    $ npm install gtop -g
    (…)
    npm ERR! Please try running this command again as root/Administrator.
    (…)
    # npm install gtop -g -> OK
    $ gtop
    /usr/local/lib/node_modules/gtop/lib/monitor/cpu.js:8
    si.currentLoad(data => {
    ^
    SyntaxError: Unexpected token >
    # gtop
    /usr/local/lib/node_modules/gtop/lib/monitor/cpu.js:8
    si.currentLoad(data => {
    ^
    SyntaxError: Unexpected token >

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum