mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-29 21:41:00 +08:00
146 lines
5.5 KiB
Markdown
146 lines
5.5 KiB
Markdown
[#]: subject: "How to Clean Up Flatpak Apps to Clear Disk Space"
|
||
[#]: via: "https://www.debugpoint.com/clean-up-flatpak/"
|
||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||
[#]: collector: "lkxed"
|
||
[#]: translator: " "
|
||
[#]: reviewer: " "
|
||
[#]: publisher: " "
|
||
[#]: url: " "
|
||
|
||
How to Clean Up Flatpak Apps to Clear Disk Space
|
||
======
|
||
|
||
**Here’s how to clean up Flatpak apps to reclaim your precious disk space. Follow along. **
|
||
|
||
Flatpak (like Snap) packages run in sandbox mode. By design, it takes a considerable amount of disk space for an individual application, even if it is a smaller one. For example, a simple Test editor or a basic image annotator application can take up more than 100+ MB of storage space.
|
||
|
||
It’s how Flatpak or even Snap operates fundamentally. It pulls all dependencies for an app and runs independently. The advantage of this design is – you do not need to worry about dependencies or updates. All you need to do is install and run. On the contrary, it takes up a huge amount of disk space.
|
||
|
||
And if you are running Ubuntu, elementary OS or any distribution for a longer period, you would be surprised that Flatpak keeps taking up more space over time.
|
||
|
||
Hence, in this guide, we will give you some commands you can run yourself to clean up flatpak apps.
|
||
|
||
### Clean Up Flatpak
|
||
|
||
#### Where Flatpak packages are installed?
|
||
|
||
When you install a Flatpak package, it gets installed in `/var/lib/flatpak`. All the installed files, metadata, application files, and runtime files are contained in this directory. Also, the user installation directory contains Flatpak data – that is – `~/.local/share/flatpak`
|
||
|
||
#### How to find out the size of Flatpak apps?
|
||
|
||
There are several commands and parameters of “flatpak” which you can combine to get the desired result to list the applications, size and type of installation. Here are some examples.
|
||
|
||
- Verify the size of `/var/lib/flatpak`. But as it is being used by all Flatpak apps plus runtimes, you may not be able to recover entirely.
|
||
|
||
```
|
||
du -h /var/lib/flatpak
|
||
```
|
||
|
||
![Size of var-lib-flatpak][1]
|
||
|
||
Size of var-lib-flatpak
|
||
|
||
- If you have [Disk Usage Analyzer][2], you can verify by simply visiting the above directories.
|
||
|
||
![Disk Analyzer Shows Flatpak size][3]
|
||
|
||
Disk Analyzer Shows Flatpak size
|
||
|
||
You can use any of the following commands to view the size of installed flatpak packages.
|
||
|
||
- View all the installed flatpak with name and installed size.
|
||
|
||
```
|
||
flatpak --columns=name,size list
|
||
```
|
||
|
||
![flatpak list example 1][4]
|
||
|
||
flatpak list example 1
|
||
|
||
- List all installed flatpak with installation type, size and application ID.
|
||
|
||
```
|
||
flatpak --columns=app,name,size,installation list
|
||
```
|
||
|
||
![flatpak list example 2][5]
|
||
|
||
flatpak list example 2
|
||
|
||
- View only the flatpak installed by you.
|
||
|
||
```
|
||
flatpak --columns=name,size --user list
|
||
```
|
||
|
||
![flatpak list example 3][6]
|
||
|
||
flatpak list example 3
|
||
|
||
Remember, two types of flatpak may exist in your system. Some of them may be part of the OS itself. And some of them are installed by you.
|
||
|
||
#### Commands to Clean up
|
||
|
||
- Use the following command to uninstall flatpak packages that are not in use. This is a safe command which you can try.
|
||
|
||
```
|
||
flatpak uninstall --unused
|
||
```
|
||
|
||
![clean up flatpak using unused switch][7]
|
||
|
||
clean up flatpak using unused switch
|
||
|
||
Using the above command, I have freed up around 1GB+ in my test system.
|
||
|
||
![var-lib-flatpak size is reduced][8]
|
||
|
||
var-lib-flatpak size is reduced
|
||
|
||
- If you want to uninstall a specific Flatpak package, use the following command. Change the application ID with the app name. You can find the app name in the above list size commands.
|
||
|
||
```
|
||
flatpak uninstall <application ID>
|
||
```
|
||
|
||
- The following command removes all flatpak packages from your system. Try not to run it unless you are very sure what you are doing. This may break your system, depending on your configuration.
|
||
|
||
```
|
||
flatpak uninstall --all
|
||
```
|
||
|
||
Finally, there are some flatpak cache files in path `/var/tmp/flatpak-cache-*`. Although the size may not be significant. But you can still remove them.
|
||
|
||
```
|
||
sudo rm -rfv /var/tmp/flatpak-cache-*
|
||
```
|
||
|
||
For more details about flatpak commands, visit the [official guide][9]. And let me know, using the comment box below, whether this helped you to clean up some space.
|
||
|
||
If you are looking to clean up Snap packages, the guide is available [here][10].
|
||
|
||
--------------------------------------------------------------------------------
|
||
|
||
via: https://www.debugpoint.com/clean-up-flatpak/
|
||
|
||
作者:[Arindam][a]
|
||
选题:[lkxed][b]
|
||
译者:[译者ID](https://github.com/译者ID)
|
||
校对:[校对者ID](https://github.com/校对者ID)
|
||
|
||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||
|
||
[a]: https://www.debugpoint.com/author/admin1/
|
||
[b]: https://github.com/lkxed
|
||
[1]: https://www.debugpoint.com/wp-content/uploads/2021/10/Size-of-var-lib-flatpak.jpeg
|
||
[2]: https://help.gnome.org/users/baobab/
|
||
[3]: https://www.debugpoint.com/wp-content/uploads/2021/10/Disk-Analyzer-Shows-Flatpak-size-1024x392.jpeg
|
||
[4]: https://www.debugpoint.com/wp-content/uploads/2021/10/flatpak-list-example-1.jpeg
|
||
[5]: https://www.debugpoint.com/wp-content/uploads/2021/10/flatpak-list-example-2-1024x316.jpeg
|
||
[6]: https://www.debugpoint.com/wp-content/uploads/2021/10/flatpak-list-example-3.jpeg
|
||
[7]: https://www.debugpoint.com/wp-content/uploads/2021/10/clean-up-flatpak-using-unused-switch.jpeg
|
||
[8]: https://www.debugpoint.com/wp-content/uploads/2021/10/var-lib-flatpak-size-is-reduced.jpeg
|
||
[9]: http://flatpak list example 3
|
||
[10]: https://www.debugpoint.com/2021/03/clean-up-snap/
|