The ls
command lets you see the files and directories inside a Specific directory (current working directoy by default).
It Normally Lists the files and directories in ascending alphabetical order.
- To Show the files inside your current working directory:
ls
- To Show the files and directory inside a specfic Directory:
ls {Directory_Path}
ls [-OPTION] [DIRECTORY_PATH]
In this interactive tutorial, you will learn the different ways to use the ls
command:
Short Flag | Long Flag | Description |
---|---|---|
-l |
- | Show Results in long format |
-S |
- | Sort Results by file size |
-t |
- | Sort Results by modifictaion time |
-r |
--reverse |
Show files and directories in reverse order (descending Alphabetical order) |
-a |
--all |
Show all files, Including hidden files (file names which begin with period . ) |
-A |
--almost-all |
Shows all like -a but without Showing . (Current Working Directory) and .. (Parent Directory) |
-d |
--directory |
Instead of listing the files and directores inside the directory, It Shows an information about the directory itself, Can be used with -l to show long formatted information |
-F |
--classify |
Appends an indictaor character to the end of each listed name, as an example: / character is appended after each directory name listed |
-h |
--human-readable |
like -l but displays file size in human-readable unit not in bytes |