System CPU/memory/GPU/hard disk monitoring and viewing commands under Ubuntu

1. Real-time monitoring CPUand内存

Htop monitoring

#安装
sudo apt-get install htop
#启动htop
htop

insert image description here

Ubuntu default monitor

Win+AOpen all APPs and search for System Monitor
insert image description hereSystem Monitor as follows

insert image description here

2. View hard disk space and partitions (df -h)

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           787M  1.8M  785M   1% /run
/dev/sda7       126G  7.8G  112G   7% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop0       62M   62M     0 100% /snap/core20/1611
/dev/loop2       55M   55M     0 100% /snap/snap-store/558
/dev/loop3       47M   47M     0 100% /snap/snapd/16292
/dev/loop1      347M  347M     0 100% /snap/gnome-3-38-2004/115
/dev/loop4       92M   92M     0 100% /snap/gtk-common-themes/1535
/dev/loop5      128K  128K     0 100% /snap/bare/5
/dev/sda6        75G  339M   71G   1% /home
tmpfs           787M   76K  787M   1% /run/user/1000

3. Monitor the GPU

Install nvidia-smi command

# 输入nvidia-smi命令提示,需要安装,如下所示
$nvidia-smi
Command 'nvidia-smi' not found, but can be installed with:

sudo apt install nvidia-340               # version 340.108-0ubuntu5.20.04.2, or
sudo apt install nvidia-utils-390         # version 390.157-0ubuntu0.20.04.1
sudo apt install nvidia-utils-450-server  # version 450.216.04-0ubuntu0.20.04.1
sudo apt install nvidia-utils-470         # version 470.161.03-0ubuntu0.20.04.1
sudo apt install nvidia-utils-470-server  # version 470.161.03-0ubuntu0.20.04.1
sudo apt install nvidia-utils-510         # version 510.108.03-0ubuntu0.20.04.1
sudo apt install nvidia-utils-515         # version 515.86.01-0ubuntu0.20.04.1
sudo apt install nvidia-utils-515-server  # version 515.86.01-0ubuntu0.20.04.2
sudo apt install nvidia-utils-525-server  # version 525.60.13-0ubuntu0.20.04.1
sudo apt install nvidia-utils-435         # version 435.21-0ubuntu7
sudo apt install nvidia-utils-440         # version 440.82+really.440.64-0ubuntu6
sudo apt install nvidia-utils-525         # version 525.78.01-0ubuntu0.20.04.1
sudo apt install nvidia-utils-418-server  # version 418.226.00-0ubuntu0.20.04.2

install nvidia-smicommand

# 安装
sudo apt install nvidia-340
# 查看
nvidia-smi

After executing the command, the displayed content is as follows

$ nvidia-smi
Thu Jan 19 17:17:32 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.78.01    Driver Version: 525.78.01    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   40C    P8    N/A /  N/A |      7MiB /  2048MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       855      G   /usr/lib/xorg/Xorg                  2MiB |
|    0   N/A  N/A      1465      G   /usr/lib/xorg/Xorg                  2MiB |
+-----------------------------------------------------------------------------+

Enter nvidia-smi, it prompts an error
$ nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running. It prompts that the
graphics card driver is not installed

Refresh
watch -n 1 nvidia-smi every 1 second

Guess you like

Origin blog.csdn.net/youlinhuanyan/article/details/128734097