iPhone Find the largest file on iPhone?

Discussion in 'Jailbreaks and iOS Hacks' started by SDAVE, Aug 25, 2010.

  1. macrumors 68030

    SDAVE

    Joined:
    Jun 16, 2007
    Location:
    Nowhere
    #1
    Hi,
    my "other" usage has skyrocketed and I think the same happened in the photos. I have a JB'd iP4.

    Fully aware about the Rock log issue, and I have gotten rid of Rock and the log file, but the Other usage is about 1GB and photos are 4.48GB (it includes 720p videos, which are only 600MB in size).

    Any way to find out what are the largest files on the iPhone through SSH?
     
  2. macrumors regular

    Joined:
    Jul 21, 2010
    Location:
    UK
    #2
    I'd be tempted to use iFile. A registered copy will allow you to search (& with a wildcard) and see search results based on directory sizes.

     
  3. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #3
    Install "gawk" from Cydia. SSH into your iPhone and run this command:

    find / -iname "*" -ls | sort -rn -k 7.1 | gawk '{print $7,$11}' > files.txt

    The text file will contain a sorted list of all files with the largest files at the top of the list. There are two fields separated by a space. The first field is the file size and the second field is the file name including full path.

    If you prefer the file name first, switch the 7 and 11 in the gawk command.

    On my iPhone the file was 5.5MB in size so make sure you have room.

    S-
     
  4. macrumors G4

    dhlizard

    Joined:
    Mar 16, 2009
    Location:
    The Jailbreak Community
    #4
    What repo is gawk in ?
     
  5. macrumors P6

    -aggie-

    Joined:
    Jun 19, 2009
    Location:
    Where bunnies are welcome.
    #5
    It's from Sauriks (apt.saurik.com).
     
  6. macrumors G4

    dhlizard

    Joined:
    Mar 16, 2009
    Location:
    The Jailbreak Community
    #6
    Odd, not showing up for me under that source ??

    I can just grab the .deb file.
     
  7. macrumors G4

    dhlizard

    Joined:
    Mar 16, 2009
    Location:
    The Jailbreak Community
    #7
    Sorry to be a noob about this, but in what directory will the text file be created ?

    Edit: Found it... private/var/root
     
  8. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #8
    Actually, the text file will be created in the directory your are in (the current working directory) when you run it.

    S-
     
  9. thread starter macrumors 68030

    SDAVE

    Joined:
    Jun 16, 2007
    Location:
    Nowhere
    #9
    Thanks for the help.



    What a life saver!! Thank you.

    Seems like Gawk wasn't available in the repo so I just found the .deb online.

    Anywho, it found all the large files and there seems to be discrepencies so will clean those files out with iPhone Explorer (Great app, btw. Don't need to SSH with FUGU over WiFi anymore. It's fast over USB)
     
  10. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #10
    You're welcome.

    I keep forgetting that to see some of these packages on Cydia you need to be setup as a "Hacker (+ Command Line)" or "Developer (No Filters)". To do this, tap on "Manage" then "Settings".

    S-
     
  11. macrumors member

    Joined:
    Feb 8, 2010
    #11
    I'm having this same problem. I ran gawk and I'm looking at the list of files but I really don't know what to delete. I really kind of a newb at this. I have almost 5 gigs of other space. How do I know what files to remove?
     
  12. thread starter macrumors 68030

    SDAVE

    Joined:
    Jun 16, 2007
    Location:
    Nowhere
    #12
    Well for me, I had extra *cough* .ipa files in there and didn't know they were there. They were huge too.

    Also the list showed me .mov files which were shot with my iPhone 4 and they were 1+ gigs per file, so I dumped those to my computer and deleted them off the phone.

    Just look at the list and see what the largest files are. If it's a 1GB MP3, then something is wrong and that file needs to be deleted. After cleaning up I have 4GB of space now. If I dump all of my photos and videos I'll have 5GB back too, so I plan to do that soon.

    Some apps are huge too, so be careful not to delete those. If you want to delete large video files, try to find which one it is and delete it from the iPhone instead, using the Photos app. If it's a movie, delete it from the phone or through iTunes. It's safer this way.

    I think I originally came to this problem with the Rock app and it's huge log file. I recently had Rock installed, removed it again, and there was 0 space for some reason, again.

    One of the issues I Have with jailbreaking is that you don't know which app takes up extra space, so this terminal command line code with gawk is really useful for maintaining the space once in a while.
     
  13. macrumors member

    Joined:
    Feb 8, 2010
    #13
    Yeah thanks for posting. I've been looking at the files close and I noticed doubles of all my apps. I deleted navigon and my "other" storage went down a gig. So that must be the problem. I'm going to go through tonight and delete all the doubles. Besides those double apps could you tell me what these three files are? The artwork ones were the biggest on my phone. I really appreciate it this is a problem I've been trying to find an answer to for a few days.

    524288000 /private/var/mobile/Media/iTunes_Control/Artwork/F3105_1.ithmb
    333447168 /private/var/mobile/Media/iTunes_Control/Artwork/F3101_1.ithmb
    122167270 /System/Library/Caches/com.apple.dyld/dyld_shared_cache_armv7
     
  14. macrumors G4

    dhlizard

    Joined:
    Mar 16, 2009
    Location:
    The Jailbreak Community
    #14
    iFile works great for identifying the contents of the music/videos so you can get rid of them/move them.
     
  15. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #15
    I guess I should have mentioned that you want to be logged in as root, not mobile, when you run the terminal command I provided in post #3 of this thread. You need permission to access all of the directories on the iPhone.

    S-
     
  16. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #16
    This command may be better if you want to process the output in another program:

    find / -name "*" -ls | sort -rn -k 7.1 | gawk 'BEGIN {OFS="\t"} {print $7,$11}' > files.txt

    This separates the two fields by a tab character instead of a space. There may be spaces in file names but there will be no tab characters. So a tab delimiter is probably better than a space delimiter in most cases.

    S-
     
  17. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #17
    Okay, spaces in directory and file names causes gawk some issues. So we need to do something like this:

    find / -name "*" -ls | sort -rn -k 7.1 | gawk 'BEGIN {OFS="\t"} {print $7,$11 " " $12 " " $13 " " $14 " " $15}' > files.txt

    This will handle up to 4 spaces in the full path and name. That should be enough to figure out just about any file name. This will append 4 spaces onto file names that have no spaces in their path or name. But that shouldn't be too big of a deal.

    S-
     
  18. macrumors member

    Joined:
    Feb 8, 2010
    #18
    Thanks a lot man. I used Itunes to remove all my apps. The used ssh to remove all the copies. I got my storage back!!!! I'm still curious as to how it happened in the first place though. Thanks for your help.
     
  19. macrumors regular

    Joined:
    Nov 8, 2010
  20. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #20
    Maybe. But probably not for anyone else and certainly not for the OP......

    S-
     
  21. macrumors regular

    Joined:
    Nov 8, 2010
    #21
    I think size of folders more helpful instead files.

    for ex.:

    10419002 .
    9752328 ./private
    9751704 ./private/var
    9454560 ./private/var/mobile
    8760300 ./private/var/mobile/Applications
    1230748 ./private/var/mobile/Applications/741B7C33-F583-4F75-83FE-95E0857195BF
    1230660 ./private/var/mobile/Applications/741B7C33-F583-4F75-83FE-95E0857195BF/RAGE.app
    1147284 ./private/var/mobile/Applications/89591FD1-0C35-48E6-8536-6725036371EF
    1147072 ./private/var/mobile/Applications/89591FD1-0C35-48E6-8536-6725036371EF/nova2.app
    660044 ./private/var/mobile/Applications/C035E61A-26EC-4DED-A7D4-C9B2F084B806
    659208 ./private/var/mobile/Applications/C035E61A-26EC-4DED-A7D4-C9B2F084B806/Worms2iPhone.app
     
  22. macrumors newbie

    Joined:
    Feb 12, 2011
    #22
    sort

    where can i find the sort command?
     
  23. macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #23
    /usr/bin/sort

    S-
     
  24. sidewinder, Feb 13, 2011
    Last edited: Feb 13, 2011

    macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #24
    To be useful, you would need to use this command so you get files as well as directories and have them sorted:

    du -a / | sort -rn > files.txt

    This lists directories and files so it makes it harder to find the big files. But it does show the "*.app" directories as single entities so that is useful.

    S-
     
  25. macrumors newbie

    Joined:
    Jan 26, 2011
    #25
    Great tip, freed up 5 GB of useless data, thank you!!! :D
     

Share This Page