Neilblaze SVG FontNavigate back to the homepage

10 Must know Commands in Linux

Pratyay Banerjee
December 8th, 2021 · 3 min read

What is Linux? 🔍

Linux is a Unix-like, open source and community-developed operating system (OS) for computers, servers, mainframes, mobile devices and embedded devices. It is supported on almost every major computer platform, including x86, ARM and SPARC, making it one of the most widely supported operating systems.


How is the Linux operating system used?

Every version of the Linux OS manages hardware resources, launches and handles applications, and provides some form of user interface. The enormous community for developers and wide range of distributions means that a Linux version is available for almost any task, and Linux has penetrated many areas of computing.

For example, Linux has emerged as a popular OS for web servers such as Apache, as well as for network operations, scientific computing tasks that require huge compute clusters, running databases, desktop and endpoint computing, and running mobile devices with OS versions like Android.

Linux is highly configurable and depends on a modular design that enables users to customize their own versions of Linux. Depending on the application, Linux can be optimized for different purposes such as:

  • Networking performance
  • Computation performance
  • Deployment on specific hardware platforms &
  • Deployment on systems with limited memory, storage or computing resources.

Users can choose different Linux distributions for specific applications or adapt a specific distribution to incorporate custom kernel configurations.


Now comes the main part, Here are 10 Linux command to get started into Linux based distros & rapidly increase productivity.

  • freeget 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:

2# human readable outputs
3free -h
4# use the cat command to find geeky details
5cat /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:

1sudo dmidecode -t memory

Want to determine the amount of video memory under Linux, try:

1lspci | grep -i vga
2glxinfo | egrep -i 'device|memory'
  • hwinfoprobe for hardware

We can quickly probe for the hardware present in the Linux server or desktop:

1# Find detailed info about the Linux box
3# Show only a summary #
4hwinfo --short
5# View all disks #
6hwinfo --disk
7# Get an overview #
8hwinfo --short --block
9# Find a particular disk #
10hwinfo --disk --only /dev/sda
11hwinfo --disk --only /dev/sda
12# Try 4 graphics card ports for monitor data #
13hwprobe=bios.ddc.ports=4 hwinfo --monitor
14# Limit info to specific devices #
15hwinfo --short --cpu --disk --listmd --gfxcard --wlan --printer

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

1sudo lshw -short
2inxi -Fxz

Here, “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.

  • idknow yourself

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


See who is logged on your Linux server:

2who am i
  • lsblklist 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:

2# list only #
3lsblk -l
4# filter out loop devices using the grep command #
5lsblk -l | grep '^loop'
2md0 9:0 0 3.7G 0 raid1 /boot
3md1 9:1 0 949.1G 0 raid1
4md1_crypt 253:0 0 949.1G 0 crypt
5nixcraft-swap 253:1 0 119.2G 0 lvm [SWAP]
6nixcraft-root 253:2 0 829.9G 0 lvm /
7nvme1n1 259:0 0 953.9G 0 disk
8nvme1n1p1 259:1 0 953M 0 part
9nvme1n1p2 259:2 0 3.7G 0 part
10nvme1n1p3 259:3 0 949.2G 0 part
11nvme0n1 259:4 0 953.9G 0 disk
12nvme0n1p1 259:5 0 953M 0 part /boot/efi
13nvme0n1p2 259:6 0 3.7G 0 part
14nvme0n1p3 259:7 0 949.2G 0 part
  • lsb_releaseLinux distribution information

Want to get distribution-specific information such as, description of the currently installed distribution, release number and code name:

1lsb_release -a

No LSB modules are available.

1Distributor ID: Ubuntu
2Description: Ubuntu 20.04.1 LTS
3Release: 20.04
4Codename: focal
  • lscpudisplay 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:

1Architecture: x86_64
2CPU op-mode(s): 32-bit, 64-bit
3CPU(s): 8
4On-line CPU(s) list: 0-7
5Thread(s) per core: 2
6Core(s) per socket: 4
7. .
8. .
9. .

Cpu can be listed using the lshw command too:

1sudo lshw -C cpu
  • lstopodisplay hardware topology

Want to see the topology of the Linux server or desktop? (This is one of my fav), try here :


You will see information about:

• NUMA memory nodes, shared caches, CPU packages, processor cores, processorthread & more…

  • A. lsusblist 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.

2# Want a graphical summary of USB devices connected to the system? #
3sudo usbview
  • B. lspcilist PCI devices

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

  • timedatectlshow 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):

1Local time: Sun 2020-12-08 15:42:16 IST
2 Universal time: Sun 2020-12-08 10:12:16 UTC
3 RTC time: Sun 2020-12-08 10:12:16
4 Time zone: Asia/Kolkata (IST, +0530)
5 System clock synchronized: yes
6 NTP service: active
7 RTC in local TZ: no
  • wwho is logged in

Run the w command on Linux to see information about the Linux users currently on the machine, and their processes:

1$ w



There are many Linux commands that can be used to get information about the Linux server or desktop. I’ve only listed the most important ones. Go ahead and try them out.

That is all, I hope you liked the post. Thank you very much for reading, and have a great day! 😄

More articles from Pratyay Banerjee

Deploying REST API's in Kubernetes

Beginner's guide on how to deploy REST API's on K8's aka Kubernetes

October 20th, 2021 · 3 min read

PWA's in a Nutshell

Everything you should know about Progressive Web Apps (PWA)

August 16th, 2021 · 7 min read
© 2021–2023 Pratyay Banerjee
Link to $ to $ to $ to $ to $ to $