Cache cleaning commands I forgot

Hi
I use

sudo pacman -Scc --noconfirm && yay -Scc --noconfirm && flatpak uninstall --unused

Bu when I open Pacman Manager I see this
image

And This
image

What command I forgot

https://wiki.archlinux.org/title/pacman#Cleaning_the_package_cache

though i’d of thought -Scc would do it

pamac clean --build-files

See man pamac or pamac clean --help

2 Likes

Why pacman can’t do this?

And I found in yay --help this --clean --cleanafter --removemake but after that still
image

pacman is not pamac, that’s why. :wink:

3 Likes

There are very good responses above. I just wanted to mention that package cache is automatically cleaned up by a systemd timer too. The timer is pamac-cleancache.timer and the service is pamac-cleancache.service.

Some useful commands:

# list timers
systemctl list-timers

# display contents and see when it runs
systemctl cat pamac-cleancache.timer

# display contents and see what it does
systemctl cat pamac-cleancache.service

To edit, check out the systemctl verb edit. To get rid of your change, check out the systemctl verb revert.

I use pacman to manage manjaro packages and pamac cli to manage AUR packages at this time. Both pacman and pamac use the same cache directory (grep cache /etc/pacman.conf).

In general, I usually leave the build files alone, but definitely would clean them up using pamac clean -bv or rm if the AUR package was no longer installed.

1 Like

decipher, please…

    ~  systemctl cat pamac-cleancache.timer                                                                                                                                                           ✔ 
# /usr/lib/systemd/system/pamac-cleancache.timer
[Unit]
Description=Monthly clean packages cache

[Timer]
OnCalendar=Sat *-*-1..7 15:00:00
Persistent=true

[Install]
WantedBy=timers.target
    ~  systemctl cat pamac-cleancache.service                                                                                                                                                         ✔ 
# /usr/lib/systemd/system/pamac-cleancache.service
[Unit]
Description=Clean packages cache

[Service]
Type=oneshot
ExecStart=/usr/bin/pamac clean --no-confirm

Moderator edit: In the future, please use proper formatting: [HowTo] Post command output and file content as formatted text

I’m going to be a terrible, much disliked, possibly even hated person, and tell you: NO.

You can find out how systemd timers work:

https://www.freedesktop.org/software/systemd/man/systemd.timer.html

And with what all the pamac commands do:

man pamac

The short answer: the command pamac will run the first Sat of every month at 3 PM.

The command is specified by the ExecStart directive in the pamac-cleancache.service file. The pamac-cleancache.timer runs the service file. It is a systemd convention that the timer and service file have the same name with different extensions.

When will it run:

OnCalendar=Sat *-*-1..7 15:00:00
 general format : DOW YYYY-MM-DD HH:MM:SS
 DOW            : Day_Of_Week
  *             : every

What will run:

  ExecStart=/usr/bin/pamac clean --no-confirm

:thinking:

Additional help - to find this information for yourself as you gain experience

For Manjaro specific documentation, try the resources below. They can be found from Manjaro’s Homepage under Learn.

Other key Manjaro resources:

  • Status (see: pacman-mirrors) of Manjaro mirrors
  • Compare Manjaro package versions
  • Assuming Stable Update repo, must read announcement before an update
  • Search and read this forum

Since Manjaro is based on Archlinux, their documentation can be helpful too.

In general, be wary of older tutorials, documentation, videos or resources designed for other distributions.

I notice your profile says KDE desktop. KDE applications usually have help from their menu, F1 shortcut key, --help option, or man pages. Their documentation is also online.

  • KDE doc online

There is a unique weekly KDE blog that describes new features and what is going on at KDE.

If you need help on Linux the man pages are the goto resource. Every application has one or more. man pages are normally viewed on your system in a terminal using the man command (man systemd.index). They are also hosted on many websites in html format.

A small tangent here, when you want to understand an application so you can use it efficiently or resolve an issue, go to the source. I don’t mean the code in this case, but the software’s home page. For example, there are a number of utilities like cp, mv, date that are part of the package coreutils.

If you use pamac’s CLI or GUI, or pacman to view information about a package, there will be a line labeled URL.

pacman -Qi coreutils | grep -i url

The URL is often the homepage, which contains documentation and much more. Sometimes the URL points to the actual source code at a git repository. In that case, you might need to look on those webpages for the actual homepage. Definitely checkout in your free time, GNU Manuals. And then see how that compares to using the man command in a terminal on your system. There is even a manpage for man. It will describe what the section number means and other options.

  • man -k 'systemd\.t'
    search the short description for the regex
  • man --html=firefox systemd.time
    view manpage in your browser

man pages are great way to engage the “little grey cells” when you forget a command or option. All man pages have the same layout. If you go to the end of a man page to the See Also section, there will be related man pages.

To get a handle on using a terminal and the command line checkout the tutorial, Learning the Shell.

The html format might be easier, but using a pager is a very useful skill to have if you want to get some level of expertise and control over your linux system. By default the pager is less. man uses a pager and so do the systemd utilities. You can use less yourself.

less /var/log/pacman.log

A few shortcut keys to get you started:

q   quit
/   find forward
?   find backward
n   repeat find
N   repeat find in reverse
g   top
G   bottom
arrow keys work to page up & down
h   help

Now to systemd and related utilities. Below is a small selection of systemd manpages that I seem to reference the most. Use them as needed, a little bit at a time.

  • systemd.index
    This contains a link to all other systemd man pages. And there are a lot. Use them as needed…

  • systemd.directives
    A list of systemd unit keywords. They describe how a unit behaves.

  • systemctl
    Manage (stop, start, mask, edit, cat) systemd units

  • journalctl
    View and manage the journal (replacement for syslog).

Digital Ocean has a number of nice tutorials on systemd, as does opensource.com.

Hope this helps.

Have fun!