3 篇文章带有标签 “disk”

命令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

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

磁盘:分区-格式化-挂载

分区

列出块设备信息

lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
loop0    7:0    0 71.3M  1 loop /snap/lxd/18772
loop1    7:1    0 55.4M  1 loop /snap/core18/1944
loop2    7:2    0 31.1M  1 loop /snap/snapd/10492
loop3    7:3    0 31.1M  1 loop /snap/snapd/10707
loop4    7:4    0 71.2M  1 loop /snap/lxd/18674
loop5    7:5    0 55.4M  1 loop /snap/core18/1932
sda      8:0    1  558G  0 disk 
├─sda1   8:1    1    1M  0 part 
└─sda2   8:2    1  558G  0 part /
sdb      8:16   1  2.2T  0 disk 

创建分区 sudo fdisk /dev/sdb Welcome to fdisk (util-linux 2.34). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.