Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

After some time spent experimenting with unix sort I have noticed the following behaviour



The result of sort files.list is the same as the result of sort -d files.list:


The manual page for sort reads:

sort [OPTION]... [FILE]...

-d, --dictionary-order
          consider only blanks and alphanumeric characters

But it seems that my sort (GNU coreutils 8.17) behaves as if -d were default. However, I have not found a way to turn it off.

So my question is, is there any difference when invoking sort with or without -d? Is it possible to make sort not to ignore nonalphanumeric characters?

share|improve this question

migrated from Sep 18 '12 at 8:12

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 3 down vote accepted

What's your LANG environment variable set to?

If it isn't C, try running:

LANG=C sort    files.list > c.files.list 
LANG=C sort -d files.list > c-d.files.list 

and compare the output files with each other and with your original outputs. You should get the same effect if you set LANG=POSIX, too.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.