So today I was working with Termux and I was trying to install a New Tool But I saw that my Storage is full. And When I checked the Termux storage, It was 8GB. Now to Clean this storage I can Clear the data of my Termux app But There are some Important tools that I don't wanna Delete and almost all of you face the same issues. So in This post, I am gonna show you How you can Identify which Files are taking More space in Your Termux and you can delete them one By one, Without actually deleting the Termux app.
Clean Your Termux Storage :
While using Termux we install a lot of tools and after some time we don't use Those Tools but there is no Uninstall button for any tool and we don't even know which tools are taking more space and which tool we should delete to Clear Storage in our Termux app. To solve all these storage issues we will use commands that will help us to identify all the Storage Eating files in Termux. This is not my own Method I found it on Reddit and you can check that Reddit here.
For this, we will use du (Disk usage) command which will give us the data of memory usages with Termux. This command Comes Preinsatted in Termux so we can just use it directly with any setup.
Below are the steps to Solve your Termux Storage Issues.
1. Move to the Files Folder in Termux :
If You will run du command in your Home Directory of Termux You will not see any useful information it will just show you the Disk Usages of all the files in Home Directory, To Check Disk usages of all the Files in Termux app we will move back to the Files Directory in Termux and From There if you Run du command, It will give you Disk usages data of Almost anything in Termux. Just use the below command to change your directory to the files folder.
cd /data/data/com.termux/files
2. Find Top 10 largest Files In Termux :
Now You can always run du command and see all the data about the file storage but by using the below command you can find out the Top 10 Storage Eating Files in Termux. You can also change the number from 10 to 5 or 20 to check Top 5 or 20 files.
du -ha | sort -k1hr | head -n 10
Now after entering this command you will see the List of files that are using your most of the storage. now you just have to find out which one is not useful for you. Just copy the path of your Non-Useful File as shown in the below picture.
3. Delete Useless Files In Termux :
Now you know which file is not useful for you and using the below command you can easily delete that file. If you are hesitating in deleting them don't because You can always reinstall those tools. Before deleting anything Please Copy Confidential data like data retrieved from Victim into Your Internal storage.
rm -rf ~/the-path-of-the-file-you-wanna-delete
Ex: rm -rf ~/./user/share/apache2/default-site/htdocs
Now if you don't get any errors then that means the File is deleted Successfully.
Conclusion :
This was a simple post on how you can Clean your Termux Storage without deleting the Entire Termux. This method is suggested by one of the developers of the Termux app. You can also delete all the non-useful tools that we Download from Github and you can also uninstall some big packages too. If you have any Post Idea, Make Sure you comment down below. also, Read This Post on [ How To Encrypt your Personal Data With Termux to Make it More Secure ]. I have covered all this command in my Termux Basic Commands post where you can Download free PDF To Learn all the basic commands in Termux. Thanks for Reading Guys, Stay Inspired and as always Stay Ethical.👾
6 Comments
Thanks this is really helpfull
ReplyDeleteThanks for your feed back
DeleteVai,thank you for for this awesome blog.. Everytime I install termux I visit this site. You are truly an amazing person. Hope, you Will continue to help us learn ..
ReplyDeleteI've also configured my ad blocker to not block ads from your website,, it's the least I can do
Welcome bhai, Ad Blocker hatane ke liye thanks💘
DeleteThanks bro. You save my phone from factory reset. All ready 2 time reset my phone for termux. Noe i don't install nethunter. My 15+gb storege finished nethunter. But if can do anything from hunter then evry time i faced many problems. For example sometime pip, dpkg etc. I can't fix it permanently. Today if i fix then tomorrow again.
ReplyDeleteHow to delete all? Is it if i uninstall termux, my storage will like usual?
ReplyDelete