How to list files in natural order

One of the little-known options of ls is -v. It sorts the files or directories in a natural order. That is, if the file or directory name has numbers, then those files and directories are sorted in the natural order of those numbers. Like 2 comes before 101.

$ ls -v

This is one of those ls options that you might want to add to your favorite ls alias.

Tried with: CoreUtils 8.21-1 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.