You are not logged in.

#1 2010-05-22 15:06:26

Hilariousity
Member
Registered: 2009-06-09
Posts: 20

one liner to cleanup unused dependencies

pacman -Qdt | sed 's/ .*//' | sed -e :a -e '$!N; s/\n/ /; ta' | xargs sudo pacman -R

Hi Everyone!
I created this gigantic one liner to cleanup unused dependencies using pacman. However, I was wondering if there is a more efficient way of doing this. Anyone have any ideas?

Offline

#2 2010-05-22 15:09:45

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: one liner to cleanup unused dependencies

How about

pacman -Rs $(pacman -Qdtq)

Ogion


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

#3 2010-05-22 15:13:51

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: one liner to cleanup unused dependencies

emmm, afaik you don't want to automatically loose everything listed by "pacman -Qdt"...
quick test on my system: kernel-headers? git? gnome-common?

Offline

#4 2010-05-22 15:24:29

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

Re: one liner to cleanup unused dependencies

hokasch wrote:

emmm, afaik you don't want to automatically loose everything listed by "pacman -Qdt"...
quick test on my system: kernel-headers? git? gnome-common?

you should fully update your system then. kernel-headers was replaced by linux-api-headers, gnome-common is in your system because was as a makedepends, i suppose git the same.

Last edited by wonder (2010-05-22 15:24:51)


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

Offline

#5 2010-05-22 15:36:48

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: one liner to cleanup unused dependencies

Ah, allright. My system is fully updated, and both kernel26-headers and linux-api-headers are installed. I'll just remove the kernel-headers then.

I installed git as makedepend, but still want to keep it wink Ok, maybe I should just work through the list and explicitly install everything important...
Still I personally would prefer sorting through the -Qdt output before removing everything.

Offline

#6 2010-05-22 16:01:06

Hilariousity
Member
Registered: 2009-06-09
Posts: 20

Re: one liner to cleanup unused dependencies

Oh, a word of caution. That one liner I posted here uninstalled the font I was using in xterm and and anyone using it might want to check the files listed by pacman -Qdt or pacman -Qdtq before you uninstall them.

Last edited by Hilariousity (2010-05-22 16:01:32)

Offline

#7 2010-05-22 16:18:46

lymphatik
Member
From: Somewhere else
Registered: 2009-03-07
Posts: 119

Re: one liner to cleanup unused dependencies

It once proposed me to remove iniscripts. It was the funniest joke arch could give me

Offline

#8 2010-05-22 16:23:56

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: one liner to cleanup unused dependencies

I quite like this:

% LC_ALL=C pacman  -Qi kernel26
Name           : kernel26
Version        : 2.6.33.4-1
URL            : http://www.kernel.org
Licenses       : GPL2  
Groups         : base  
Provides       : None
Depends On     : coreutils  kernel26-firmware>=2.6.33  module-init-tools  mkinitcpio>=0.5.20  
Optional Deps  : crda: to set the correct wireless channels of your country
Required By    : None

Note the None in the required line..
smile

Ogion

Last edited by Ogion (2010-05-22 16:24:16)


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

#9 2010-05-23 00:49:32

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

Re: one liner to cleanup unused dependencies

@Ogion yes because you don't have any external module that depend of it. Also you omitted the most important part.

Install Reason : Explicitly installed

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

Offline

#10 2010-05-23 07:09:21

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: one liner to cleanup unused dependencies

Yea true, wonder. I still like it big_smile

Ogion


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

Board footer

Powered by FluxBB