Enhancing Skills

ls: Lists directory contents

Lists directory contents

Command: ls

This is one of the first commands new users learn.


Sample Command and Output:

$ ls -l
total 8
drwxr-xr-x 2 user user 4096 Aug  7 12:34 folder1
drwxr-xr-x 3 user user 4096 Aug  7 12:34 folder2

Lists directory contents

Command: ls -a

This option lists all entries, including those starting with a dot.


Sample Command and Output:

$ ls -a
.  ..  .hiddenfile  folder1  folder2

Lists directory contents

Command: ls -lh

This option lists files in long format with human-readable file sizes.


Sample Command and Output:

$ ls -lh
total 8.0K
drwxr-xr-x 2 user user 4.0K Aug  7 12:34 folder1
drwxr-xr-x 3 user user 4.0K Aug  7 12:34 folder2

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.