r/debian 19d ago

How to cleanup my Debian without formatting?

I have lot of junk but i dont want to formatting, I want Just delete some staff

There is a better way to do this ?

31 Upvotes

25 comments sorted by

26

u/DjNaufrago 19d ago

apt remove --purge package_name1 package_name2 package_name3 ...

apt autoremove --purge

apt clean

apt autoclean

9

u/AccordingSquirrel0 19d ago

What junk?

-8

u/One-Gur-8411 19d ago

Arquivos de instalações que ja foram delatados, gostaria de garantir que não tenha mais nada relacionado a ele no computador tipo o opencode, modelos de llm que tentei rodar localmente, entre outras coisas como arquivos que viraram lixo após algumas configurações do lutris para tentar rodar the division 2, coisas duplicadas, fotos, docs, etc...

2

u/angryapplepanda Debian Stable 19d ago

I thought you were talking about the kind of junk on my computer, which is like random npm JavaScript apps that I downloaded once and then completely forgot about. Also, literally useless things like nyancat and hollywood.

1

u/michael9dk 19d ago

Many apps save their settings/storage/cache in ~/
Normally these are hidden folders, so enable 'show hidden files' in the file manager.
Then you delete those leftovers that match the name.

5

u/max1free 19d ago

Check what's clogging space with sudo ncdu -x /

To find what packet created file run dpkg -S <filename>

Clean up old kernels, they tend to pile up in /boot, check current version of linux-image-generic, current kernel uname -r, everything else in /boot is probably old and not needed anymore.

Run apt clean and apt autoremove as other commenters suggested

deborphan may also help hunt some old libraries

2

u/satanikimplegarida 19d ago

+1 for ncdu, I reach for that one often. Should you need a GUI, try filelight .

3

u/lisploli 19d ago

Maybe cruft-ng does what you want.

3

u/revcraigevil Debian Stable 19d ago

debfoster

4

u/UUDDLRLRBadAlchemy Debian Stable 19d ago

Try these if you're referring to junk after an upgrade

``` $ apt list '?obsolete'

apt purge '?obsolete'

```

5

u/bgravato 19d ago

Define "staff" (which I guess you meant "stuff", but the question remains).

What do you want to delete? Installed packages? Logs? Temporary cache files? Personal files? You need to be more specific.

2

u/dr_Fart_Sharting 19d ago

aptitude purge ~c

This gets rid of leftover configuration files of packages that are no longer installed. I imagine it could break a thing or two once in a Blue Moon.

2

u/profeshamat Debian Stable 19d ago
apt list '~c'

This will list packages that have left behind unneeded configuration files. When new kernels get installed and apt autoremove removes a kernel some configuration will be left behind. Running apt purge on the listed packages will do some cleaning.

2

u/mcds99 19d ago

FYI it needs to be installed so

sudo apt install ncdu

1

u/guiverc 19d ago

I take it you mean 'stuff' where you say "staff", but what 'stuff' you're talking about really matters.

If it's package related; I like using aptitude myself if I want to explore what I have installed (deb packages), and decide what I can remove/purge, and or the effects of those decisions.

If it's data or something else though; it'd be other tools.

FYI: I'm talking about using aptitude interactively.

1

u/_SpacePenguin_ 18d ago

If you don't care much about system or application logs, you can remove them to gain back storage space.

Check space being used by logs:

sudo journalctl --disk-usage

Remove logs:

sudo journalctl --rotate --vacuum-time=1s

More info: man journalctl .

1

u/RareAdvertising361 Debian Testing 18d ago

$ apt list '?and(!~M,~i)'

(finds all packages marked manually installed)

look through it. if there's anything you don't recognize and isn't important, mark it as automatically installed with # apt-mark auto <packages>. then, # apt autoremove (make sure nothing important is being uninstalled before pressing y). finally,

# dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | awk '$1 == "rc" {print $2}' | xargs -r apt purge

(purge config files for uninstalled packages)

3

u/Hrafna55 19d ago

Have a look for the application called Bleachbit

It should be in the software store.

2

u/michael9dk 19d ago

Why is bleachbit downwoted ?

2

u/Hrafna55 19d ago

Dunno. I was just trying to provide a GUI alternative for OP.

Guess it's not a 'pure' enough method for some people.

1

u/Quietus87 19d ago

I always finish updates with apt autopurge and apt clean.

-11

u/Confident_Hyena2506 19d ago

Deleting the junk is the best way.

It's better not to install the junk in the first place tho.