- 1. free command – get free and used memory (How Get free and used memory in Linux ?)
- 2. hwinfo command
- 3. id command
- 4. lsblk command – list block storage devices
- 5. lsb_release – Linux distribution information
- 6. lscpu – display info about the CPUs
- 7. lstopo – display hardware topology
- 8. lsusb – list usb devices
- 9. timedatectl – view current date and time zone
- 10. w – who is logged in
Sometimes, as a Linux server administrator or a Linux system user, you may want to have information about your system specifications, including resources, hardware, processor, and so on. For this purpose, we introduce some common commands.
1. free command – get free and used memory (How Get free and used memory in Linux ?) #
Want to know more about your server or Linux system RAM ? How much RAM do you have and how free is it? Use the free command to show the total amount of free and used physical (RAM) and swap memory in the Linux system. It also displays the buffers and caches used by the kernel:
free
# human readable outputs
free -h
# use the cat command to find geeky details
cat /proc/meminfo
However, the free command will not give information about memory configurations, maximum supported memory by the Linux server, and Linux memory speed. Hence, we must use the dmidecode command:
Want to determine the amount of video memory under Linux, try:
lspci | grep -i vga
glxinfo | egrep -i ‘device|memory
2. hwinfo command #
We can quickly probe for the hardware present in the Linux server or desktop:
# Find detailed info about the Linux box
hwinfo
# Show only a summary #
hwinfo –short
# View all disks #
hwinfo –disk
# Get an overview #
hwinfo –short –block
# Find a particular disk #
hwinfo –disk –only /dev/sda
hwinfo –disk –only /dev/sda
3. id command #
Display Linux user and group information for the given USER name. If user name omitted show information for the current user:
id
uid=1000(mahdi) gid=1000(mahdi) groups=1000(mahdi),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),115(lpadmin),116(sambashare),998(lxd)
See who is logged on your Linux server :
who
who am i
4. lsblk command – list block storage devices #
All Linux block devices give buffered access to hardware devices and allow reading and writing blocks as per configuration. Linux block device has names. For example, /dev/nvme0n1 for NVMe and /dev/sda for SCSI devices such as HDD/SSD. But you don’t have to remember them. You can list them easily using the following syntax :
lsblk
# list only #
lsblk -l
# filter out loop devices using the grep command #
lsblk -l | grep ‘^loop’
5. lsb_release – Linux distribution information #
Want to get distribution-specific information such as, description of the currently installed distribution, release number and code name:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
6. lscpu – display info about the CPUs #
The lscpu command gathers and displays CPU architecture information in an easy-to-read format for humans including various CPU bugs :
lscpu
Cpu can be listed using the lshw command too :
sudo lshw -C cpu
7. lstopo – display hardware topology #
Want to see the topology of the Linux server or desktop? Try :
lstopo
lstopo-no-graphics
You will see information about:
1. NUMA memory nodes
2. shared caches
3. CPU packages
4. Processor cores
5. processor “threads” and more
8. lsusb – list usb devices #
We all use USB devices, such as external hard drives and keyboards. Run the NA command for displaying information about USB buses in the Linux system and the devices connected to them.
lsusb
# Want a graphical summary of USB devices connected to the system? #
sudo usbview
9. timedatectl – view current date and time zone #
Typically we use the date command to set or get date/time information on the CLI:
# date
However, modern Linux distro use the timedatectl command to query and change the system clock and its settings, and enable or disable time synchronization services (NTPD and co):
timedatectl
Local time: Sun 2020-07-26 16:31:10 IST
Universal time: Sun 2020-07-26 11:01:10 UTC
RTC time: Sun 2020-07-26 11:01:10
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
10. w – who is logged in #
Run the w command on Linux to see information about the Linux users currently on the machine, and their processes:
#w