取得實際終端的記憶體使用量

取得實際終端的記憶體使用量

我正在嘗試獲取流程實際的被封鎖、正在運作或準備執行的終端。我不知道如何使用 ps 或 top...有人能告訴我從哪裡獲取該資訊嗎?

答案1

terminal="konsole"
 ps auwx|grep $terminal|grep -v "grep"|awk '{print $NF ": PID:" $2 " CPU USED:" $3 " MEM USED:" $4 }'
/usr/bin/konsole: PID:3550 CPU USED:0.0 MEM USED:0.7


 terminal="terminator"
 ps auwx|grep $terminal|grep -v "grep"|awk '{print $NF ": PID:" $2 " CPU USED:" $3 " MEM USED:" $4 }'
/usr/bin/terminator: PID:3616 CPU USED:0.7 MEM USED:0.7

相關內容