Sort directory listing after name

You can get a sorted list of directory items with a combination of the ls- and sort- command:

$> ls -al | sort -nk9,9

With k you can define the column(s) (here 9 till 9) to use for sorting.
The parameterresults in a numeric sorting.

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.