Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have by a mistake written this command on a CentOS server

xargs rpm -e|rpm -qa|grep test11

where I meant

rpm -qa|grep test11|xargs rpm -e

which should uninstall all packages matching "test11".

Can someone figure out what the first command do? I am afraid that it un-install ALL packages =(

share|improve this question
up vote 7 down vote accepted

No worries, it just executed 'rpm -e' which would not remove any package.

[root@web420 ~]# rpm -e
rpm: no packages given for erase

BTW, for verifying you have not removed all packages you could just run

rpm -qa

and see the list of installed packages.

share|improve this answer
As long as you specified no input to xargs "rpm -e" should bail out with an error message and the rest of the chain "does nothing" (at least in terms of modification) – voretaq7 Feb 8 '10 at 18:23
For the future, specify --test to potentially-destructive RPM commands (like -e): It will tell you what it's going to do without actually changing your system so you can avoid unplesant surprises. – voretaq7 Feb 8 '10 at 18:24
@voretaq7 great point! – Saggi Malachi Feb 8 '10 at 18:29
@voretaq7: Excellent trick. I will clearly use that from now on =) – Sandra Feb 10 '10 at 12:11
By the way: if you removed all packages from RHEL, it wouldn't run at all! Everything is a package, right down to the filesystem layout. – Mei Jan 13 '11 at 22:25

The first command you gave will not remove all packages (phew!). Here is the command you gave:

xargs rpm -e|rpm -qa|grep test11

The command rpm -e does remove RPMs, but with xargs listed without a pipe, it takes its input from the terminal and waits for your input. The second command would essentially replace the output from rpm -e with rpm -qa (all RPMs) then find the RPM test11 (if it exists).

Not a command string worth running, but certainly one worth understanding...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.