一款基于 Python 语言的 Linux 资源监视器!
时间:2022-07-23
本文章向大家介绍一款基于 Python 语言的 Linux 资源监视器!,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
大家好,我是 JackTian。
还记得前不久给大家推荐的《一款霸榜 GitHub 的开源 Linux 资源监视器!—— bashtop》吗?它是一个用 Bash 编写的 Linux 资源监视器。
昨天刚好闲逛 GitHub,发现这个作者又开源了一款基于 Python 语言的 Linux / OSX / FreeBSD 资源监视器 —— bpytop,其主要作用跟之前的 bashtop 大同小异,用于显示处理器,内存,磁盘,网络和进程的使用情况和状态。
首先我们先来看看 bpytop 资源监视器主界面。
特征
- 易使用,带有游戏启发的菜单系统;
- 完全支持鼠标,所有带有突出显示键的按钮均可单击,并且鼠标滚动可在进程列表和菜单框中使用;
- 快速反应灵敏的 UI,带有 UP,DOWN 键可自行过程选择;
- 用于显示所选进程的详细统计信息的功能;
- 具有过滤过程的能力,可输入多个过滤器;
- 在排序选项之间轻松切换;
- 将 SIGTERM,SIGKILL,SIGINT 发送到选定的进程;
- 用于更改所有配置文件选项的 UI 菜单;
- 网络使用情况的自动缩放图;
- 如有新版本可用,可在菜单选项中进行显示;
- 显示磁盘的当前读写速度;
Bpytop 使用与 bashtop 相同的主题文件,因此为 bashtop 制作的任何主题都可以使用。
可根据自己的需求修改及设置 Main 配色,在自定义设置主题时,重新生成一个名为.theme
的主题文件并设置默认变量赋值。
#Bashtop theme with default colors and black background
......
# Main background, empty for terminal default, need to be empty if you want transparent background
theme[main_bg]="#00"
# Main text color
theme[main_fg]="#cc"
# Title color for boxes
theme[title]="#ee"
# Higlight color for keyboard shortcuts
theme[hi_fg]="#90"
# Background color of selected item in processes box
theme[selected_bg]="#7e2626"
# Foreground color of selected item in processes box
theme[selected_fg]="#ee"
# Color of inactive/disabled text
theme[inactive_fg]="#40"
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
theme[proc_misc]="#0de756"
# Cpu box outline color
theme[cpu_box]="#3d7b46"
# Memory/disks box outline color
theme[mem_box]="#8a882e"
# Net up/down box outline color
theme[net_box]="#423ba5"
# Processes box outline color
theme[proc_box]="#923535"
# Box divider line and small boxes line color
theme[div_line]="#30"
# Temperature graph colors
theme[temp_start]="#4897d4"
theme[temp_mid]="#5474e8"
theme[temp_end]="#ff40b6"
# CPU graph colors
theme[cpu_start]="#50f095"
theme[cpu_mid]="#f2e266"
theme[cpu_end]="#fa1e1e"
# Mem/Disk free meter
theme[free_start]="#223014"
theme[free_mid]="#b5e685"
theme[free_end]="#dcff85"
# Mem/Disk cached meter
theme[cached_start]="#0b1a29"
theme[cached_mid]="#74e6fc"
theme[cached_end]="#26c5ff"
# Mem/Disk available meter
theme[available_start]="#292107"
theme[available_mid]="#ffd77a"
theme[available_end]="#ffb814"
# Mem/Disk used meter
theme[used_start]="#3b1f1c"
theme[used_mid]="#d9626d"
theme[used_end]="#ff4769"
# Download graph colors
theme[download_start]="#231a63"
theme[download_mid]="#4f43a3"
theme[download_end]="#b0a9de"
# Upload graph colors
theme[upload_start]="#510554"
theme[upload_mid]="#7d4180"
theme[upload_end]="#dcafde"
更多的主题配色,可通过 Bpytop 项目中的 themes 文件夹查看。
安装
依赖项安装 Linux,使用 python3 和 git 安装
安装 psutil python 模块(可能需要sudo)
# python3 -m pip install psutil
依赖项安装 OSX,用于显示 CPU 温度。
# brew install osx-cpu-temp
手动安装 Linux,OSX 和 FreeBSD
# git clone https://github.com/aristocratos/bpytop.git
# cd bpytop
# sudo make install
命令行选项
USAGE: bpytop [argument]
Arguments:
-m, --mini Start in minimal mode without memory and net boxes // 最小模式下启动
-v, --version Show version info and exit // 显示版本信息并退出
-h, --help Show this help message and exit // 显示此帮助信息并退出
--debug Start with loglevel set to DEBUG overriding value set in config
由此看来目前 bpytop 还处于开发阶段,接下来,还有很多要去做新功能:
最后贴下该项目 GitHub 地址,大家感兴趣的可前去围观:
https://github.com/aristocratos/bpytop
- NSNotificationCenter 通知的使用方法详解你要知道的KVC、KVO、Delegate、Notification都在这里
- Protocol与Delegate 使用方法详解你要知道的KVC、KVO、Delegate、Notification都在这里
- iOS多线程——你要知道的GCD都在这里你要知道的iOS多线程NSThread、GCD、NSOperation、RunLoop都在这里
- NSCopying和NSCoding对象序列化反序列化基础详解你要知道的NSCopying、NSCoding协议及对象序列化和反序列化都在这里
- KVO 正确使用姿势进阶及底层实现你要知道的KVC、KVO、Delegate、Notification都在这里
- iOS多线程——你要知道的NSOperation都在这里你要知道的iOS多线程NSThread、GCD、NSOperation、RunLoop都在这里
- iOS多线程——你要知道的NSThread都在这里你要知道的iOS多线程NSThread、GCD、NSOperation、RunLoop都在这里
- KVO、Delegate、Notification 区别及相关使用场景你要知道的KVC、KVO、Delegate、Notification都在这里
- Core ML简介及实时目标检测及Caffe TensorFlow coremltools模型转换
- iOS网络——NSURLSession详解及SDWebImage源码解析你要知道的NSURLSession都在这里
- BZOJ3585: mex(主席树)
- 01.LoT.UI 前后台通用框架分解系列之——小图片背景全屏显示(可自动切换背景)
- 02.LoT.UI 前后台通用框架分解系列之——灵活的菜单栏
- 05.LoT.UI 前后台通用框架分解系列之——漂亮的时间选择器
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Qt音视频开发21-通用硬解码
- Linux面试题基础宝典==面试必备
- linux常见面试题
- SignalR实现网页实时聊天功能
- 关于权限的一些想法
- AB153x API----captouch驱动程序
- Hacking with iOS: SwiftUI Edition - 愿望清单项目(二)
- C#设备处理类操作
- x509数字证书导入-然后删除自身
- winform总结4> 工欲善其事,必先利其器之xml校验
- 如何利用SNMP实现网络攻击缓解?
- winform总结5> winform程序开发注意事项
- mvc文件上传支持批量上传,拖拽以及预览,文件内容校验
- .net Core 1.0.1 下的Web框架的的搭建过程step by step
- 蓝牙芯片----BK34341开发笔记------快速入门(2)