gtop: Awesome system monitoring dashboard for Linux/macOS Unix terminal

Posted on in Categories Command Line Hacks, Debian Linux, Howto last updated December 6, 2017

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

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
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

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 6 comments/add one below):

6 comment

  1. 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 >

  2. 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.

  3. Debian :-(

    npm WARN engine gtop@0.1.5: wanted: {“node”:”>=4.0.0″} (current: {“node”:”0.10.29″,”npm”:”1.4.21″})

Comments are closed.