Linux Blog

Sorting lists with Sort

Filed under: Quick Linux Tutorials — at 11:11 pm on Wednesday, June 4, 2008

There comes a time when it is useful to know how to sort lists. Thankfully using open source software sorting text files can be very easy.

This example shows how to sort a file alphabetically using the sort command. I assume that you have a text file in mind so I will skip the creation of that. There are two ways to sort the file with the sort command. The first being the preferred method but not always suitable.

sort [textfile]
cat [textfile] | sort

That’s it! The second method can be useful if you would like to do any thing special, for example searching with grep, using cut or sed for data extraction or just out of convenience. Check out the man page for sort for more information on all of the options!

Man Pages for commands in this post »



Comment by Anna Missildine

July 26, 2010 @ 1:13 pm

Have you ever thought of posting videos for your weblog articles to have the readers more entertained? I mean I just went through the whole write-up and it absolutely was pretty good but because I’m much more of a visual learner, I found that way to be alot more useful. well, let me know what you feel.

Comment by

July 26, 2010 @ 5:04 pm

Yes, I have a few videos under: Linux Video Tutorials or you can view my Youtube Channel

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>