Hello and welcome to our community! Is this your first visit?
Register

Results 1 to 2 of 2

Thread: Sorting files in UNIX

  1. #1
    Mac Lover waffycasem's Avatar
    Join Date
    Aug 2005
    Age
    29
    Posts
    343

    Default Sorting files in UNIX

    I was reading this other thread and I got curious... is there a way for me to list files in UNIX and sort them by file size? I could think of ways of doing it in SQL, but not in UNIX (my 'UNIX skills' suck eh.) If ever there is a way to do this, could how do I include hidden files? And maybe display the 10 largest files in my hard drive, including hidden files?

    Thanks!

  2. # ADS
    Google Adsense

    Join Date
    Always
    Age
    2010
    Posts
    Many




     

  3. #2
    Mac Fanatic alistair's Avatar
    Join Date
    Feb 2005
    Location
    Makati
    Age
    38
    Posts
    928

    Default Re: Sorting files in UNIX

    Man "find", "ls" and "sort".

    In particular, here's a quick and dirty way to do it (WARNING: WILL TAKE FOREVER!):

    find / -type f -exec ls -l {} \; | sort -n +4

    Add "sudo" to include all files regardless of ownership or permissions.
    [ "Green Stabofen" avatar by Jesus Pernas ]

  4.   



 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •