I installed some packages with rpm -i *.rpm and dnf install *.rpm

But, I couldn't erase these all packages which I install with dnf -i *.rpm, rpm -i *.rpm but, I want to erase these with rpm -e *.rpm and dnf remove *.rpm

It gave this error:

Error: No packages marked for removal.

But, I tried install these erasing all packages again with rpm -i *.rpm and dnf install *.rpm. But, it gave this error:

package somepackage(s).rpm is already installed"

But, I tried again to erase these package again, but, It gave again same error:

Error: No packages marked for removal.

I want to learn, how can I erase these packages without erasing just one-by-one. I want just to erase these packages immediately by using *.rpm.

I tried install just one package again it finished, and I tried to erase this package and it finished.

I just want to erase all packages just one command as rpm -i *

Can you help me where is wrong with command in bash. Maybe I am not right. Can you help me to fix this problem.

Sorry for my bad English.( My native tongue is not English ). Thanks for your time.

I wish we will live in a better world, like everyone is using open source software.


To remove the packages which you just installed, you need the package names, not the names of the files. Usually (not always) you can get this by stripping the ".rpm" suffix from each, e.g.,

for name in *.rpm
    LIST="$LIST $(basename $name .rpm)"
sudo dnf remove $LIST

Removing packages with dnf is preferable to using rpm directly, since dependencies are taken into account.


For installing you use file name. E.g "foo-1.2-x86_64.rpm." For removing (or quering) you use package name E.g. "foo" or "foo-1.2-x86_64". I.e. without that ".rpm" suffix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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