Another terminal based graphical activity monitor, inspired by [gtop](https://github.com/aksakalli/gtop) and [vtop](https://github.com/MrRio/vtop), this time written in [Go](https://golang.org/)!
Join us in [\#gotop:matrix.org](https://app.element.io/#/room/#gotop:matrix.org) ![](https://img.shields.io/matrix/gotop:matrix.org) ([matrix clients](https://matrix.to/#/#gotop:matrix.org)).
![](https://github.com/xxxserxxx/gotop/workflows/Build%20Go%20binaries/badge.svg)
![](https://img.shields.io/github/v/release/xxxserxxx/gotop)
![](https://img.shields.io/github/release-date/xxxserxxx/gotop)
![](https://img.shields.io/librariesio/github/xxxserxxx/gotop)
![](https://img.shields.io/github/commit-activity/m/xxxserxxx/gotop)
See the [mini-blog](https://github.com/xxxserxxx/gotop/wiki/Micro-Blog) for updates on the build status, and the [change log](/CHANGELOG.md) for release updates.
## Installation
Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, but have limited testing. OpenBSD works with some caveats; cross-compiling is difficult and binaries are not provided.
If you install gotop by hand, or you download or create new layouts or colorschemes, you will need to put the layout files where gotop can find them. To see the list of directories gotop looks for files, run `gotop -h`. The first directory is always the directory from which gotop is run.
- **Arch**: Install from AUR, e.g. `yay -S gotop-bin`. There is also `gotop` and `gotop-git`
- **Gentoo**: gotop is available on [guru](https://gitweb.gentoo.org/repo/proj/guru.git) overlay.
```shell
sudo layman -a guru
sudo emerge gotop
```
- **OSX**: gotop is in *homebrew-core*. `brew install gotop`. Make sure to uninstall and untap any previous installations or taps.
- **Prebuilt binaries**: Binaries for most systems can be downloaded from [the github releases page](https://github.com/xxxserxxx/gotop/releases). RPM and DEB packages are also provided.
- **Source**: This requires Go >= 1.16. `go install github.com/xxxserxxx/gotop/v4/cmd/gotop@latest`
### Extensions update
Extensions have proven problematic; go plugins are not usable in real-world cases, and the solution I had running for a while was hacky, at best. Consequently, extensions have been moved into the main code base for now.
- nvidia support: use the `--nvidia` flag to enable. You must have the `nvidia- smi` package installed, and gotop must be able to find the `nvidia-smi` executable, for this to work.
- remote: allows gotop to pull sensor data from applications exporting Prometheus metrics, including remote gotop instances themselves.
### Console Users
gotop requires a font that has braille and block character Unicode code points; some distributions do not provide this. In the gotop repository is a `pcf` font that has these points, and setting this font may improve how gotop renders in your console. To use this, run these commands:
```shell
curl -O -L https://raw.githubusercontent.com/xxxserxxx/gotop/master/fonts/Lat15-VGA16-braille.psf
setfont Lat15-VGA16-braille.psf
```
### Building
This is the download & compile approach.
gotop requires Go 1.16 or later to build, as it relies on the embed feature released with 1.16; a library it uses, lingo, uses both embed and the `io/fs` package. For a version of gotop that builds with earlier versions, check out one of the tags prior to v4.2.0.
```shell
git clone https://github.com/xxxserxxx/gotop.git
cd gotop
# This ugly SOB gets a usable version from the git tag list
VERS="$(git tag -l --sort=-v:refname | sed 's/v\([^-].*\)/\1/g' | head -1 | tr -d '-' ).$(git describe --long --tags | sed 's/\([^-].*\)-\([0-9]*\)-\(g.*\)/r\2.\3/g' | tr -d '-')"
DAT=$(date +%Y%m%dT%H%M%S)
go build -o gotop \
-ldflags "-X main.Version=v${VERS} -X main.BuildDate=${DAT}" \
./cmd/gotop
```
If you want to compact the executable as much as possible on Linux, change the `ldflags` line to this:
```
-ldflags "-X main.Version=v${VERS} -X main.BuildDate=${DAT} -extldflags '-s -w'" \
```
Now move the `gotop` executable to somewhere in your `$PATH`.
If Go is not installed or is the wrong version, and you don't have root access or don't want to upgrade Go, a script is provided to download Go and the gotop sources, compile gotop, and then clean up. See `scripts/install_without_root.sh`.
#### go generate
With Go 1.16, it is no longer necessary to call `go generate`. Translations and Apple SMC tags are embedded with `go:embed`.
## Usage
Run with `-h` to get an extensive list of command line arguments. Many of these can be configured by creating a configuration file; see the next section for more information. Key bindings can be viewed while gotop is running by pressing the `?` key, or they can be printed out by using the `--list keys` command.
In addition to the key bindings, the mouse can be used to control the process list:
- click to select process
- mouse wheel to scroll through processes
For more information on other topics, see:
- [Layouts](https://github.com/xxxserxxx/gotop/blob/master/docs/layouts.md)
- [Configuration](https://github.com/xxxserxxx/gotop/blob/master/docs/configuration.md)
- [Color schemes](https://github.com/xxxserxxx/gotop/blob/master/docs/colorschemes.md)
- [Device filtering](https://github.com/xxxserxxx/gotop/blob/master/docs/devices.md)
- [Extensions](https://github.com/xxxserxxx/gotop/blob/master/docs/extensions.md)
Monitoring remote machines
--------------------------
gotop can monitor gotops running on remote machines and display (some of the)
metrics within a single instance. gotop expects to be behind a proxy, or within
a secure intranet, so while it's not exactly hard to set up, it's also not
trivial. An example set-up is explained in the
[Remote Monitoring](https://github.com/xxxserxxx/gotop/blob/master/docs/remote-monitoring.md)
document.
## More screen shots
#### '-l kitchensink' + colorscheme