What happens when I type ls -al?

What stores file information? How would I access such information if I were to write ls from scratch?

d = directory, 

-a  = all

-i = inode

-l = long list format

-S sort by size

- = standard file, 

 

list all folder included .folder – hidden  in list order

where can I see permission owner groupowner  date folder

 

You can filter out everything but directories using grep this way:

ls -l | grep '^d'

the ^ indicates that the pattern is at the beginning of the line. Replace d with -, l, etc., as applicable.

 

If you want to display all the output but have files of similar type listed together, you can sort the output on the first character of each line:

ls -l | sort -k1,1

ls -l | awk '/^d/{print $NF}

awk will catch all that start with d. as d is for directory and you need to print last field to list directory name