Linux - Hardware 정보를 보여주는 명령어

JS · 19 Jan 2020

Linux에서 PC의 하드웨어 정보를 확인하는 명령어를 정리하였습니다.

  • lscpu : CPU 정보를 출력합니다.
  • lshw : 하드웨어 리스트를 출력합니다.
  • hwinfo : 하드웨어 정보를 출력합니다.
  • lsblk : block device들의 정보를 보여줍니다.
  • df : 파일시스템의 disk space의 사용량을 보여줍니다.
  • free : 여유 메모리 및 사용 중인 메모리를 보여줍니다.

lscpu

lscpu 명령어는 CPU 정보를 출력합니다.

$ lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  2
Core(s) per socket:  4
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
CPU family:          6
Model:               60
Model name:          Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
Stepping:            3
CPU MHz:             1499.542
CPU max MHz:         3800.0000
CPU min MHz:         800.0000

lshw

lshw 명령어는 다양한 하드웨어 리스트를 출력합니다. (sudo로 실행하면 더 많은 정보를 보여주는 것 같습니다.)

-short 옵션을 주면 path와 함께 간단히 요약된 정보를 보여줍니다.

$ sudo lshw -short
H/W path               Device     Class          Description
============================================================
                                  system         To Be Filled By O.E.M. (To Be Filled By O.E.M.)
/0                                bus            B85M Pro4
/0/0                              memory         64KiB BIOS
/0/b                              memory         256KiB L1 cache
/0/c                              processor      Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
/0/c/d                            memory         1MiB L2 cache
/0/c/e                            memory         8MiB L3 cache
/0/f                              memory         24GiB System Memory
/0/f/0                            memory         8GiB DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
...
/0/1/0.0.0             /dev/sda   disk           500GB Samsung SSD 850
/0/1/0.0.0/1           /dev/sda1  volume         201GiB EXT4 volume
/0/1/0.0.0/2           /dev/sda2  volume         264GiB EXT4 volume

hwinfo

hwinfo는 하드웨어 정보를 보여주는 명령어입니다.

다음과 같이 apt로 설치할 수 있습니다.

$ sudo apt install hwinfo

다음과 같이 --short 옵션을 주면 요약된 정보가 출력됩니다.

$ hwinfo --short
cpu:                                                            
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 2597 MHz
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 3014 MHz
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 3443 MHz
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 3341 MHz
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 3258 MHz
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 3045 MHz
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 3325 MHz
                       Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz, 3242 MHz
keyboard:
  /dev/input/event3    STMicroelectronics 84EC-S
mouse:
  /dev/input/mice      Pixart Imaging Optical Mouse
  /dev/input/mice      Sunplus Innovation Optical Mouse
graphics card:
                       nVidia GK208 [GeForce GT 730]
sound:
                       Intel 8 Series/C220 Series Chipset High Definition Audio Controller
                       nVidia GK208 HDMI/DP Audio Controller
storage:
                       Intel 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
network:
  enp0s25              Intel Ethernet Connection I217-V
network interface:
  lo                   Loopback network interface
  enp0s25              Ethernet network interface
disk:
  /dev/sdb             RevuAhn_850X1S12
  /dev/sdc             Samsung P3 Portable
  /dev/sda             Samsung SSD 850
partition:
  /dev/sdb1            Partition
  /dev/sdb2            Partition
  /dev/sdc1            Partition
  /dev/sda1            Partition
  /dev/sda2            Partition
usb controller:
                       Intel 8 Series/C220 Series Chipset Family USB EHCI #2
                       Intel 8 Series/C220 Series Chipset Family USB EHCI #1
                       Intel 8 Series/C220 Series Chipset Family USB xHCI
bios:
                       BIOS
bridge:
                       ASMedia ASM1083/1085 PCIe to PCI Bridge
                       Intel 8 Series/C220 Series Chipset Family PCI Express Root Port #1
                       Intel B85 Express LPC Controller
                       Intel Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller
                       Intel 82801 PCI Bridge
                       Intel Xeon E3-1200 v3 Processor DRAM Controller
hub:
                       Intel Hub
                       Linux Foundation 2.0 root hub
                       Linux Foundation 3.0 root hub
                       Linux Foundation 2.0 root hub
                       Intel Hub
                       Linux Foundation 2.0 root hub
