holzschu / a-shell

A terminal for iOS, with multiple windows
BSD 3-Clause "New" or "Revised" License
2.67k stars 116 forks source link

a-Shell documents and data extremely large #268

Closed mokeWe closed 2 years ago

mokeWe commented 3 years ago

I've been using a-Shell for about a week now and I only have one issue, I use a-Shell for developing archiving tools and as a result I download quite a bit of media from the internet using a-Shell, but whenever I cancel downloads or exit out of the app in the middle of the app downloading files, the data is stored in a-Shell's documents and data. I'm not sure if there is any way to clear/delete this data, but it takes up a lot of space, sometimes even 2-3 gigabytes. The only way I have been able to counteract this is by constantly re installing the app. Any help would be greatly appreciated!

holzschu commented 3 years ago

Hi, thanks for reaching out. a-Shell has all the tools available to manage your data: ls to show which files are present and their size (ls -h for human readable size), du to tell you what is the disk usage for a folder (again, du -h for human-readable form), rm to remove files or folders.

Now the question is: where are your files? The answer depends on how you download them. If you're using Shortcuts, they could be in the ~shortcuts directory (which doesn't appear on the Files app). They could be in the main App directory, ~/Documents, which appears on the Files app. They could be in ~/tmp, the App temporary directory, or in ~/Library (especially ~/Library/Cache). They could also be in "Recently Deleted", in the Files app.

mokeWe commented 3 years ago

Thank you so much! This fixed my issue.

holzschu commented 3 years ago

Out of curiosity (and because it could help others), where were the large data files?

personalizedrefrigerator commented 3 years ago

Was it the tmp folder? I've noticed that files/directories I add to ~/tmp aren't cleared when I restart a-Shell...

bummoblizard commented 3 years ago

Was it the tmp folder? I've noticed that files/directories I add to ~/tmp aren't cleared when I restart a-Shell...

See https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

Use this directory to write temporary files that do not need to persist between launches of your app. Your app should remove files from this directory when they are no longer needed; however, the system may purge this directory when your app is not running. The contents of this directory are not backed up by iTunes or iCloud.

In short, iOS might clear the content when it's running low on storage. In a-shell, it's probably used for caching pip packages.

holzschu commented 3 years ago

Clearing temporary directories at each app restart seemed a bit excessive, especially since the system can kill the app any time it is in the background. They are cleared at each app version update, though. On top of that, iOS can delete anything that is in ~/tmp whenever it is low on storage. But that doesn't apply to ~/Library/Caches, to the best of my knowledge.

Also, a significant proportion of a-Shell users (30-50% ?) use it in combination with shortcuts to download YouTube and TikTok videos. These shortcuts may place temporary files wherever they want, and don't always clean up after running. I strongly suspect these shortcuts are responsible for a-Shell taking up gigabytes of data, more than pip packages.