How to Use Unix LS Command

In this tutorial we will show you how to use the unix ls command.
The unix ls commands basically are used to list all the contents in the directory. You can use this command along with many attributes to filter out the results according to your requirements.


Step 1 – Display all the files

For example, if you want to display all the files, including the hidden directories, we will use the “-a” attribute along with the LS command.

View all the files

Step 2 – View files with their details

If you want to display the files along with more details for example their size, date and time of creation along with the category of the file type, you can use the “-al” attribute along with the LS command.

Display files with their details

Step 3 – View files separated by commas

If you don’t want the results to be displayed in a list, and instead want it to be separated by commas, you can use the “-m” attribute along with the unix ls command.

Display files separated by commas

Step 4 – View results in descending order

If you want the results to be displayed in descending order, you can use the “-r” attribute.

Display results in descending order

Step 5 – Display results in a single column

Similarly, if you want the results to be displayed in a single column, the “-1” attribute will be used along with the LS command.
And that’s it, by following the above steps you can learn how to use the unix ls commands.

View the results in a single column