Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-18-2009, 04:39 AM
|
#1
|
LQ Newbie
Registered: Sep 2009
Posts: 9
Rep:
|
Using Yum and Grep together
Hello all,
N00bie question, but I was reading this guide for akmod that I cannot find again. In this guide, it explained a way of removing all NVIDIA packages using a combination of Yum and Grep to do it.
I have just upgraded from Fedora 11 to Fedora 12 and wanted to remove some orphaned Fedora 11 packages that didn't get erased. I thought this would be an easy way to do it.
If anyone can help, it'd be great .
Cheers, Mitch.
|
|
|
11-18-2009, 06:32 AM
|
#2
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
*
1) su
2) yum list installed | grep fc11
|
|
|
11-18-2009, 07:35 AM
|
#3
|
Member
Registered: Oct 2003
Location: Sydney, Australia.
Distribution: Debian, Ubuntu
Posts: 400
Rep:
|
Code:
rpm -qa |grep fc11 > TEMP
while read pac ; do yum -y remove $pac ; done < TEMP
rm -f TEMP
Something like that should work.
To test it, just get it to print what it would do:
Code:
rpm -qa |grep fc11 > TEMP
while read pac ; do echo yum -y remove $pac ; done < TEMP
rm -f TEMP
|
|
|
11-18-2009, 04:02 PM
|
#4
|
LQ Newbie
Registered: Sep 2009
Posts: 9
Original Poster
Rep:
|
Hi Guys,
The "yum list installed | grep fc11" does work, just not 100% sure why I can't use it with the "erase" parameter.
I haven't tried that script, but it's certainly interesting. I'm going to try and learn more about bash scripting .
Thanks for the quick responses, guys .
Cheers, Mitch.
|
|
|
11-18-2009, 05:31 PM
|
#5
|
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,647
|
you could use "DaveQB" script BUT I WOULD NOT .
there is a -y tag in it
THAT IS VERY BAD
and something that WILL at some point kill a system from a simple typo .
from
Code:
yum list installed | grep fc11
that will give you a list .If it is long or you want a text copy you could do this
" yum list installed | grep fc11 > ~/f11.txt " and you will have a text file in your home folder
then
one at a time remove the fedora 11 rpm's
this is THE SAFEST WAY
"yum erase filename"
|
|
|
11-18-2009, 07:26 PM
|
#6
|
Member
Registered: Oct 2003
Location: Sydney, Australia.
Distribution: Debian, Ubuntu
Posts: 400
Rep:
|
John VV is right in this situation.
The snippet I gave I have used to rip out 32bit packages on 100 or so machines, so it was scripted.
|
|
|
11-19-2009, 01:24 AM
|
#7
|
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,647
|
the main thing is with yum ( install or remove) the -y tag can be very dangerous .
i would not use it until you DO KNOW EXACTLY what you are doing
this is a example - DO NOT RUN THIS !!!!
"yum erase -y glibc "
the above will remove about 95% of the operating system
|
|
|
11-19-2009, 03:56 AM
|
#8
|
LQ Newbie
Registered: Sep 2009
Posts: 9
Original Poster
Rep:
|
Hi Guys,
I know the "-y" tag gives an automatic yes to everything. I have left the packages for now as I originally thought they were orphans from the upgrade, but they seem to be getting updated automatically from the Repos over time. I assume some apps just weren't packaged in time for F12 to release.
John VV is certainly right. By telling yum to erase all the fc11 packages left over wanted to remove over 200 packages, including "yum" and "rpm". That would have been disastrous for me!
Cheers, Mitch.
|
|
|
All times are GMT -5. The time now is 07:57 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|