How do I make ls sort by file type (e.g. directories first and then by file extension)? The answers suggested in (Super User) Make ls sort by file type result in unknown option errors from ls.
|
As you've found out, the Darwin version of the You can obtain the GNU version of
to add the GNU Core Utilities package to your system. All the utilities will be prefixed with With the GNU Core Utilites installed you can now do:
And you'll see the output sorted as you desire. If you want to use the GNU Core Utils instead of the utilities that come with OS X you can put the following line in your
And you won't need to use the |
|||
|
|
|
Based on an answer in the linked Super User article:
If you want to see the whole output of |
|||
|
|
/bin/ls. – bneely Feb 10 '12 at 7:04