Linux Contest with a $25 Amazon Gift Card Giveaway – Week 3

It’s time for the third question in the $25 Amazon Gift Card Giveaway. Chaoslica won week 2 by answering our question most accurately.  To recap, every week we are asking a Linux question.  We want readers to post their answer in the comments section at the bottom of the post.  At the end of week four the person who answers the most questions correctly will win a $25 Amazon Gift card.  If there are four different winners each week, a winner within the winners will be chosen at random.  If there is a tie, the winner will be determined based on who posted their answers the fastest.  Go here for the complete rules.

Question 3 : Week 3

From the command line, how would you get the size of all files and directories and output them from highest to lowest size?

The most complete and straightforward answer will win!

Post your answers at the bottom of this post in the comments!

Remember, subscribe to the RSS feed to get notified of the answer as well as the next question!  I will update this post every few days with the progress of the contest.  To prevent copying of answers, you will not see any comments until the end of the week.

* Update *

Congratulations to week 3 winners: apokalyptik, Ben P., Mahmoud, and Olivers.  Each answer was a bit different, but all of them are acceptable.  See the comments for the answers. Also, please note, Ben is the only contestant to have won twice thus far, putting him in the lead to win the gift card.

Check the home page soon to see the final week 4 question.

5 thoughts on “Linux Contest with a $25 Amazon Gift Card Giveaway – Week 3

  1. du -a * | sort -rn | tail

    du -ah would show the sizes in a human readable format but the sort won’t be accurate.

  2. non recursive:

    du -s * | sort -n


    find -ls | sed -r s/’[ ]+’/’ ‘/g | cut -d’ ‘ -f 7- | sort -n

    use -r with sort to get biggest files first

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>