LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 03-30-2010, 06:29 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Rep: Reputation: 49
Sorting output of du.


GNU/Linux 2.6, slackware 12.0.
Hi:
How do I sort the output of du by its first column. I issue
the command this way:
$ du
Is there a way? Thanks for reading. Regards.
 
Old 03-30-2010, 06:34 AM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 96
Code:
du | sort -n
 
Old 03-30-2010, 06:38 AM   #3
blacky_5251
Member
 
Registered: Oct 2004
Location: Adelaide Hills, South Australia
Distribution: RHEL 4&5, Fedora 10, CentOS 5.4, IPCop
Posts: 569

Rep: Reputation: 55
I find it useful to add the "r" option to see the largest disk space hog at the top of the list
Code:
du | sort -rn
 
Old 03-30-2010, 06:52 AM   #4
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
sort has an option of sorting based on the column, check for man sort and -k option in that.
 
Old 03-30-2010, 07:11 AM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,268

Original Poster
Rep: Reputation: 49
Most thankful to your replies. They've been very useful to me. Regards.
 
Old 03-30-2010, 07:37 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,563
Blog Entries: 29

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
Quote:
Originally Posted by stf92 View Post
Most thankful to your replies. They've been very useful to me. Regards.
If your problem is solved now you can mark the thread SOLVED using the Thread Tools menu.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with sorting a file Yogiz Linux - Newbie 5 12-08-2007 05:41 PM
sorting a map (C++) Thinking Programming 6 09-13-2005 05:52 PM
Sorting data in output file lluciano Linux - General 2 08-19-2005 11:37 AM
Sorting Beppe83 Linux - Software 7 06-21-2004 10:10 AM
Sorting of multi-column output rytrom Linux - Newbie 11 09-15-2003 12:31 PM


All times are GMT -5. The time now is 12:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration