You can uninstall LibreOffice from Ubuntu without taking the desktop down with it. On 26.04 and 24.04 the suite only arrives through the “extended selection” install, where the ubuntu-desktop metapackage merely recommends it, so every LibreOffice package can go and ubuntu-desktop stays installed. The right command depends on how LibreOffice got onto your machine, because the apt packages, the Snap and the Flatpak each leave something different behind.
This guide shows you how to find which one you have, remove LibreOffice cleanly for each format, keep only Writer and Calc if that is all you use, and delete the user profile. Every removal below was run on Ubuntu 26.04 in October 2026, on a reproduced extended desktop install with LibreOffice 26.2, and we measured what each method gave back. We repeated the apt removal on 24.04 with LibreOffice 24.2, where the same 20 packages came off.
Check how LibreOffice is installed
Run all three checks before removing anything, because a machine can carry more than one copy. A Snap installed from App Center sits happily next to the apt packages, and removing one leaves the other on the menu. When an uninstall seems to have done nothing, a second copy in another format is almost always why.
dpkg -l 'libreoffice*' | grep ^ii | wc -l
snap list 2>/dev/null | grep -i libreoffice
flatpak list 2>/dev/null | grep -i libreoffice
On our extended install only the first command printed anything: 19 apt packages, and no Snap or Flatpak.
19
How much space you get back depends heavily on the format, and the Flatpak in particular hides most of its size in shared runtimes. We installed each format on the same test machine and measured what a full removal returned.
| Install format | Where it lives | Space freed by a full removal | Left behind by a plain remove |
|---|---|---|---|
| apt (Ubuntu archive) | /usr/lib/libreoffice | About 461 MB (418 MB purge, 43 MB autoremove) | 46 library packages until autoremove |
| Snap | /var/lib/snapd/snaps | 1.2 GB snap file | An automatic data snapshot |
| Flatpak (Flathub) | /var/lib/flatpak | 3.1 GB including runtimes | 2.0 GB of runtimes in /var/lib/flatpak, plus your data in ~/.var/app |
Remove the apt packages
Purge every package whose name starts with libreoffice. Quote the pattern, so apt matches it against the package list instead of your shell matching it against the files in the current directory. Purge rather than remove: on 24.04 a plain apt remove 'libreoffice*' left 12 packages in the rc state (removed, config kept), with soffice.sh, sofficerc and the rest of /etc/libreoffice still on disk.
sudo apt-get purge 'libreoffice*'
Apt prints a few “is not installed, so not removed” lines for language packs you never had, and you can ignore them. Read the summary before you confirm. We show apt-get here because that’s what produced the output below; on 26.04, plain apt does the same job but prints its summary in the newer apt 3 layout.
0 upgraded, 0 newly installed, 20 to remove and 2 not upgraded.
After this operation, 418 MB disk space will be freed.
Package number 20 is python3-uno, the Python bridge, which depends on LibreOffice and goes with it. Nothing outside LibreOffice appeared in the removal list on 26.04, and no GNOME package was touched. The engine libraries (ure, the libuno set, the document import filters and fonts-opensymbol) stay behind as orphans, so clear them next:
sudo apt-get autoremove --purge
That removed another 46 packages on our machine. Read the list before you confirm, though, because autoremove clears every orphan on the system, and on a machine that hasn’t run it in a while that can include old kernels and leftovers from unrelated software.
0 upgraded, 0 newly installed, 46 to remove and 2 not upgraded.
After this operation, 42.7 MB disk space will be freed.
Confirm that nothing is left and that the desktop metapackage survived. The second check matters if you plan to upgrade to the next Ubuntu release, since the upgrader uses ubuntu-desktop to decide what a desktop machine should carry.
dpkg -l | grep -cE '^(ii|rc) +(libreoffice|ure|uno|python3-uno|libuno)'
dpkg -l ubuntu-desktop | tail -1 | awk '{print $1, $2, $3}'
A count of zero means no LibreOffice package or leftover config remains, and ii on the second line means ubuntu-desktop is still installed.
0
ii ubuntu-desktop 1.570.4
Here is the whole apt removal from our test machine on one screen.

Twenty packages purged, 46 orphans autoremoved, nothing left behind, and the desktop metapackage untouched.
Because ubuntu-desktop only recommends LibreOffice, a normal apt upgrade won’t bring it back either. We ran apt upgrade and even apt install --reinstall ubuntu-desktop in simulation after the purge, and neither tried to install a single LibreOffice package, so the removal sticks until you install it again yourself.
E: Couldn’t find any package by glob ‘libreoffice-report.odt’
This is the shell expanding an unquoted libreoffice* before apt ever sees it. If the directory you’re in holds a file whose name starts with libreoffice, bash swaps the pattern for that file name and apt goes looking for a package called libreoffice-report.odt:
E: Couldn't find any package by glob 'libreoffice-report.odt'
E: Couldn't find any package by regex 'libreoffice-report.odt'
Nothing gets removed in that case, so there is no damage, but it looks as if apt is broken. Put the pattern in single quotes, as above, and it works from any directory. The same trap catches apt purge nvidia* and every other wildcard purge, so quoting is a habit worth keeping.
Do not purge only libreoffice-core
Removing the core package on its own looks tidy, but libreoffice-base-core and python3-uno depend on either libreoffice-core or libreoffice-core-nogui, so apt keeps them satisfied by installing the headless core in its place. Run a dry run with -s to see it happen without changing anything.
sudo apt-get purge -s libreoffice-core | grep -E '^Inst|upgraded,'
You would end up with eight packages removed and a headless LibreOffice installed, which is the opposite of what you wanted.
Inst libreoffice-core-nogui (4:26.2.6.3-0ubuntu0.26.04.2 Ubuntu:26.04/resolute-updates, Ubuntu:26.04/resolute-security [amd64]) [libreoffice-gnome:amd64 libreoffice-draw:amd64 libreoffice-impress:amd64 libreoffice-math:amd64 ]
0 upgraded, 1 newly installed, 8 to remove and 2 not upgraded.
Use the quoted wildcard instead. It removes the core and the style and UI packages in one transaction, so nothing is left for apt to substitute.
Keep Writer and Calc, drop the rest
Sometimes the goal is a cleaner app grid, not a machine without an office suite. Each LibreOffice application is its own package, so you can remove only the ones you never open and keep Writer and Calc for the odd .docx or spreadsheet:
sudo apt-get purge libreoffice-impress libreoffice-draw libreoffice-math
sudo apt-get autoremove --purge
That only saved 31.5 MB here (18.7 MB from the three packages and 12.8 MB from their orphans), because Writer, Calc and the shared core make up most of the suite. A headless conversion afterwards is a quick way to prove the core still works, since it exercises Writer without opening a window. Create a throwaway text file and convert it:
cd /tmp
echo "quarterly numbers" > note.txt
soffice --headless --convert-to pdf note.txt
Writer converted the file without errors, so the core was intact. If disk space is the reason you are removing LibreOffice, a partial removal will not get you there, and you should purge the whole suite instead.
Remove the LibreOffice Snap
The Snap is Canonical’s build and it is big: our libreoffice snap file alone was 1.2 GB. Removing it the normal way also keeps a copy of your snap data, which surprises people who expect a remove to be final.
sudo snap remove libreoffice
snapd says so in the output. List the snapshot it kept:
snap saved
The remove message and the saved set look like this on our machine:
libreoffice removed (snap data snapshot saved)
Set Snap Age Version Rev Size Notes
1 libreoffice 1.54s 26.2.5.2 377 234kB auto
Snapd keeps it so your settings come back if you reinstall, and according to the snapcraft documentation automatic snapshots expire on their own after 31 days. If you want it gone now, forget it by its set number:
sudo snap forget 1
To skip the snapshot entirely, remove the Snap with --purge instead. snapd then deletes the snap’s data without saving a copy anywhere.
sudo snap remove --purge libreoffice
On our machine snap saved reported no snapshots afterwards, so nothing of the Snap was kept.
Remove the LibreOffice Flatpak
The Flathub build is the newest of the three (26.8 when we tested), and it is also the largest because it brings its own runtime. A fresh install took /var/lib/flatpak to 3.1 GB on a machine with no other Flatpaks. The commands below assume a system-wide install, which is what Software and flatpak install flathub create by default; if flatpak list --columns=application,installation shows user, drop the sudo and add --user. Uninstall the app first.
sudo flatpak uninstall -y org.libreoffice.LibreOffice
That only freed about 1.1 GB, since /var/lib/flatpak was still 2.0 GB afterwards. The org.freedesktop.Platform runtime, its GL drivers and codecs stayed installed, because uninstalling an app never removes the runtimes it pulled in. Remove unused runtimes to get the rest back:
sudo flatpak uninstall -y --unused
On our machine that took /var/lib/flatpak down to 4.9 MB. If you run other Flatpak apps, --unused only removes runtimes none of them use, so it is safe to run anyway. Our guide to managing Flatpak applications covers the rest of the cleanup commands.
Your settings and recent-files list live in ~/.var/app/org.libreoffice.LibreOffice, and neither command touches that folder. Trying to clean it up after the fact by naming the app with --delete-data fails, because the app is no longer installed.
error: No installed refs found for ‘org.libreoffice.LibreOffice’
Running sudo flatpak uninstall --delete-data while the app is still installed does not help either, because it deletes root’s data, not yours, and our ~/.var/app folder survived it. Remove the folder as your own user instead.
rm -rf ~/.var/app/org.libreoffice.LibreOffice
The flatpak uninstall man page also documents --delete-data with no app ID, run as your own user, as a way to clear data left by apps that are no longer installed. We removed the folder directly, which is simpler to check.
Delete your LibreOffice profile
Purging the apt packages never touches your home directory, so the apt build’s user profile stays in ~/.config/libreoffice. The Snap and Flatpak builds keep theirs inside their own sandbox folders, which the sections above already covered. Ours was 560 KB after one use, and it was still there after the purge. It holds the settings you built up over time:
- toolbar and menu layout
- autocorrect and autotext entries
- Basic macros and installed extensions
- the recent-documents list
Check its size before you decide whether it’s worth keeping.
du -sh ~/.config/libreoffice
Delete it if you’re not going back to LibreOffice. It’s also worth deleting when you reinstall to fix a LibreOffice that won’t start, since a fresh profile rules out a corrupted one:
rm -rf ~/.config/libreoffice
Each user on the machine has their own profile, so repeat that for every account that used LibreOffice. Your documents are not stored there, and removing the profile does not touch them.
Replace it with OnlyOffice
If you removed LibreOffice because Office files didn’t round-trip cleanly, OnlyOffice Desktop Editors is the usual replacement, since its native formats are .docx, .xlsx and .pptx. We installed it on the same 26.04 machine from the vendor’s .deb. The file name carries no version number, so the link keeps working across releases:
cd /tmp
wget https://download.onlyoffice.com/install/desktop/editors/linux/onlyoffice-desktopeditors_amd64.deb
sudo apt install -y ./onlyoffice-desktopeditors_amd64.deb
It is not light. The download was 267 MB and the install pulled 70 packages for 1,270 MB of disk, nearly three times what LibreOffice gave back. It also registered itself as the default handler for Word documents straight away, which you can confirm with xdg-mime.
xdg-mime query default application/vnd.openxmlformats-officedocument.wordprocessingml.document
OnlyOffice’s desktop file is now the default, so double-clicking a .docx in Files opens OnlyOffice from here on:
onlyoffice-desktopeditors.desktop
Plan for updates before you commit to it. The .deb didn’t add an apt repository, so apt upgrade will never update OnlyOffice, and you have to re-download the .deb when a new version ships. If you want a whole team editing the same files in a browser, the self-hosted OnlyOffice Docs server is the bigger version of the same idea.
Should you change your mind later, sudo apt install libreoffice-writer libreoffice-calc brings back the two apps most people use without Impress; on 24.04 that reinstall pulled 149 packages, and apt’s default Recommends also bring Math back with Writer. The Ubuntu 26.04 guide to apt, Snap and Flatpak and the Snap, Flatpak and AppImage comparison help you pick a format for the reinstall, and Fedora users can follow the LibreOffice on Fedora guide instead.
You probably want to autoremove before cleaning.
Cleaning is the last step.
(BTW, note that cleaning is just useless in case of uninstallation… it just removes the installation cache files in /var/cache/apt/archives)
how to uninstall libreoffice if there are two versions of libreoffice installed, for example libreoffice 7.4 and 7.5
You need to upgrade or uninstall?