10 Linux commands to know the system

10 Linux command to know the system
Here are 10 Linux command to know the system and increase your productivity quickly.


10 Linux commands to know the system

Open the terminal application and then start typing these commands to know your Linux desktop or cloud server/VM.

1. free – get free and used memory

Are you running out of memory? 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:
# human readable outputs
free -h
# use the cat command to find geeky details
cat /proc/meminfo

Linux display amount of free and used memory in the system
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:
sudo dmidecode -t memory
Want to determine the amount of video memory under Linux, try:
lspci | grep -i vga
glxinfo | egrep -i 'device|memory'

See “Linux Find Out Video Card GPU Memory RAM Size Using Command Line” and “Linux Check Memory Usage Using the CLI and GUI” for more information.

2. hwinfo – probe for hardware

We can quickly probe for the hardware present in the Linux server or desktop:
# Find detailed info about the Linux box
# 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
# Try 4 graphics card ports for monitor data #
hwprobe=bios.ddc.ports=4 hwinfo --monitor
# Limit info to specific devices #
hwinfo --short --cpu --disk --listmd --gfxcard --wlan --printer

Alternatively, you may find the lshw command and inxi command useful to display your Linux hardware information:
sudo lshw -short
inxi -Fxz


inxi is system information tool to get system configurations and hardware. It shows system hardware, CPU, drivers, Xorg, Desktop, Kernel, gcc version(s), Processes, RAM usage, and a wide variety of other useful information [Click to enlarge]

3. id – know yourself

Display Linux user and group information for the given USER name. If user name omitted show information for the current user:

uid=1000(vivek) gid=1000(vivek) groups=1000(vivek),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 am i

4. lsblk – 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:
# list only #
lsblk -l
# filter out loop devices using the grep command #
lsblk -l | grep '^loop'

md0             9:0    0   3.7G  0 raid1 /boot
md1             9:1    0 949.1G  0 raid1 
md1_crypt     253:0    0 949.1G  0 crypt 
nixcraft-swap 253:1    0 119.2G  0 lvm   [SWAP]
nixcraft-root 253:2    0 829.9G  0 lvm   /
nvme1n1       259:0    0 953.9G  0 disk  
nvme1n1p1     259:1    0   953M  0 part  
nvme1n1p2     259:2    0   3.7G  0 part  
nvme1n1p3     259:3    0 949.2G  0 part  
nvme0n1       259:4    0 953.9G  0 disk  
nvme0n1p1     259:5    0   953M  0 part  /boot/efi
nvme0n1p2     259:6    0   3.7G  0 part  
nvme0n1p3     259:7    0 949.2G  0 part  

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:

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          12
On-line CPU(s) list:             0-11
Thread(s) per core:              2
Core(s) per socket:              6
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           158
Model name:                      Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Stepping:                        13
CPU MHz:                         976.324
CPU max MHz:                     4600.0000
CPU min MHz:                     800.0000
BogoMIPS:                        5199.98
Virtualization:                  VT-x
L1d cache:                       192 KiB
L1i cache:                       192 KiB
L2 cache:                        1.5 MiB
L3 cache:                        12 MiB
NUMA node0 CPU(s):               0-11
Vulnerability Itlb multihit:     KVM: Mitigation: Split huge pages
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling
Vulnerability Srbds:             Mitigation; TSX disabled
Vulnerability Tsx async abort:   Mitigation; TSX disabled
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_g
                                 ood nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes x
                                 save avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep 
                                 bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities

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:

Linux show the topology of the system command
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 lsusb command for displaying information about USB buses in the Linux system and the devices connected to them.
# Want a graphical summary of USB devices connected to the system? #
sudo usbview


usbview provides a graphical summary of USB devices connected to the system. Detailed information may be displayed by selecting individual devices in the tree display

lspci – list PCI devices

We use the lspci command for displaying information about PCI buses in the system and devices connected to them:

9. timedatectl – view current date and time zone

Typically we use the date command to set or get date/time information on the CLI:
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):

               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


And this concluded our ten Linux commands to know the system to increase your productivity quickly to solve problems. Do read man pages using the man command:
man {command}
man w
man lspci
man lsusb

Let me know about your favorite tool in the comment section below.

πŸ₯Ί Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🀠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

9 comments… add one
  • winter breeze Jul 26, 2020 @ 12:25

    Nice πŸ‘

  • drew peacock Jul 26, 2020 @ 17:46

    didn’t know some of these newer commands, thanks

  • Native English Speaker Jul 26, 2020 @ 20:51

    You might want to rewrite the headline. “To know the system” is a bit broad, and assumes that “the system” is fixed. I would write it as “Ten Linux command for monitoring system activity.”

  • Deepraj Chandra Jul 27, 2020 @ 3:49

    How did u made ur terminal like rainbow.

    • πŸ›‘οΈ Vivek Gite (Author and Admin) Vivek Gite Jul 27, 2020 @ 9:28

      Pass command output to lolcat. You need to install locat and then run
      command | lolcat
      free | lolcat

  • American Linux guy Jul 27, 2020 @ 18:02

    English Speaker is right. The headline is clunky.

    I would write “Ten Linux command to get a handle on your system.”

  • Noje Jul 31, 2020 @ 3:17

    The additional command « dmidecode » is also a good way to have hardware information, more detailed but hwinfo is a good way have quick reviews of your hardware.

  • nuke Aug 1, 2020 @ 3:19

    Hey “Native English Speaker”: don’t you mean “Ten Linux COMMANDS…”?

  • gitgood Aug 2, 2020 @ 14:16

    Awesome list. Please post more like this.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.