肝!一款基于 Python 语言的 Linux 资源监视器!
還記得前不久給大家推薦的《一款霸榜 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
- End -由于微信平臺算法改版,公號內容將不再以時間排序展示,如果大家想第一時間看到我們的推送,強烈建議星標我們和給我們多點點【在看】。星標具體步驟為: (1)點擊頁面最上方“小詹學Python”,進入公眾號主頁。(2)點擊右上角的小點點,在彈出頁面點擊“設為星標”,就可以啦。感謝支持,比心。總結
以上是生活随笔為你收集整理的肝!一款基于 Python 语言的 Linux 资源监视器!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 写代码爬取了某 Hub 资源,只为撸这个
- 下一篇: 干货|且看Pyecharts如何制作多个