Saturday , May 28 2022

How To List All Files In A Directory Linux

In today’s article, we will talk about How To List All Files In A Directory Linux with the ls command.

ls: It allows us to see the files in the directory you are in.

In my previous article, we have created a file named linuxogreniyorum(learninglinux) in the directory we are in with the mkdir command,

let’s list it with the ls command.

As seen above, we see that our file has been created.

Ls – l : With the help of this command, we can show the owner, group,file size and last modification time of the files.

Ls -al : With the help of this command, we can view the information of hidden files and directories.

ls -l –block-size : It is used to display the output to be displayed with the block size parameter in Megabyte, Gbyte format.

You can view it by typing KB, MB, GB, TB or K, M, G, T after the Bloksize parameter. Example usage is as follows.

ls -l –block-size=MB

ls -r : sorts.

ls -R : Used to view subdirectories as well.

ls -I or ls –ignore : By adding the letter “I” to the ls parameter,

we can remove the file that we do not want to list without listing.

Example usage:

Faruk Erdem
Author: Faruk Erdem

About Faruk Erdem

Leave a Reply

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