什么是 Bashtop?
Bashtop 是一个基于命令行的资源监视器,用 bash,它描述了 CPU 处理器、RAM、硬盘、网络源和其他正在运行的进程的使用情况和统计信息。 它还包含一个可定制的菜单和一个完全响应的终端用户界面。
一种 较新的版本 bashtop 现在可用,它是用 Python 编写的,称为 bpytop. 这个 CLI 版本要快得多,并且只消耗原始 bashtop 的 1/3 左右的资源。 它占用的 CPU 更少,并且包含更多功能,例如:
- 鼠标支持
- 可切换的迷你模式
- 额外的定制
- 内存消耗的具体图表
先决条件 对于 Bash 版本
- Bash 版本 4.4 或更高版本
- 吉特
- GNU Coreutils
- GNU 命令行工具 — sed、awk、grep、ps 和 curl (curl 用于更新和添加额外的主题)
- Lm-sensors(可选 – 用于收集 CPU 温度统计信息)
- Python3 和 PSUTI
先决条件 对于 Python 版本
- Python3 (v3.6 或更高版本)
- psutil 模块 (v5.7.0 或更高版本)
安装 bpytop
要安装或更新到最新版本,请使用以下 Pip 命令。
[root@host2 ~]# pip3 install bpytop --upgrade
或者,我们可以使用 Git 克隆安装。
[root@host2 ~]# git clone https://github.com/aristocratos/bpytop.git
[root@host2 ~]# cd bpytop
[root@host2 ~]# make install
安装 Bashtop
安装
要在 Linux、OSX 和 FreeBSD 上手动安装 bashtop,我们可以使用 Git 克隆和安装它。
[root@host2 ~]# git clone https://github.com/aristocratos/bashtop.git
[root@host2 ~]# cd bashtop
[root@host2 ~]# sudo make install
卸载 Bashtop
要卸载 bashtop,请运行以下命令。
[root@host2 ~]# make uninstall
Debian 安装
基于 Debian 的安装可在 官方 Debian 存储库. 要安装它,请运行以下命令之一。
[root@host2 ~]# apt install bashtop
[root@host2 ~]# apt install bpytop
Ubuntu 安装
从 Ubuntu 20.10 开始,官方 Ubuntu 存储库中提供了基于 Ubuntu 的安装。 要安装 bashtop,请添加 PPA 存储库并使用 apt 安装程序。
[root@host2 ~]# add-apt-repository ppa:bashtop-monitor/bashtop
[root@host2 ~]# apt update
[root@host2 ~]# apt install bashtop
快速安装
要使用基于 snap 的安装方法安装 bashtop,请运行此命令。
[root@host2 ~]# snap install bashtop
or
[root@host2 ~]# snap install bpytop
安装 bashtop 后,运行这些命令以允许 snap 按预期运行。
[root@host2 ~]# snap connect bashtop:mount-observe
[root@host2 ~]# snap connect bashtop:network-control
[root@host2 ~]# snap connect bashtop:hardware-observe
[root@host2 ~]# snap connect bashtop:system-observe
[root@host2 ~]# snap connect bashtop:process-control
要修改配置文件并添加主题,请运行此命令。
[root@host2 ~]# ~/snap/bashtop/current/.config/bashtop
CentOS 8 使用 DNF 安装
要在 CentOS 8 上安装 bashtop,请使用以下命令之一。
[root@host2 ~]# dnf install bpytop
[root@host2 ~]# dnf config-manager --set-enabled powertools
[root@host2 ~]# dnf install epel-release
Last metadata expiration check: 0:24:54 ago on Tue Dec 29 10:51:04 2020.
Dependencies resolved.
================================================================
Package Architecture Version Repository Size
================================================================
Installing:
epel-release noarch 8-8.el8 system-Extras 23 k
Transaction Summary
================================================================
Install 1 Package
Total download size: 23 k
Installed size: 32 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-8-8.el8.noarch.rpm 861 kB/s | 23 kB 00:00
--------------------------------------------------------------------
Total 837 kB/s | 23 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : epel-release-8-8.el8.noarch 1/1
Running scriptlet: epel-release-8-8.el8.noarch 1/1
Verifying : epel-release-8-8.el8.noarch 1/1
Installed:
epel-release-8-8.el8.noarch
Complete!
[root@host2 ~]# dnf install bashtop
Extra Packages for Enterprise Linux Modular 8 - x86_64 1.8 MB/s | 528 kB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 32 MB/s | 8.7 MB 00:00
Dependencies resolved.
================================================================
Package Architecture Version Repository Size
================================================================
Installing:
bashtop noarch 0.9.25-1.el8 epel 70 k
Installing dependencies:
python3-psutil x86_64 5.6.3-5.el8 epel 396 k
Transaction Summary
================================================================
Install 2 Packages
Total download size: 466 k
Installed size: 2.3 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): bashtop-0.9.25-1.el8.noarch.rpm 2.5 MB/s | 70 kB 00:00
(2/2): python3-psutil-5.6.3-5.el8.x86_64.rpm 11 MB/s | 396 kB 00:00
--------------------------------------------------------------------
Total 2.6 MB/s | 466 kB 00:00
warning: /var/cache/dnf/epel-6519ee669354a484/packages/bashtop-0.9.25-1.el8.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 2f86d6a1: NOKEY
Extra Packages for Enterprise Linux 8 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x2F86D6A1:
Userid : "Fedora EPEL (8) <[email protected]>"
Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-psutil-5.6.3-5.el8.x86_64 1/2
Installing : bashtop-0.9.25-1.el8.noarch 2/2
Running scriptlet: bashtop-0.9.25-1.el8.noarch 2/2
Verifying : bashtop-0.9.25-1.el8.noarch 1/2
Verifying : python3-psutil-5.6.3-5.el8.x86_64 2/2
Installed:
bashtop-0.9.25-1.el8.noarch python3-psutil-5.6.3-5.el8.x86_64
Complete!
[root@host2 ~]#
使用 EPEL 存储库安装 RHEL 8 / CentOS 8
CentOS 8:首先,启用 EPEL 存储库,然后运行以下 yum 命令。
[root@host2 ~]# yum -y install epel-release
[root@host2 ~]# yum repolist
[root@host2 ~]# yum update
[root@host2 ~]# yum install bashtop
or
[root@host2 ~]# yum install bpytop
红帽 8:首先,使用以下命令启用 EPEL 存储库。
[root@host2 ~]# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
[root@host2 ~]# yum repolist
[root@host2 ~]# yum update
[root@host2 ~]# yum install bashtop
or
[root@host2 ~]# yum install bpytop
运行 Bashtop
要启动应用程序,请运行以下命令之一。
[root@host2 ~]# bashtop
[root@host2 ~]# bpytop
从上面的截图中我们可以看到,基本布局提供了以下信息:
- CPU 类型和内核数。
- 负载平均值。
- 内存使用情况。
- 已用和可用磁盘空间。
- 正在运行的进程列表。
- 穿越我们网卡的网络流量,在本例中为“eth0”。
Bashtop 还包含多个命令和快捷方式。 要查看它们,请按 ESC 键,然后使用向上和向下箭头键选择“帮助”选项。 以下是帮助屏幕上显示的帮助命令的完整列表。
配置 Bashtop
要配置 bashtop,我们还可以打开并编辑位于“$HOME/.config/bashtop” 文件夹或“$HOME/.config/bpytop” 文件夹。 所有选项也可以在用户界面中进行编辑。 这 bashtop.cfg 或 bpytop.cfg如果找不到文件将自动生成。 这是默认的示例视图 bashtop 配置 文件和默认值 bpytop 配置 文件。
结论
Bashtop 是监控我们的 Linux 系统资源的绝佳方法。 bashtop 的一个小缺点是它的响应速度可能比 htop 或 top 慢,因为它需要更多的资源。 尽管如此,它还是一个可靠的工具,可以添加到您的 Linux 工具箱中,以提供有关各种系统指标的相关信息。
我们的支持团队由经验丰富的 Linux 技术人员和才华横溢的系统管理员组成,他们对多种网络托管技术有着深入的了解,尤其是本文中讨论的技术。
如果您对此信息有任何疑问,我们将随时为您解答与本文相关问题的任何询问,每天 24 小时、每周 7 天、每年 365 天。
如果您是完全托管的 VPS 服务器, Cloud 专用,VMWare 私有 Cloud私有父服务器, 托管 Cloud 服务器或专用服务器所有者,并且您对执行概述的任何步骤感到不舒服,可以通过电话@800.580.4985 联系我们, 聊天 或支持票以帮助您完成此过程。