Default command line way to install,remove,list packages

For each OS this should be the first question.
Can I state the default command line way,
To install packages is :
yay -S
To remove packages is :
yay -R
To list packages is : ? some pacman …

So I must install software to be able to list the installed packages ? Weird

1 Like

https://itsfoss.com/pacman-command/ :slight_smile:

2 Likes

No, pacman can do that, as well as add and remove software.

https://wiki.archlinux.org/index.php/Pacman/Rosetta

4 Likes

Welcome aboard!

@alaindevos I am going to move this on over to the new users section. There is more traffic there :hugs:

3 Likes

Hi and welcome!
:wave:t4:

option -Ss ( in the repos )
option -Qs ( in local/cache repos , installed )

Welcome, take your time to learn pacman - it’s best thing happened to cli package managers :star_struck:

Some pacman options worth remembering

Options What it does
-Syu perform a full update (you should use this when updating).
-Syyu force download of package database and then update. This is typically only necessary after changing your mirror list.
-Syuu will perform a full update, allowing downgrade of packages (use only when the update announcement tells you to, or when you’re trying to fix some problem and know what you’re doing). There is also -Syyuu
-Syuw download the packages to make them ready to update, but do not perform the update. Useful when you’re having a bad internet connection, or want to do download the packages before updating in the TTY. After, use -Su to apply the updates.
-Sy or -Syy This only refreshes the local package database, without downloading and installing the updates, and it’s generally a bad idea to use -Sy or -Syy alone, without u. That can cause you quite a bit of trouble with partial upgrades. Another way the database can get refreshed without updating is when you answer n after running pacman -Syu. This is equally bad. For checking whether there are any updates available, use checkupdates command.
-S package_name install the package from the repos. It’s a good idea to do an update before installing new packages.
-U path/to/package install the package from a file.
-R package_name uninstall the package, but leave dependencies.
-Rns package_name uninstall the package, and its dependencies. This is what I typically use for uninstalling programs.
-Rcns package_name uninstall the package and remove dependencies and remove all packages that depend on that package, and most of the config files (might remove more than you want to, use with caution).
-Sc clear the pacman cache for packages that are no longer installed.
-Scc clear the pacman cache (use only if you’re desperate for disk space, because you won’t be able to downgrade packages).
-Ss package_name search the repos for the package (won’t make any changes to your computer)
-Q list all installed packages.
-Qe list only the packages you explicitly installed.
-Q package_name check whether this package is installed. If you don’t know the exact name of the package, a good tip is `pacman -Q
-Qi package_name print some info about the installed package.
-Qm list foreign packages (those installed from files, including those from the AUR).
-Qn list packages installed from the repos.
-Si package_name print some info about the package in the repos.
-Ql package_name list all the files owned by the package
-Fx path/to/file discover which package owns the file
-Qdtq list orphaned packages (you can remove them using -R, but keep in mind, just because a package is orphaned, doesn’t mean it is not useful: remove only those you do not need).

I think those are pretty much all of the everyday useful options. There are many more options, but an average user will probably not need them often enough that they are worth remembering. When needed, you can just read the manual: man pacman.

37 Likes

welcome skipper, hoist your sails and stick your nose to the wind!
:sailboat:

1 Like

-Sc clears the cache from the packages that are no longer installed

-Scc

clears the whole cache

2 Likes

Most used also another distro to understand is also this usefull

https://wiki.archlinux.org/index.php/Pacman/Rosetta

2 Likes

Thanks, fixed. :+1:

2 Likes

Welcome to the community :beers:

Better than ‘man pacman’ :hugs: :smiling_face_with_three_hearts:

3 Likes

So this is correct? -Scc clear the pacman cache (use only if you’re desperate for disk space, because you won’t be able to downgrade packages).

Thank you!

1 Like

Yes. See the post above. Typically using -Sc is safe, as you don’t need those packages in the cache, but you typically want to preserve the cache for packages you have on your system, just so you can easily downgrade them if an update breaks them. But if you need disk space, you can clear the entire cache, it’s not a big deal.

2 Likes

Yes. It will clear out the whole cache. Pass the -c only once and it will clear out only the packages in cache that no longer are installed in the system.

Edit: have a look at paccache. It will give a little more fine-grained control:
https://wiki.archlinux.org/index.php/Pacman#Cleaning_the_package_cache

3 Likes

Apart from being able to get them from https://archive.archlinux.org/ :wink:

3 Likes

Thanks Everyone! :+1:t3:

1 Like