Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SDAVE

macrumors 68040
Original poster
Jun 16, 2007
3,574
601
Nowhere
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?
 

TangoDown

macrumors regular
Jul 21, 2010
194
0
UK
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.

Added file name search capability. The search can be performed in current directory only or in the whole directory hierarchy starting at the current directory. The search string is case and diacritic insensitive. Searches in Edit mode of the File Browser allow deletion, copying, cutting and zipping of the found and then selected files. Search results show date and size for current directory and path for other directories. Via iFile’s preferences the user can choose if the search string should be of
Simple format: search text contained in filename, e.g. “test”,
Wildcard format, e.g.”*test*”,
Regular Expression format, e.g. “.*test.*”.
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
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?

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-
 

dhlizard

macrumors G4
Mar 16, 2009
10,214
119
The Jailbreak Community
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-

What repo is gawk in ?
 

SDAVE

macrumors 68040
Original poster
Jun 16, 2007
3,574
601
Nowhere
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.

Thanks for the help.

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-



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)
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
What a life saver!! Thank you.

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

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-
 

liquid85

macrumors member
Feb 8, 2010
81
0
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?
 

SDAVE

macrumors 68040
Original poster
Jun 16, 2007
3,574
601
Nowhere
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?

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.
 

liquid85

macrumors member
Feb 8, 2010
81
0
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
 

dhlizard

macrumors G4
Mar 16, 2009
10,214
119
The Jailbreak Community
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.

iFile works great for identifying the contents of the music/videos so you can get rid of them/move them.
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
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-
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
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-
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
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-
 

liquid85

macrumors member
Feb 8, 2010
81
0
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.
 

sstyle

macrumors regular
Nov 8, 2010
186
9
Maybe. But probably not for anyone else and certainly not for the OP......

S-

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
 

superjoyce

macrumors newbie
Feb 12, 2011
1
0
sort

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-

where can i find the sort command?
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
I think size of folders more helpful instead files.

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-
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.