A User Command to Clean and Update System

If you have to alias these operations, do it like this:

alias install="sudo pacman -S"
#alias update="sudo pacman -Syu"      # one y, not two
alias update="yay"                    # better than above, but alias is stupid (more typing)
alias search="pacman -Ss"             # no sudo
alias search-local="pacman -Qs"       # no sudo
alias pkg-info="pacman -Qi"           # no sudo
alias local-install="sudo pacman -U"
alias clear-cache="sudo pacman -Scc"
alias unlock="sudo rm /var/lib/pacman/db.lck"
alias remove="sudo pacman -R"
alias autoremove="sudo pacman -Rns"   # understand what it does before using it

However, I would recommend learning what these commands to rather than memorising a bunch of aliases.

Also, as a personal preference, I never put sudo in aliases. Typing out the word sudo in the terminal is a great time to reflect upon oneā€™s actions: ā€œIs this really what I want? Do I really need to be root to do it?ā€

4 Likes

Just to be sure, is this OK or would probably remove something might be needed?

Amazing @Kresimir
You are all wonderful guys

I always call it here EndeavourOS University

That would remove all the packages in cache.
I think paccache is a better choice for having a more fine grained control.

:eye: paccache --help

There is no general yes/no answer to this.

It will remove everything from the cache. If this is what you want, then great. If not, donā€™t do it (as with anything in life).

Are there situations where this is what you want? Sure. Are there situations where you might regret this? Absolutely.

I find it a bit depressing how amazed you are at my most useless post in this thread, yet the serious advice I give you, you just ignore.

1 Like

Sorry for that

I see your posts are useful. Any posts of anybody I see useful even if proven wrong. One way is learning from mistakes. They say a rational/reasonable man is who learns from ā€œhisā€ mistakes, and a wise man is who learns from ā€œothersā€ mistake.
So, I am this ā€œotherā€ who makes users ā€œwiseā€
Thank you.

Thank you. I will study more!

This is just for my own testing, learning and trying!

#!/bin/bash
paccache -ruk1
rate-mirrors arch | sudo tee /etc/pacman.d/mirrorlist
eos-rankmirrors

### journalctl --vacuum-time=4weeks
yay -Syu

An interesting clarification. I donā€™t think a package that is an optional dependency of another package will ever be on the list of orphans. I believe the reason optional dependencies get removed is because of how pacman -Rs works.

I started removing orphans in a pacman -R loop to avoid this behaviour. To be honest, I have always kind of felt it was a bug in pacman but I guess you can look at either way.

3 Likes

Same hereā€¦ this is why I said earlier I am confused! An orphan is an orphanā€¦ I do not understand semi orphans!

That is true. But @Kresimirā€™s other point is still valid.

An orphan is package that was brought in as a dependency of another package that is no longer installed. It has nothing to do with if you want/need that package.

You as the end-user need to review the list of orphans and determine if you want to remove them or not.

2 Likes

how do you go about it? use the command yay -Yc or are there better ways?

There should be no reason to use -Rc with orphans. By definition there shouldnā€™t be anything depending on them.

I basically call pacman -R $(pacman -Qtdq) until pacman -Qtdq stops returning results.

Except, I can never remember pacman -Qtdq, so I use aura -O instead but it does the exact same thing.

2 Likes

i thought yay -Yc not -Rc :wink:

yay -Yc 	Clean unneeded dependencies.
1 Like

From looking at the code it appears to do the right thing.

However, I would need to setup a test to be sure.

1 Like

Yeah, that cleans the orphan packages, but I still wouldnā€™t do it like that, but go through the list and decide what to remove, what to leave alone, and what to mark as explicitly installed.

1 Like

Only Arch Linux users love to kill orphans without any remorse!!!1111

honka_memes-128px-15

5 Likes

I like to follow this guide to clean up my system. I hope you find it helpful.

2 Likes

I did a test and found that both commands do not lead to the same result. pacman deletes e.g. no packages where one of the packages to be deleted is listed as ā€˜Depends Onā€™ or 'Required By '. yay -Yc deletes those too.