{"id":5147,"date":"2022-07-09T07:15:21","date_gmt":"2022-07-09T01:45:21","guid":{"rendered":"https:\/\/www.suramya.com\/blog\/?p=5147"},"modified":"2022-07-09T07:15:21","modified_gmt":"2022-07-09T01:45:21","slug":"some-lesser-known-useful-linux-commands","status":"publish","type":"post","link":"https:\/\/www.suramya.com\/blog\/2022\/07\/some-lesser-known-useful-linux-commands\/","title":{"rendered":"Some lesser known Useful Linux commands"},"content":{"rendered":"<p>In this post I am sharing some useful Linux commands originally posted by <a href=\"https:\/\/twitter.com\/xtremepentest\/status\/1540284398217592833\">Traw<\/a> on Twitter. As it is almost impossible to find stuff on Twitter (even if you favorite it) I am consolidating the entire thread here as a blog post for my reference:<\/p>\n<p><b>lsmem<\/b>: <\/p>\n<p><a href=\"https:\/\/www.ibm.com\/docs\/en\/linux-on-systems?topic=commands-lsmem\">lsmem<\/a> lists the ranges of available memory with their online status. The listed memory blocks correspond to the memory block representation in sysfs. The command also shows the memory block size, the device size, and the amount of memory in online and offline state. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsmem\r\nRANGE                                  SIZE  STATE REMOVABLE  BLOCK\r\n0x0000000000000000-0x00000000cfffffff  3.3G online       yes   0-25\r\n0x0000000100000000-0x000000052fffffff 16.8G online       yes 32-165\r\n\r\nMemory block size:       128M\r\nTotal online memory:      20G\r\nTotal offline memory:      0B<\/pre>\n<p><b>lsusb<\/b><\/p>\n<p><a href=\"https:\/\/linux.die.net\/man\/8\/lsusb\">lsusb<\/a> lists all the USB buses in the system and the associated devices connected to them. A good way to figure out what USB devices are connected and what the vendor ID and the product ID associated with them. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsusb\r\nBus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub\r\nBus 005 Device 032: ID 03f0:3b17 HP, Inc LaserJet M1005 MFP\r\nBus 005 Device 029: ID 8564:4000 Transcend Information, Inc. microSD\/SD\/CF UHS-II Card Reader [RDF8, RDF9]\r\nBus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nBus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub\r\nBus 003 Device 002: ID 0b05:18f3 ASUSTek Computer, Inc. AURA LED Controller\r\nBus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\nBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub\r\nBus 001 Device 005: ID 8087:0029 Intel Corp. AX200 Bluetooth\r\nBus 001 Device 004: ID 05e3:0610 Genesys Logic, Inc. Hub\r\nBus 001 Device 003: ID 413c:2113 Dell Computer Corp. KB216 Wired Keyboard\r\nBus 001 Device 002: ID 0951:16bc Kingston Technology HyperX Pulsefire FPS Gaming Mouse\r\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\r\n<\/pre>\n<p><b>lsb_release<\/b><\/p>\n<p>The <a href=\"https:\/\/www.computerhope.com\/unix\/lsb_release.htm\">lsb_release<\/a> command displays LSB (Linux Standard Base) information about your specific Linux distribution, including version number, release codename, and distributor ID. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsb_release -a\r\nNo LSB modules are available.\r\nDistributor ID: Debian\r\nDescription:    Debian GNU\/Linux bookworm\/sid\r\nRelease:        testing\/unstable\r\nCodename:       n\/a<\/pre>\n<p><b>lsfd<\/b><\/p>\n<p><a href=\"https:\/\/fossies.org\/linux\/util-linux\/misc-utils\/lsfd.1\">lsfd<\/a> is a replacement for lsof and lists the file descriptors On Linux systems, it is tailored to the Linux kernel and supports Linux-specific features such as namespaces etc. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsfd |more\r\nCOMMAND            PID    USER  ASSOC MODE TYPE              SOURCE MNTID      INODE NAME\r\nsyncthing         1134 suramya    exe  ---  REG                sda5     0     265927 \/usr\/bin\/syncthing\r\nsyncthing         1134 suramya    cwd  ---  DIR                sda5     0          2 \/\r\nsyncthing         1134 suramya    rtd  ---  DIR                sda5     0          2 \/\r\nsyncthing         1134 suramya cgroup  ---  REG                 0:4     0 4026531835 cgroup:[4026531835]\r\nsyncthing         1134 suramya    ipc  ---  REG                 0:4     0 4026531839 ipc:[4026531839]\r\nsyncthing         1134 suramya    mnt  ---  REG                 0:4     0 4026533012 mnt:[4026533012]\r\nsyncthing         1134 suramya    net  ---  REG                 0:4     0 4026531840 net:[4026531840]\r\nsyncthing         1134 suramya    pid  ---  REG                 0:4     0 4026531836 pid:[4026531836]\r\nsyncthing         1134 suramya  pid4c  ---  REG                 0:4     0 4026531836 pid:[4026531836]\r\nsyncthing         1134 suramya   time  ---  REG                 0:4     0 4026531834 time:[4026531834]\r\nsyncthing         1134 suramya time4c  ---  REG                 0:4     0 4026531834 time:[4026531834]\r\nsyncthing         1134 suramya   user  ---  REG                 0:4     0 4026531837 user:[4026531837]\r\nsyncthing         1134 suramya    uts  ---  REG                 0:4     0 4026531838 uts:[4026531838]\r\nsyncthing         1134 suramya    mem  r-x  REG                sda5     0     265927 \/usr\/bin\/syncthing\r\nsyncthing         1134 suramya    mem  r--  REG                sda5     0     265927 \/usr\/bin\/syncthing\r\nsyncthing         1134 suramya    mem  rw-  REG                sda5     0     265927 \/usr\/bin\/syncthing<\/pre>\n<p><strong>lsof<\/strong><\/p>\n<p>The command <a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/lsof.8.html\">lsof<\/a> stands for List Of Open Files. This command displays a list of files that have been opened. Essentially, it provides information to determine which files are opened by which process. The output looks like:<\/p>\n<pre class='code'>root@StarKnight:\/tmp# lsof |more\r\nCOMMAND      PID    TID TASKCMD               USER   FD      TYPE             DEVICE    SIZE\/OFF       NODE NAME\r\nsystemd        1                              root  cwd       DIR                8,5        4096          2 \/\r\nsystemd        1                              root  rtd       DIR                8,5        4096          2 \/\r\nsystemd        1                              root  txt       REG                8,5     1841792     277271 \/usr\/lib\/systemd\/systemd\r\nsystemd        1                              root  mem       REG                8,5      161864     280226 \/usr\/lib\/x86_64-linux-gnu\/libgpg-error.so.0.33.0\r\nsystemd        1                              root  mem       REG                8,5     3081088     264360 \/usr\/lib\/x86_64-linux-gnu\/libcrypto.so.1.1\r\nsystemd        1                              root  mem       REG                8,5       26984     273912 \/usr\/lib\/x86_64-linux-gnu\/libcap-ng.so.0.0.0\r\nsystemd        1                              root  mem       REG                8,5      633512     270536 \/usr\/lib\/x86_64-linux-gnu\/libpcre2-8.so.0.11.0\r\nsystemd        1                              root  mem       REG                8,5     1321424     264366 \/usr\/lib\/x86_64-linux-gnu\/libm-2.33.so\r\nsystemd        1                              root  mem       REG                8,5      158400     279628 \/usr\/lib\/x86_64-linux-gnu\/liblzma.so.5.2.5\r\nsystemd        1                              root  mem       REG                8,5      751840     263041 \/usr\/lib\/x86_64-linux-gnu\/libzstd.so.1.5.2\r\nsystemd        1                              root  mem       REG                8,5      137568     269425 \/usr\/lib\/x86_64-linux-gnu\/liblz4.so.1.9.3\r\nsystemd        1                              root  mem       REG                8,5       35280     262500 \/usr\/lib\/x86_64-linux-gnu\/libip4tc.so.2.0.0\r\nsystemd        1                              root  mem       REG                8,5     1332480     262198 \/usr\/lib\/x86_64-linux-gnu\/libgcrypt.so.20.4.1\r\nsystemd        1                              root  mem       REG                8,5       18768     264301 \/usr\/lib\/x86_64-linux-gnu\/libdl-2.33.so\r\nsystemd        1                              root  mem       REG                8,5      202680     264320 \/usr\/lib\/x86_64-linux-gnu\/libcrypt.so.1.1.0\r\nsystemd        1                              root  mem       REG                8,5       38864     267169 \/usr\/lib\/x86_64-linux-gnu\/libcap.so.2.44<\/pre>\n<p><strong>lscpu<\/strong><\/p>\n<p><a href=\"https:\/\/man7.org\/linux\/man-pages\/man1\/lscpu.1.html\">lscpu<\/a> gathers CPU architecture information from sysfs, \/proc\/cpuinfo, and any architecture-specific libraries that are applicable (e.g. librtas on Powerpc). The command output can be optimized for parsing or human readability. This can include the number of CPU&#8217;s, threads, cores, etc. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lscpu\r\nArchitecture:            x86_64\r\n  CPU op-mode(s):        32-bit, 64-bit\r\n  Address sizes:         43 bits physical, 48 bits virtual\r\n  Byte Order:            Little Endian\r\nCPU(s):                  16\r\n  On-line CPU(s) list:   0-15\r\nVendor ID:               AuthenticAMD\r\n  Model name:            AMD Ryzen 7 3800X 8-Core Processor\r\n    CPU family:          23\r\n    Model:               113\r\n    Thread(s) per core:  2\r\n    Core(s) per socket:  8\r\n    Socket(s):           1\r\n    Stepping:            0\r\n    Frequency boost:     enabled\r\n    CPU(s) scaling MHz:  52%\r\n    CPU max MHz:         4558.8862\r\n    CPU min MHz:         2200.0000\r\n    BogoMIPS:            7786.11\r\n    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse\r\n                         3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_p\r\n                         state ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbr\r\n                         v svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sme sev sev_es\r\nVirtualization features: \r\n  Virtualization:        AMD-V\r\nCaches (sum of all):     \r\n  L1d:                   256 KiB (8 instances)\r\n  L1i:                   256 KiB (8 instances)\r\n  L2:                    4 MiB (8 instances)\r\n  L3:                    32 MiB (2 instances)\r\nNUMA:                    \r\n  NUMA node(s):          1\r\n  NUMA node0 CPU(s):     0-15\r\nVulnerabilities:         \r\n  Itlb multihit:         Not affected\r\n  L1tf:                  Not affected\r\n  Mds:                   Not affected\r\n  Meltdown:              Not affected\r\n  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl\r\n  Spectre v1:            Mitigation; usercopy\/swapgs barriers and __user pointer sanitization\r\n  Spectre v2:            Mitigation; Retpolines, IBPB conditional, STIBP conditional, RSB filling\r\n  Srbds:                 Not affected\r\n  Tsx async abort:       Not affected<\/pre>\n<p><strong>lslogins<\/strong><\/p>\n<p>lslogins displays information about known users in the system. It examines the wtmp and btmp logs, \/etc\/shadow (if necessary) along with \/etc\/passwd to get the desired data.<\/p>\n<pre class='code'>suramya@StarKnight:~$ lslogins\r\n  UID USER              PROC PWD-LOCK PWD-DENY  LAST-LOGIN GECOS\r\n    0 root               306                   Apr06\/15:36 root<\/pre>\n<p><strong>lspci<\/strong><\/p>\n<p><a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/lspci.8.html\">lspci<\/a> is a command on Unix-like operating systems that prints detailed information about all PCI buses and devices in the system. It is based on a common portable library libpci which offers access to the PCI configuration space on a variety of operating systems.  The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lspci\r\n00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse Root Complex\r\n00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse IOMMU\r\n00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse PCIe Dummy Host Bridge\r\n00:01.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse GPP Bridge\r\n00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse PCIe Dummy Host Bridge\r\n00:03.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse PCIe Dummy Host Bridge\r\n00:03.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse GPP Bridge\r\n00:04.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse PCIe Dummy Host Bridge\r\n...\r\n0b:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship\/Matisse HD Audio Controller<\/pre>\n<p><strong>lsipc<\/strong><\/p>\n<p><a href=\"https:\/\/manpages.ubuntu.com\/manpages\/xenial\/man1\/lsipc.1.html\">lsipc<\/a> shows information on the System V inter-process communication facilities for which the calling process has read access. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsipc\r\nRESOURCE DESCRIPTION                                              LIMIT USED  USE%\r\nMSGMNI   Number of message queues                                 32000    0 0.00%\r\nMSGMAX   Max size of message (bytes)                                 8K    -     -\r\nMSGMNB   Default max size of queue (bytes)                          16K    -     -\r\nSHMMNI   Shared memory segments                                    4096    4 0.10%\r\nSHMALL   Shared memory pages                       18446744073692774399 1728 0.00%\r\nSHMMAX   Max size of shared memory segment (bytes)                  16E    -     -\r\nSHMMIN   Min size of shared memory segment (bytes)                   1B    -     -\r\nSEMMNI   Number of semaphore identifiers                          32000    0 0.00%\r\nSEMMNS   Total number of semaphores                          1024000000    0 0.00%\r\nSEMMSL   Max semaphores per semaphore set.                        32000    -     -\r\nSEMOPM   Max number of operations per semop(2)                      500    -     -\r\nSEMVMX   Semaphore max value                                      32767    -     -<\/pre>\n<p><strong>lslocks<\/strong><\/p>\n<p><a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/lslocks.8.html\">lslocks<\/a> lists information about all the currently held file locks in a Linux system. It also lists OFD (Open File Description) locks which are not associated with any process (PID is -1). OFD locks are associated with the open file description on which they are acquired. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lslocks |more\r\nCOMMAND            PID  TYPE  SIZE MODE  M      START        END PATH\r\npipewire          1483 FLOCK       WRITE 0          0          0 \/run\/user\/1000\/pipewire-0.lock\r\nfirefox-bin      18608 POSIX       WRITE 0          0          0 \/mnt\/data\/Configs\/.mozilla\/firefox\/6hzbxva3.default\/.parentlock\r\nfirefox-bin      18608 POSIX       READ  0          0          0 \/tmp\/MozillaUpdateLock-CBDE0CC28E6567B7\r\nplasmashell       1742 POSIX   88K READ  0 1073741826 1073742335 \/home\/suramya\/.local\/share\/kactivitymanagerd\/resources\/database\r\nplasmashell       1742 POSIX   32K READ  0        128        128 \/home\/suramya\/.local\/share\/kactivitymanagerd\/resources\/database-shm\r\nsystemsettings    2116 POSIX   88K READ  0 1073741826 1073742335 \/home\/suramya\/.local\/share\/kactivitymanagerd\/resources\/database\r\nsystemsettings    2116 POSIX   32K READ  0        128        128 \/home\/suramya\/.local\/share\/kactivitymanagerd\/resources\/database-shm\r\ncron               900 FLOCK       WRITE 0          0          0 \/run...\r\nkactivitymanage   1754 POSIX   88K READ  0 1073741826 1073742335 \/home\/suramya\/.local\/share\/kactivitymanagerd\/resources\/database\r\nkactivitymanage   1754 POSIX   32K READ  0        128        128 \/home\/suramya\/.local\/share\/kactivitymanagerd\/resources\/database-shm\r\nfirefox-bin      18608 POSIX   75M WRITE 0 1073741826 1073742335 \/mnt\/data\/Configs\/.mozilla\/firefox\/6hzbxva3.default\/places.sqlite\r\nfirefox-bin      18608 POSIX 74.3M WRITE 0 1073741826 1073742335 \/mnt\/data\/Configs\/.mozilla\/firefox\/6hzbxva3.default\/favicons.sqlite\r\nkactivitymanage   1754 POSIX   32K READ  0        124        124 \/home\/suramya\/.local\/share\/kactivitymanagerd\/resources\/database-shm<\/pre>\n<p><b>lsmod<\/b><\/p>\n<p><a href=\"https:\/\/www.geeksforgeeks.org\/lsmod-command-in-linux-with-examples\/\">lsmod<\/a> shows the current status of loaded modules in the Linux Kernel. It nicely formats the contents of the \/proc\/modules , showing what kernel modules are currently loaded. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsmod\r\nModule                  Size  Used by\r\nloop                   32768  0\r\ndm_crypt               61440  0\r\ndm_mod                172032  1 dm_crypt\r\nmptcp_diag             16384  0\r\ntcp_diag               16384  0\r\nudp_diag               16384  0\r\nraw_diag               16384  0\r\ninet_diag              24576  4 tcp_diag,mptcp_diag,raw_diag,udp_diag\r\nunix_diag              16384  0\r\naf_packet_diag         16384  0\r\nnetlink_diag           16384  0\r\nuinput                 20480  0\r\nxfrm_user              49152  2\r\nxfrm_algo              16384  1 xfrm_user\r\n...\r\n...\r\ntwofish_generic        20480  0\r\ntwofish_avx_x86_64     53248  0\r\ntwofish_x86_64_3way    32768  1 twofish_avx_x86_64<\/pre>\n<p><strong>lsirq<\/strong><\/p>\n<p><a href=\"https:\/\/man7.org\/linux\/man-pages\/man1\/lsirq.1.html\">lsirq<\/a> is a utility to display kernel interrupt information. The output looks like:<\/p>\n<pre class='code'>IRQ     TOTAL NAME\r\nLOC 438495596 Local timer interrupts\r\nRES 395250211 Rescheduling interrupts\r\nCAL 244198954 Function call interrupts\r\nTLB  50704087 TLB shootdowns\r\n 43  36669756 IR-PCI-MSI 2621443-edge enp5s0-tx-0\r\n 44  33219249 IR-PCI-MSI 2621444-edge enp5s0-tx-1\r\n 42  29631348 IR-PCI-MSI 2621442-edge enp5s0-rx-1\r\n 41  24214613 IR-PCI-MSI 2621441-edge enp5s0-rx-0\r\n 63   5830480 IR-PCI-MSI 3670016-edge ahci[0000:07:00.0]\r\n 45   4564010 IR-PCI-MSI 3147776-edge xhci_hcd\r\n105   4129317 IR-PCI-MSI 4718592-edge nvidia\r\n 64   3354988 IR-PCI-MSI 4194304-edge ahci0\r\n 69   1788338 IR-PCI-MSI 4194309-edge ahci5\r\n 65    157846 IR-PCI-MSI 4194305-edge ahci1\r\n104     27444 IR-PCI-MSI 5775360-edge snd_hda_intel:card1\r\n..\r\n..<\/pre>\n<p><strong>lsns<\/strong><\/p>\n<p>The <a href=\"https:\/\/man7.org\/linux\/man-pages\/man8\/lsns.8.html\">lsns<\/a> command lists information about all currently accessible namespaces or a given namespace. The namespace identifier is an inode number. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsns\r\n        NS TYPE   NPROCS    PID USER    COMMAND\r\n4026531834 time       87   1134 suramya \/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\r\n4026531835 cgroup     87   1134 suramya \/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\r\n4026531836 pid        87   1134 suramya \/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\r\n4026531837 user       75   1134 suramya \/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\r\n4026531838 uts        87   1134 suramya \/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\r\n4026531839 ipc        76   1134 suramya \/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\r\n4026531840 net        76   1134 suramya \/usr\/bin\/syncthing serve --no-browser --no-restart --logflags=0\r\n4026531841 mnt        85   1454 suramya \/lib\/systemd\/systemd --user\r\n4026532954 user        1 267290 suramya \/usr\/local\/firefox\/firefox-bin -contentproc -parentBuildID 20220705093820 -prefsLen 44808 -prefMapSize 237085 -appDir \/usr\/local\/firefox\/browser 267229 true socket\r\n4026532955 ipc         1 267290 suramya \/usr\/local\/firefox\/firefox-bin -contentproc -parentBuildID 20220705093820 -prefsLen 44808 -prefMapSize 237085 -appDir \/usr\/local\/firefox\/browser 267229 true socket\r\n...\r\n...<\/pre>\n<p><strong>lsattr<\/strong><\/p>\n<p><a href=\"https:\/\/www.computerhope.com\/unix\/chattr.htm\">lsattr<\/a> lists the file attributes on a second extended file system. The chattr command modifies the attributes of files, and lsattr lists (displays) them. File attributes are flags which affect how the file is stored and accessed by the filesystem. They are metadata stored in the file&#8217;s associated inode. The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsattr\r\n--------------e------- .\/node_modules\r\n--------------e------- .\/Temp\r\n--------------e------- .\/Screenshot_20220704_122444.png\r\n--------------e------- .\/go\r\n--------------e------- .\/LinkedIn<\/pre>\n<p><strong>lsblk<\/strong><\/p>\n<p><a href=\"https:\/\/www.geeksforgeeks.org\/lsblk-command-in-linux-with-examples\/\">lsblk<\/a> is used to display details about block devices and these block devices(Except ram disk) are basically those files that represent devices connected to the pc. It queries \/sys virtual file system and udev db to obtain information that it displays. And it basically displays output in a tree-like structure. This command comes pre-installed with the util-Linux package.  The output looks like:<\/p>\n<pre class='code'>suramya@StarKnight:~$ lsblk\r\nNAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS\r\nsda      8:0    0 111.8G  0 disk \r\n\u251c\u2500sda1   8:1    0   3.7G  0 part [SWAP]\r\n\u251c\u2500sda2   8:2    0     1K  0 part \r\n\u251c\u2500sda5   8:5    0  18.6G  0 part \/\r\n\u2514\u2500sda6   8:6    0  89.4G  0 part \/mnt\/data\r\nsdb      8:16   0   2.7T  0 disk \r\n\u2514\u2500sdb1   8:17   0   2.7T  0 part \/mnt\/Backup\r\nsdc      8:32   0 223.6G  0 disk \r\n\u2514\u2500sdc1   8:33   0 223.6G  0 part \/mnt\/storage\r\nsdd      8:48   0  12.7T  0 disk \r\n\u2514\u2500sdd1   8:49   0  12.7T  0 part \/mnt\/repository\r\n<\/pre>\n<p>There are a lot more useful Linux commands and no blog post can possibily list all of them. But some of these were new to me so I thought I should share.<\/p>\n<p>&#8211; Suramya<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I am sharing some useful Linux commands originally posted by Traw on Twitter. As it is almost impossible to find stuff on Twitter (even if you favorite it) I am consolidating the entire thread here as a blog post for my reference: lsmem: lsmem lists the ranges of available memory with their [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[9,24,13,2],"tags":[],"class_list":["post-5147","post","type-post","status-publish","format-standard","hentry","category-computer-hintstips","category-knowledgebase","category-linuxunix-related","category-techie-stuff"],"_links":{"self":[{"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/posts\/5147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/comments?post=5147"}],"version-history":[{"count":3,"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/posts\/5147\/revisions"}],"predecessor-version":[{"id":5150,"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/posts\/5147\/revisions\/5150"}],"wp:attachment":[{"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/media?parent=5147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/categories?post=5147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.suramya.com\/blog\/wp-json\/wp\/v2\/tags?post=5147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}