ls is used to list information about files and directories within the file system.
Syntax to use ls:
Note: When we used ls with no options and arguments then it displays a list of the names of all files in the current working directory.
There are different options that can be used with the ls command, here we have mentioned a few one of them.
- -l lists long format (shows all permissions of the file).
- -ld If you want the details of the directory.
- -i lists files with their inode number.
- -s lists files with their size.
- -a lists all files including hidden files.
- -S lists files with their size and sorts the list by file size.
- -t sorts the listed files by time and date.
- -lh display file size in easy to read format.