Linux: ls command: listing subdirectories first, part II

The tutor talks more about listing subdirectories first with the Linux ls command.

I began with this topic in my May 17 post (exactly five months ago, I notice:) While the solution therein is very helpful, I’ve found another one that might be even simpler:

ls -X

Linux is case sensitive; the capital X switch means the directory contents will be listed by the alphabetical order of the file extensions. In my experience, directories don’t have file extensions, whereas files usually do (or should). From the point of view of alphabetical order, the items with no file extension are listed before those that have. Therefore, the subdirectories are generally listed first, unless files have been named without extensions.

For me, ls -X seems to work pretty well to list the subdirectories first.

HTH:)

Source:

linuxcommand.org

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Tagged with: , ,

Leave a Reply