3 篇文章带有标签 “system-info”

命令du

du - 估计文件空间使用量

    -s, --summarize display only a total for each argument
    -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)

查看当前文件夹所有文件占用的空间

du -sh
15G	.

查看当前文件夹下的一级目录和文件占用的空间

du -sh *
14G	ailab
178M	software
4.0K	test.txt
33M	tmp

命令top

快捷键

  • Shift+p 按CPU使用率排序
  • Shift+m 按内存使用率排序
  • 1 显示每个逻辑CPU的状态

查看指定进程

top -p $pid
  • 查看1号进行
top -p 1
top -p1
top - 22:58:02 up 323 days, 12:09,  2 users,  load average: 0.64, 0.61, 0.38
Tasks:   1 total,   0 running,   1 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.2 us,  1.8 sy,  0.0 ni, 90.3 id,  0.0 wa,  0.5 hi,  0.2 si,  0.0 st
MiB Mem :   3780.8 total,    400.2 free,   1749.6 used,   1631.0 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.   1939.3 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
    1 root      20   0  178540   7680   3792 S   0.0   0.2   7:50.54 systemd

Linux上查找系统信息

操作系统

Linux内核版本

  • uname
$ uname -r
4.18.0-147.5.1.el8_1.x86_64
  • /proc/version
$ cat /proc/version
Linux version 4.18.0-147.5.1.el8_1.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Wed Feb 5 02:00:39 UTC 2020
  • hostnamectl
$ hostnamectl | grep Kernel
            Kernel: Linux 4.18.0-147.5.1.el8_1.x86_64

查找CODENAME

$ cat /etc/os-release | grep VERSION_CODENAME 
VERSION_CODENAME=focal

操作系统信息

$ lsb_release -a
  • Ubuntu
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04 LTS
Release:	20.04
Codename:	focal
  • CentOS
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 8.1.1911 (Core) 
Release:	8.1.1911
Codename:	Core