2023年1月6日 星期五

Detect if a VM is running in Google Compute Engine

Detect if a VM is running in Compute Engine

sudo dmidecode -s system-product-name | grep "Google Compute Engine"
這個需要 root 權限,實際上是去讀取 /sys/firmware/dmi/tables/DMI
用 strings /sys/firmware/dmi/tables/DMI | grep "Google Compute Engine" 也行

若程式沒有 root 權限,可以去讀取 /etc/hosts 有沒有包含 Added by Google 字樣
grep "Added by Google" /etc/hosts

沒有留言:

Install w3m in Rocky Linux

Rocky Linux 中安裝 w3m 需要啟用 powertools repo 未啟用前安裝會出現此錯誤 - nothing provides perl(NKF) needed by w3m-0.5.3-60.git20230121.el8.x86_64 from epel ...