Linuxメモ : Linuxリソースモニターのbashtopを試してみる
bashtop
bashtopはCPU、メモリ、ディスク、ネットワーク、プロセス情報を表示するリソースモニター。
特徴は以下のとおり。
- Easy to use, with a game inspired menu system.
- Fast and "mostly" responsive UI with UP, DOWN keys process selection.
- Function for showing detailed stats for selected process.
- Ability to filter processes.
- Easy switching between sorting options.
- Send SIGTERM, SIGKILL, SIGINT to selected process.
- UI menu for changing all config file options.
- Auto scaling graph for network usage.
- Shows message in menu if new version is available
インストール
README.mdによるとBash 5.0がオススメということなので、まずはBash 5.0をインストールする。
bash (v4.4 or later) Script functionality will most probably break with earlier versions. Bash version 5 is highly recommended to make use of $EPOCHREALTIME variable instead of a lot of external date command calls.
以下のような感じでインストール。
$ curl -LO http://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz $ tar zxvf bash-5.0.tar.gz $ cd bash-5.0 $ CC=cc ./configure $ make $ sudo make install
バージョンを確認。
$ bash --version GNU bash, version 5.0.0(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
bashtopはREADME.mdのインストール方法によるとバイナリのダウンロードやmake
でインストールできる。
$ curl -LO https://github.com/aristocratos/bashtop/archive/v0.8.24.tar.gz $ tar zxvf v0.8.24.tar.gz $ sudo cp bashtop-0.8.24/bashtop /usr/local/bin $ bashtop
なお、Bashのバージョンが4.4未満だと下記メッセージが表示され起動できない。
$ bashtop ERROR: Bash 4.4 or later is required (you are using Bash 4.2). Consider upgrading your distribution to get a more recent Bash version.
使い方
bashtop
コマンドを実行すると起動できる。
h
キーを押すとヘルプ画面が表示される(ヘルプ画面を閉じるにはq
キー)。
o
キーを押すとオプション画面が表示される。
メイン画面で上下キーによりプロセスを選択してk
キーでプロセスをKillすることもできる。
設定ファイルは下記パスにある。
$ cat ~/.config/bashtop/bashtop.cfg #? Config file for bashtop v. 0.8.24 #* Color theme, looks for a .theme file in "$HOME/.config/bashtop/themes", "Default" for builtin default theme color_theme="Default" #* Update time in milliseconds, increases automatically if set below internal loops processing time, recommended 2000 ms or above for better sample times for graphs update_ms="2500" #* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu responsive" "tree" #* "cpu lazy" updates sorting over time, "cpu responsive" updates sorting directly at a cpu usage cost proc_sorting="cpu lazy" #* Reverse sorting order, "true" or "false" proc_reversed="false" #* Check cpu temperature, only works if "sensors" command is available and have values for "Package" and "Core" check_temp="false" #* Draw a clock at top of screen, formatting according to strftime, empty string to disable draw_clock="%X" #* Update main ui when menus are showing, set this to false if the menus is flickering too much for comfort background_update="true" #* Custom cpu model name, empty string to disable custom_cpu_name="" #* Enable error logging to "$HOME/.config/bashtop/error.log", "true" or "false" error_logging="true" #* Show color gradient in process list, "true" or "false" proc_gradient="true" #* If process cpu usage should be of the core it's running on or usage of the total available cpu power proc_per_core="false" #* Optional filter for shown disks, should be names of mountpoints, "root" replaces "/", separate multiple values with space disks_filter=""
例えばカラーテーマを変更したい場合は、以下のカラーテーマの中からcolor_theme="monokai"
のように指定すれば変更できる。
$ ls ~/.config/bashtop/themes default_black.theme flat-remix-light.theme flat-remix.theme greyscale.theme gruvbox_dark.theme monokai_nobg.theme monokai.theme solarized_dark.theme whiteout.theme