Jump to content

How to keep Linux clean?

I did not expect this but Linux does get bloated over time more than I thought.

 

I have done some tweaks like I prefer to keep journald disabled as I don't care about journaling. With just 3 days of journaling, I saw that the log size was 400+ MB, which was a LOT of  bloat. Right now, the knowledge I have about cleanup is the /tmp folder, the system journals, and maybe some .cache folders or something in your home directory. What all places can I check for unneeded files and folders?

 

Above that, I also I have suspicion of what other components might be generated bloat.

 

First comes in mind is Pacman. I am sure it has to be storing some files and I know it also stores some log which should definitely delete. I know I can also clean the cache with a Pacman command. And when we are talking about Pacman, lets talk about the packages installation. To remove  a package I used to just use -R, but now I know using -Rns removes dependencies and config files as well. So, if I purposely install a package and perhaps even run it, and then use -Rns, will it be like I never ever installed that package in the first place or is there that twiny winy bit of left over? There is also the command to remove the currently non needed packages but it has a harder syntax.

 

The second program I have a suspicion on is Yay, an AUR package manager. Because it builds packages from source, I am sure it has to have a lot of bloat. Except my home directory, where does it create stuff?

 

I have taken a look at bleach bit but I don't think it can clean all the stuff I have mentioned but there are some good options like cleaning bash history.

Microsoft owns my soul.

 

Also, Dell is evil, but HP kinda nice.

Link to comment
Share on other sites

Link to post
Share on other sites

I use bleachbit. Even without a swap partition much of my RAM goes unused, so I create partitions for several folders in RAM that I don't care (or think) should get wiped regularly. This way every boot they are new. (That did take some experimenting though, as some didn't like this, most didn't care.)

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, Gat Pelsinger said:

I have done some tweaks like I prefer to keep journald disabled as I don't care about journaling. With just 3 days of journaling, I saw that the log size was 400+ MB

Then there something is wrong with your system, chances are journal probably says what. Rather than ignoring the problem, fix it.

 

20 minutes ago, Gat Pelsinger said:

First comes in mind is Pacman. I am sure it has to be storing some files and I know it also stores some log which should definitely delete. I know I can also clean the cache with a Pacman command. And when we are talking about Pacman, lets talk about the packages installation.

 

My question is why delete them, The log stores the transaction history which leaves a easy way to view what recently changed and If a package breaks the cache is a convenient way to rollback.

 

5 minutes ago, Gat Pelsinger said:

So, if I purposely install a package and perhaps even run it, and then use -Rns, will it be like I never ever installed that package in the first place or is there that twiny winy bit of left over?

No, It only deletes files from the package that are unmodified. It may also have additional data stored across the system possibly in "/etc", "/var/lib", and possibly somewhere in your home directory. While we have standards for the home directory, no one really follows it so it can be anywhere.

 

13 minutes ago, Gat Pelsinger said:

 There is also the command to remove the currently non needed packages but it has a harder syntax

"pacman -Rns $(pacman -Qdtq)", just create an alias in your shell config.

Also running "pacman -Rns" or the above command doesn't account for whether it's used or not. If it's not an explicit dependency or explicitly marked as installed its removed.

 

16 minutes ago, Gat Pelsinger said:

The second program I have a suspicion on is Yay, an AUR package manager. Because it builds packages from source, I am sure it has to have a lot of bloat. Except my home directory, where does it create stuff?

"/home/$USER/.cache/yay", you can just run "yay -Scc".

Link to comment
Share on other sites

Link to post
Share on other sites

Disabling journald will have applications fall back to /var/log if they even support that.

I would rather just adjust journald's log rotation settings.

7 hours ago, Gat Pelsinger said:

saw that the log size was 400+ MB, which was a LOT of  bloat.

By default journald will record the last years worth of logs. If your concerned about drive space maybe you should just buy a bigger disk.

 

7 hours ago, Gat Pelsinger said:

The second program I have a suspicion on is Yay, an AUR package manager. Because it builds packages from source, I am sure it has to have a lot of bloat. Except my home directory, where does it create stuff?

Yay stores everything in ~/.cache and /tmp

 

7 hours ago, Gat Pelsinger said:

I know I can also clean the cache with a Pacman command

I would never do that unless you purposely want to resync the repository index everytime you use pacman.

 

OP just buy a bigger disk or use a distro that actually pre-configured log rotation. I suspect arch doesn't do that.

Link to comment
Share on other sites

Link to post
Share on other sites

shundhammer/qdirstat: QDirStat - Qt-based directory statistics (KDirStat without any KDE - from the original KDirStat author) (github.com)

 

I normally use the above when I need to figure out what files I need to delete to free up some space. note of mention here, it is rarely stuffs inside the log and temps. for me personally, it is mostly node modules and some other work related stuffs i downloaded and dump into my home directory. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×