Exploring ls - Linux Commands

| 2 min read

What is ls command in Linux?

At irs core, ls stands for list. It is a command-line utility that reveals the contents of a directory. Whether you’re exploring the file system, managing files, or simpley curious abut what’s in a folder, ls is your go-to tool. Let’s delve deeper into its functionality and explore some of its options

Understanding the Basics

When you execute the ls command without any options, it promptly displays a list of files and directories in the current working directory. This straightforward function makes it incredibly useful for everyday tasks on the command line.

ls

Options

-l

The long listing format option provides detailed information about each file or directory, including permission, owner, group size, and timestamp

ls -l

-a

The option reveals hidden files and directories, which are begin with a dot.

ls -a

-h

When used in conjunction with the long format option, this option displays file sizes in a human-readable format, such as kilobytes (K), megabytes (M), or gigabytes (G).

ls -lh

-R

The recursive option lists the contents of directories recursively, revealing the entire directory tree..

ls -R

-t

Sorting files by modification time, with the newest files listed first.

ls -t

-S

Sorting files by size, with the largest files listed first.

ls -S

-i

Displaying the inode number of each file, which uniquely identifies it within the file system.

ls -i

Additionally, to delve even deeper into the functionality of each option, you can explore further by using the respective command followed by:

ls --help

# or
# consulting the manual pages
man ls

These commands provide comprehensive documentation and explanations for each option

Thank you!

Thank you for your time and for reading this!