Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This is my question: How to sort files by file extensions through the command line?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

This is what you are looking for:

ls -Xl

From the man file:

 -X                         sort alphabetically by entry extension

This is an example of how you could move .txt files into a test forlder:

mv *.txt test/
share|improve this answer
    
Thanks, that is useful. Yet, it is not exactly what I wanted. I guess my question isn't that clear now that I read it again. What I would want is to move files from one folder into a specific folder by using the file extension. Turns out I managed by using the mv command. –  Ederico Nov 19 '11 at 15:26
1  
I've added a mv command to move files based on extension. Cheers –  bioShark Nov 19 '11 at 19:18
add comment

Your Answer

 
discard

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.