常用系统命令1
1、du 统计磁盘文件使用情况
zh7152106@zh7152106:~$ du -h -d 1 4.0K ./.cache 28K .
2、df 打印文件系统信息
1 zh7152106@zh7152106:~$ df -h 2 Filesystem Size Used Avail Use% Mounted on 3 udev 971M 0 971M 0% /dev 4 tmpfs 199M 6.2M 193M 4% /run 5 /dev/mapper/zh7152106--vg-root 18G 1.7G 16G 10% / 6 tmpfs 992M 0 992M 0% /dev/shm 7 tmpfs 5.0M 0 5.0M 0% /run/lock 8 tmpfs 992M 0 992M 0% /sys/fs/cgroup 9 /dev/sda1 720M 58M 626M 9% /boot 10 tmpfs 199M 0 199M 0% /run/user/1000
3、fdisk 显示和管理磁盘分区
1 zh7152106@zh7152106:~$ sudo fdisk -l 2 Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors 3 Units: sectors of 1 * 512 = 512 bytes 4 Sector size (logical/physical): 512 bytes / 512 bytes 5 I/O size (minimum/optimal): 512 bytes / 512 bytes 6 Disklabel type: dos 7 Disk identifier: 0x10dac547
注意:扇区,sector属于磁盘的物理概念,是物理擦写的最小单位;
多个扇区组成一个磁盘块,属于软件系统的概念,每个块上仅能存在一个文件的内容信息,即文件实际占用空间是块的整数倍;
页,属于内存的最小存储单位,通常为块的2^n倍大小。
4、stat 显示文件或文件系统信息,如下显示块大小。
1 zh7152106@zh7152106:~$ stat /boot 2 File: '/boot' 3 Size: 4096 Blocks: 8 IO Block: 4096 directory 4 Device: 801h/2049d Inode: 2 Links: 4 5 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) 6 Access: 2020-06-20 09:12:55.700103302 +0800 7 Modify: 2020-06-20 09:13:10.080103725 +0800 8 Change: 2020-06-20 09:13:10.080103725 +0800
5、blockdev 显示设备块相关信息
6、getconf 获取当前配置信息,如下获取页大小
1 zh7152106@zh7152106:~$ getconf PAGESIZE 2 4096 3 zh7152106@zh7152106:~$ getconf -a 4 LINK_MAX 65000 5 _POSIX_LINK_MAX 65000 6 MAX_CANON 255 7 _POSIX_MAX_CANON 255 8 MAX_INPUT 255 9 _POSIX_MAX_INPUT 255 10 NAME_MAX 255 11 _POSIX_NAME_MAX 255
7、lscpu 显示cpu相关信息
1 zhangyangguang@ubuntu:~/test/hello_insmod$ lscpu 2 Architecture: x86_64 3 CPU op-mode(s): 32-bit, 64-bit 4 Byte Order: Little Endian 5 CPU(s): 4 6 On-line CPU(s) list: 0-3 7 Thread(s) per core: 1 8 Core(s) per socket: 1 9 Socket(s): 4 10 NUMA node(s): 1 11 Vendor ID: GenuineIntel 12 CPU family: 6 13 Model: 142 14 Stepping: 9 15 CPU MHz: 2711.999 16 BogoMIPS: 5423.99 17 Hypervisor vendor: VMware 18 Virtualization type: full 19 L1d cache: 32K 20 L1i cache: 32K 21 L2 cache: 256K 22 L3 cache: 3072K

浙公网安备 33010602011771号