Exploring Essential System Commands on Ubuntu Server
https://chat.jlikr.com/s/7fa13c2d-526e-4e7d-87c6-53e102c6ed13
When managing a server, it's crucial to understand its hardware and software configurations. In this guide, we'll explore several essential commands that provide critical system information on an Ubuntu server. These tools will help you diagnose issues, optimize performance, and ensure your server is running smoothly.
1. CPU Information with lscpu
The lscpu command displays detailed information about the CPU architecture and configuration of your server. This is particularly useful for understanding the capabilities and limits of your system.
cc@igweb4:~$ lscpu | grep -E "Model name|Architecture|CPU(s)|Thread|Core|Socket"
Output:
Architecture: x86_64 CPU(s): 32 Model name: AMD Ryzen 9 3950X 16-Core Processor Thread(s) per core: 2 Core(s) per socket: 16 Socket(s): 1
Architecture: x86_64 indicates a 64-bit system. CPU(s): The total number of logical CPUs (32 in this case). Model name: Specifies the processor model (AMD Ryzen 9 3950X). Thread(s) per core: Each core supports 2 threads (Hyper-Threading). Core(s) per socket: There are 16 physical cores. Socket(s): The server has 1 CPU socket.
- Memory Usage with free -h
The free command provides information about memory usage, including both RAM and swap space. Using the -h flag displays values in a human-readable format (e.g., GiB).
cc@igweb4:~$ free -h
Output:
total used free shared buff/cache available
Mem: 62Gi 2.2Gi 59Gi 1.7Mi 1.6Gi 60Gi
Swap: 8.0Gi 0B 8.0Gi
-
Mem: Total installed RAM is 62 GiB. - Used: Currently, 2.2 GiB of RAM is in use.
- Free: Approximately 59 GiB of RAM is available for new processes.
- Available: The amount of memory that can be allocated without swapping.
- Disk Partitions with lsblk
The lsblk command displays information about block devices, including disks and partitions. It's useful for understanding the storage layout of your server.
ji@igweb4:~$ lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT,MODEL
Output:
NAME SIZE TYPE FSTYPE MOUNTPOINT MODEL
sda 0B disk Card Reader
nvme1n1 953.9G disk ADATA SX8200PNP
└─nvme1n1p1 953.9G part ext4 /mnt/docker
nvme0n1 931.5G disk Samsung SSD 970 EVO Plus 1TB
├─nvme0n1p1 1G part vfat /boot/efi
└─nvme0n1p2 930.5G part ext4 /
[ NAME: The device name (e.g., sda, nvme1n1). SIZE: Total size of the disk or partition. TYPE: Indicates whether it's a disk (disk) or a partition (part). FSTYPE: File system type (e.g., ext4, vfat). MOUNTPOINT: Where the partition is mounted in the file system. MODEL: The model name of the storage device.
- Operating System Information with uname -a and /etc/os-release
The uname command provides detailed information about your kernel and operating system, while /etc/os-release contains metadata about your Linux distribution.]( NAME: The device name (e.g., sda, nvme1n1). SIZE: Total size of the disk or partition. TYPE: Indicates whether it's a disk (disk) or a partition (part). FSTYPE: File system type (e.g., ext4, vfat). MOUNTPOINT: Where the partition is mounted in the file system. MODEL: The model name of the storage device.
- Operating System Information with uname -a and /etc/os-release
The uname command provides detailed information about your kernel and operating system, while /etc/os-release contains metadata about your Linux distribution.)