LINUX `ls` commands

Type ls and press tab in zsh shell you will see this

I have been using Linux for quite a lot of time but never feels the need to use all the above command except simple ls, but over the weekend when I was trying to create a compute engine instance in google cloud and attaching some storage drives with the instance and deploying some containers on it I started searching for command like how to list storage drives, how to list all the users in LINUX etc. One of the difficult task for me was to remember all these command like lsblk lslogin lsmem . Then I realized that all these commands start with ls so just remember it and type ls then press tab you will see the list. Below is a list and description of some of the commands that start with ls.

ls

ls is one of the most used command in Linux. it is used to list files and directories inside a directory. By default it output list of all files and directories inside current directory but you can pass it different parameters to change it output

lsattr

lsattr is used to list file attributes on a Linux second extended file system. following is a sample output

The output can be a combination of these letters 'aAcCdDeijPsStTu'
a: append only
A: no atime updates
c: compressed
C: no copy on write
d: no dump
D: synchronous directory updates
e: extent format
i: immutable
j: data journalling
P: project hierarchy
s: secure deletion
S: synchronous updates
t: no tail-merging
T: top of directory hierarchy
u: undeletable
E: encrypted
I: indexed directory
N: inline data
                        

These attributes can be changed using chattr like
chattr +attribut-letter file-name

lsblk

lsblk lists information about all available or the specified block devices. The command prints all block devices (except RAM disks) in a tree-like format by default.

lscpu

lscpu is used to display information about CPU architecture. The command output can be optimized for parsing or for easy readability by humans. The information includes, for example, the number of CPUs, threads, cores, sockets, and Non-Uniform Memory Access (NUMA) nodes. There is also information about the CPU caches and cache sharing, family, model, bogoMIPS, byte order, and stepping.

lslogins

lslogins display information about known users in the system. The optional argument username forces lslogins to print all available details about the specified user only. The default action is to list info about all the users in the system.

lsmem

The lsmem command 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 and the amount of memory in online and offline state.

lstopo

lstopo Show the topology of the system in a small window in graphical form. lstopo allows system administrators and C programmers to examine the NUMA topology and to provide details about each processor and memory type in a server. Plus, it draws pretty pictures! Managers love pretty pictures.

lsusb

lsusb is a utility for displaying information about USB buses in the system and the devices connected to them.

Thanks for reading, if you wanna explore more about these command just use man command-name and please feel free to comment!

You can follow me on twitter @ilyash00 where I share some cool stuff about programming and occasionally create some zines

Copyright ©