You are not logged in.

#1 2010-07-16 09:00:18

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Archcleaner?

Hi, I a fan of keeping my system in top condition and with no junk/unused files in it, on Ubuntu I use a script called "ubucleaner" that cleans old kernels, apt-cache, empties trashes and stuff like that, link for the tool here if you want to check out the code: http://opendesktop.org/content/show.php … tent=71529

Is there anything like it on arch? if there is not I encourage a good samaritan with knowledge in scripting to make one for the arch community big_smile

thanks


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#2 2010-07-16 09:04:11

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Archcleaner?

Regarding kernels that's because of the weird way the Debian world sets up their packages.

Last edited by fsckd (2010-07-16 09:04:25)


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#3 2010-07-16 09:04:50

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

> old kernels, apt-cache, empties trashes
We usually have only one working kernel + one fallback.

> apt-cache
'pacman -Sc' or 'pacman -Scc' if you feel like.

> empties trashes
Huh? If sb can make a script that will mow my lawn and do the dishes - I'd be damn grateful ;-)

Offline

#4 2010-07-16 09:06:56

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: Archcleaner?

karol wrote:

> old kernels, apt-cache, empties trashes
We usually have only one working kernel + one fallback.

> apt-cache
'pacman -Sc' or 'pacman -Scc' if you feel like.

> empties trashes
Huh? If sb can make a script that will mow my lawn and do the dishes - I'd be damn grateful ;-)

i'll add pacman -Qdt to find packages that are not needed (like apt-get autoremove in debian)

pacman -Rs $(pacman -Qdtq) to remove them


Give what you have. To someone, it may be better than you dare to think.

Offline

#5 2010-07-16 09:19:15

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: Archcleaner?

Regarding kernels...its true. Forgot arch only mantains the normal one and fallback. The pacman cleaning would be very nice big_smile and regarding trashes, I know its VERY easy to do but it is also easy to include in a script so that you can make your system cleanup a one line command big_smile

Also in the ubucleaner example, it empties every user trash, not only the current user.

Cheers


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#6 2010-07-16 09:24:46

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Archcleaner?

The script is very short. You could substitute Arch specific stuff in there and no one's the wiser. smile


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#7 2010-07-16 09:31:55

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: Archcleaner?

With the input from you guys about the pacman cleaning commands I think I can make it myself big_smile but i have 1 question. What is the difference between pacman -Sc and pacman -Scc ??? Any more folders needing cleanup on arch?

Cheers


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#8 2010-07-16 09:32:26

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

'man pacman'

Offline

#9 2010-07-16 09:43:31

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: Archcleaner?

Just read it on the wiki. I think pacman -Sc will be better option in general. I will start making this script tomorrow maybe. Should I open a new thread in the contributions section or just stay here?


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#10 2010-07-16 09:56:14

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

> pacman -Sc will be better option in general.
+1

> Should I open a new thread in the contributions section or just stay here?
Doesn't really matter. You can 'debug' your script here and post the final version in user contributions.

Offline

#11 2010-07-16 10:38:48

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: Archcleaner?

Will this do the job?

#!/bin/bash

YELLOW="\033[1;33m"
RED="\033[0;31m"
ENDCOLOR="\033[0m"

if [ $USER != root ]; then
  echo -e $RED"Error: must be root"
  echo -e $YELLOW"Exiting..."$ENDCOLOR
  exit 0
fi

echo -e $YELLOW"Cleaning pacman cache..."$ENDCOLOR
pacman -Sc

echo -e $YELLOW"Removing unneeded packages..."$ENDCOLOR
pacman -Rs $(pacman -Qdtq)

echo -e $YELLOW"Emptying all users trash folder..."$ENDCOLOR
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
rm -rf /root/.local/share/Trash/*/** &> /dev/null

echo -e $YELLOW"Script Finished!"$ENDCOLOR

Please have in mind im on my phone atm so havent tested it yet.

Last edited by 655321 (2010-07-16 10:41:20)


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#12 2010-07-16 10:46:02

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Archcleaner?

Slightly off-topic, but it seems to me that you want this script because you're still thinking like an ubuntu user. When you get more accustomed to the way Arch works, you will realise that the kind of cruft you want to scrape away just doesn't accumulate in Arch - or at least, not in amounts that will concern you.

In Arch, you install only what you want - and if/when you decide you don't want it, pacman is there to take it away for you.

Offline

#13 2010-07-16 10:46:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

'Pacman -Sc' should be 'pacman -Sc'
'rm -rf /root/.local/share/Trash/*/** &> /dev/null' - IMHO root is needed only for this part

Offline

#14 2010-07-16 10:56:33

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: Archcleaner?

rm -rf /home/*/.local/share/Trash/*/** &> /dev/null

This use of wildcards reminds me of why I love linux.

I don't see a real use for such a script either. If you have unneeded packages you will know, because you uninstalled software, so you do a purge to get rid of it.
If you have multiple users, you might want to ask them BEFORE killing all their trashed files. Some of them might have the habbit of throwing stuff away they still need.
I also don't know if it's wise to clean the pacman cache on a regular basis. Guess what happens when you pull an update that'll break your system? You'll still have the old package to install manually with pacman.

Such tasks should be done manually when they are needed, not by a cronjob or something, especially the pacman cleaning. Imagine a situation where an important package gets flagged as a dependency of another, less important package wich isn't installed at the moment, but you had it manually installed, because you needed it for whatever. You do the autopurge and wonder why your hand craftet tools depending on that package won't work anymore. It'll be hard to find out what happened. Maybe you run the script and it takes you a week or two to find out something is broken. How are you going to track that error?

Last edited by Awebb (2010-07-16 11:09:18)

Offline

#15 2010-07-16 11:57:04

sicpsnake
Member
From: Austin, TX.
Registered: 2010-02-25
Posts: 128
Website

Re: Archcleaner?

Awebb wrote:
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null

This use of wildcards reminds me of why I love linux.

...

I agree. cool Can you imagine a misplaced space though? lol

Offline

#16 2010-07-16 12:16:23

samuele.mattiuzzo
Member
From: Treviso, IT
Registered: 2009-10-12
Posts: 307
Website

Re: Archcleaner?

jumping into the thread with a question about Qdtq

smau [~]$ sudo pacman -Qdtq
alsa-utils
aubio
ffmpegthumbnailer
gmime
gstreamer0.10-good-plugins
gtk
imagemagick
libbonobo
libgdiplus
libgnomecanvasmm
liblo
libmatroska
libmpdclient
libmtp
libspectre
libwebkit
perl-class-std-utils
perl-file-dirwalk
perl-file-mimeinfo
perl-readonly
perl-stat-lsmode
perl-xml-simple
perl-yaml
python-gdata
saxon
socat
spidermonkey
udisks
usbmuxd
vde2
vigra
xorg-util-macros
zvbi

this is what i get when using -Qdtq, but imagemagick is being used, alsa-utils too, gtk too, libwebkit too... how can i be sure about the output of this -Qdtq? i could unistall them all then reinstall some of them back, but i cannot check if one of the removed is needed or not...

-Qdtq tells only if a package was installed as a dependency, not if the package is actually needed as dependency or not...

Last edited by samuele.mattiuzzo (2010-07-16 12:16:45)

Offline

#17 2010-07-16 12:24:36

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

[karol@black ~]$ pacman -Qdtq
git
glproto
hal
scons
xf86driproto
xorg-util-macros

> -Qdtq tells only if a package was installed as a dependency, not if the package is actually needed as dependency or not.
That's right - it's your job to make sure you install it the right way. pacman is a package manager, not the oracle.

Edit: typos.

Last edited by karol (2010-07-16 12:25:21)

Offline

#18 2010-07-16 12:34:11