memory:
                       Main Memory
unknown:
                       FPU
                       DMA controller
                       PIC
                       Keyboard controller
  /dev/lp0             Parallel controller
                       Intel 8 Series/C220 Series Chipset Family MEI Controller #1
                       Intel 8 Series/C220 Series Chipset Family SMBus Controller
                       Serial controller
                       STMicroelectronics 84EC-S

lsblk

lsblk는 block device들의 정보를 보여줍니다. sysfsudev db 정보를 읽어서 보여줍니다.

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  54.7M  1 loop /snap/core18/1650
loop1    7:1    0  19.7M  1 loop /snap/okular/52
loop2    7:2    0  54.6M  1 loop /snap/core18/1288
loop3    7:3    0 409.4M  1 loop /snap/gimp/227
loop4    7:4    0 219.1M  1 loop /snap/gimp/189
loop5    7:5    0  49.2M  1 loop /snap/tizonia/293
loop6    7:6    0    85M  1 loop /snap/simplescreenrecorder-mardy/4
loop7    7:7    0 192.1M  1 loop /snap/eclipse/29
loop8    7:8    0  49.2M  1 loop /snap/tizonia/297
loop9    7:9    0 255.6M  1 loop /snap/kde-frameworks-5-core18/30
loop10   7:10   0  44.9M  1 loop /snap/gtk-common-themes/1440
loop11   7:11   0 260.7M  1 loop /snap/kde-frameworks-5-core18/32
loop12   7:12   0  90.3M  1 loop /snap/coolreader3/1
loop13   7:13   0  10.7M  1 loop /snap/kubectl/1357
loop14   7:14   0  44.2M  1 loop /snap/gtk-common-themes/1353
loop15   7:15   0  89.1M  1 loop /snap/core/8268
loop16   7:16   0   132K  1 loop /snap/gtk2-common-themes/5
loop17   7:17   0 184.8M  1 loop /snap/eclipse/40
loop18   7:18   0  87.5M  1 loop /snap/buka/2
loop19   7:19   0   236M  1 loop /snap/kde-frameworks-5/27
loop20   7:20   0 136.2M  1 loop /snap/bookworm/3
loop21   7:21   0    10M  1 loop /snap/kubectl/1373
loop22   7:22   0  86.8M  1 loop /snap/flameshot-app/188
loop23   7:23   0  19.7M  1 loop /snap/okular/63
loop24   7:24   0  89.1M  1 loop /snap/core/8213
sda      8:0    0 465.8G  0 disk
├─sda1   8:1    0 201.7G  0 part /home/mjs/backup
└─sda2   8:2    0 264.1G  0 part /
sdb      8:16   0 119.2G  0 disk
├─sdb1   8:17   0 118.4G  0 part
└─sdb2   8:18   0   903M  0 part
sdc      8:32   0 465.8G  0 disk
└─sdc1   8:33   0 465.8G  0 part /media/mjs/SAMSUNG1

df

df는 파일시스템의 disk space의 사용량을 보여줍니다.

-h옵션은 disk 크기를 읽기 편한 단위로 출력해줍니다.

mjs@mjs:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             12G     0   12G   0% /dev
tmpfs           2.4G  2.0M  2.4G   1% /run
/dev/sda2       259G  222G   25G  91% /
tmpfs            12G  124M   12G   2% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs            12G     0   12G   0% /sys/fs/cgroup
/dev/loop0       55M   55M     0 100% /snap/core18/1650
/dev/loop1       20M   20M     0 100% /snap/okular/52
/dev/loop4      220M  220M     0 100% /snap/gimp/189
/dev/loop2       55M   55M     0 100% /snap/core18/1288
/dev/loop5       50M   50M     0 100% /snap/tizonia/293
/dev/loop3      410M  410M     0 100% /snap/gimp/227
/dev/loop6       85M   85M     0 100% /snap/simplescreenrecorder-mardy/4
/dev/loop8       50M   50M     0 100% /snap/tizonia/297
...

free

free는 여유 메모리 및 사용 중인 메모리를 보여줍니다.

-m옵션은 크기를 MB로 출력합니다.

$ free -m
              total        used        free      shared  buff/cache   available
Mem:          24023        4651        9963         166        9408       18828
Swap:          2047           0        2047

참고