Linux工具 1、gotop 一个TUI图形活动监视器

2019-04-11  本文已影响0人  EricJonse



image.png
1、功能

查看每个CPU的使用率
查看硬盘使用的空间大小
查看内存使用大小
查看虚拟内存使用大小
查看CPU温度
查看网络带宽流量
查看每个进程的CPU使用率与数量

2、安装
  1. 创建安装脚本,内容如下:
cat gotopDownload.sh
#!/usr/bin/env bash

# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c
function get_latest_release {
    curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
        grep '"tag_name":' |                                          # Get tag line
        sed -E 's/.*"([^"]+)".*/\1/'                                  # Pluck JSON value
}

function download {
    RELEASE=$(get_latest_release 'cjbassi/gotop')
    ARCHIVE=gotop_${RELEASE}_${1}.tgz
    curl -LO https://github.com/cjbassi/gotop/releases/download/${RELEASE}/${ARCHIVE}
    tar xf ${ARCHIVE}
    rm ${ARCHIVE}
}

function main {
    ARCH=$(uname -sm)
    case "${ARCH}" in
        # order matters
        Darwin\ *64)        download darwin_amd64   ;;
        Darwin\ *86)        download darwin_386     ;;
        Linux\ armv5*)      download linux_arm5     ;;
        Linux\ armv6*)      download linux_arm6     ;;
        Linux\ armv7*)      download linux_arm7     ;;
        Linux\ armv8*)      download linux_arm8     ;;
        Linux\ aarch64*)    download linux_arm8     ;;
        Linux\ *64)         download linux_amd64    ;;
        Linux\ *86)         download linux_386      ;;
        *)
            echo "\
    No binary found for your system.
    Feel free to request that we prebuild one that works on your system."
            exit 1
            ;;
    esac
}

main

  1. 赋予脚本执行权限
chmod +x gotopDownload.sh
  1. 执行脚本,根据你当前的操作系统自动下载二进制文件gotop程序到当前目录下。
./gotopDownload.sh 
  1. 添加到系统命令
cp gotop /usr/local/bin

3、使用

Usage: gotop [options]

Options:
  -c, --color=NAME      Set a colorscheme. 设置配色方案
  -h, --help            Show this screen. 
  -m, --minimal         Only show CPU, Mem and Process widgets.  只查看CPU、内存和进程
  -r, --rate=RATE       Number of times per second to update CPU and Mem widgets [default: 1]. 设置每秒更新CPU和内存的次数。
  -V, --version         Print version and exit.
  -p, --percpu          Show each CPU in the CPU widget. 查看详细每个CPU使用率
  -a, --averagecpu      Show average CPU in the CPU widget. 查看每个CPU的平均使用率
  -f, --fahrenheit      Show temperatures in fahrenheit.  查看温度
  -s, --statusbar       Show a statusbar with the time.   查看状态栏 时间主机名等信息
  -b, --battery         Show battery level widget ('minimal' turns off). 查看电池电量

Colorschemes:   以下是可选配色方案
  default
  default-dark (for white background)
  solarized
  monokai
  vice
上一篇 下一篇

猜你喜欢

热点阅读