samuele.mattiuzzo
Member
From: Treviso, IT
Registered: 2009-10-12
Posts: 307
Website

Re: Archcleaner?

karol wrote:

That's right - it's your job to make sure you install it the right way. pacman is a package manager, not the oracle.

oracles make guesses, pacman should be able to know if alsa-utils is a dependency of alsa, or not smile
i mean, i tried with pacman -Qi <package_name> for all the packages in that list, and every package results as "Not required by any other", so i think this is enough for me and i can delete them all, then reinstall just the ones i'm sure i'll be using?


Edit: typos.

forgiven tongue

Offline

#19 2010-07-16 12:39:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

I pasted that snippet of 'code' for a reason: I too have libwebkit and alsa-utils, but they don't show in 'pacman -Qdt'.

Offline

#20 2010-07-16 12:44:43

samuele.mattiuzzo
Member
From: Treviso, IT
Registered: 2009-10-12
Posts: 307
Website

Re: Archcleaner?

karol wrote:

I pasted that snippet of 'code' for a reason: I too have libwebkit and alsa-utils, but they don't show in 'pacman -Qdt'.

this means you installed them explicitly, that's fair and i understand it smile
what i'm not understanding is: how can i check if i need to install one of those packages (into my qdtq list) again and explicitly?

Offline

#21 2010-07-16 12:50:37

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

I've installed jumanji-git which pulled libwebkit. I didn't install it explicitly.

[karol@black ~]$ pacman -Qi libwebkit | grep -e Name -e Required -e Reason
Name           : libwebkit
Required By    : jumanji-git
Install Reason : Installed as a dependency for another package

Maybe you should keep those packages just in case. Hunting down dependencies is not one of my favorite pastimes.

Last edited by karol (2010-07-16 12:51:44)

Offline

#22 2010-07-16 13:04:04

samuele.mattiuzzo
Member
From: Treviso, IT
Registered: 2009-10-12
Posts: 307
Website

Re: Archcleaner?

smau [~] $ LANG=en pacman -Qi libwebkit
Name           : libwebkit
Version        : 1.2.2-1
URL            : http://webkitgtk.org/
Licenses       : custom
Groups         : None
Provides       : webkitgtk-svn
Depends On     : libxt  libxslt  sqlite3  gtk2  icu>=4.4  gstreamer0.10-base  libsoup  enchant
Optional Deps  : None
Required By    : None
Conflicts With : webkitgtk-svn
Replaces       : webkitgtk-svn
Installed Size : 24252.00 K
Packager       : AndyRTR <andyrtr@archlinux.org>
Architecture   : x86_64
Build Date     : Tue Jul 13 07:17:47 2010
Install Date   : Tue Jul 13 10:40:54 2010
Install Reason : Installed as a dependency for another package
Install Script : No
Description    : an opensource web content engine, derived from KHTML and KJS from KDE

this is what i get, every package says so... installed as a dependency, but nothing uses it

Last edited by samuele.mattiuzzo (2010-07-16 13:05:25)

Offline

#23 2010-07-16 13:07:42

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Archcleaner?

> this is what i get, every package says so... installed as a dependency, but nothing uses it
So you can remove it.
In my case, jumanji-git is using it, so I can't remove it:

[karol@black ~]$ pacman -Rs libwebkit
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: jumanji-git: requires libwebkit>=1.2.1

Offline

#24 2010-07-16 13:13:06

samuele.mattiuzzo
Member
From: Treviso, IT
Registered: 2009-10-12
Posts: 307
Website

Re: Archcleaner?

well, i'll try removing, i guess i just wasn't sure about it smile i'll let you know tongue

Offline

#25 2010-07-16 13:20:12

samuele.mattiuzzo
Member
From: Treviso, IT
Registered: 2009-10-12
Posts: 307
Website

Re: Archcleaner?

everything went fine smile

Offline

Board footer

Powered by FluxBB