Problem when trying to remove a package using rpm command - error: package is not installed

Hello,

i have installed a package by using the command

sudo rpm -i filepackage.rpm
        package filepackage is already installed

when i try to remove it, i get an error saying "is not installed":

sudo rpm -e filepackage.rpm
error: package filepackage is not installed

How can i remove the rpm package and how can i be sure
that it is already installed?

Is there any other command?

Thanks, in advance

rpm -qa | grep filepackage

When you get the output with the name of the package, remove it (notice no rpm extension in output)

rpm -e filepackage

Thanks for replying,

it actually worked.

I executed the following command without the ".rpm" extension:

rpm -e filepackage
warning: /etc/hd/env.sh saved as /etc/hd/env.sh.rpmsave

What does the previous warning mean?Is that going to cause me any problem?

However, when i executed the following command, i didn't see anything in the output, the output was empty.Was that ok?

rpm -qa | grep filepackage

But what about the location of the ".rpm" contents of the package?
Can i define in the rpm command where i would like the package to be installed?

Cause i have downloaded it in the /usr/test directory.
And i noticed that the package was installed in the /usr directory
and not in /usr/test directory

Why does this happen?
And how can i define the location of the installation of an rpm package?

Thanks, in advance

That is normal. Configuration files are normally saved and given a .rpmsave extension.

Again that is normal. Linux follows the Unix philosophy of not outputting anything unless error or required.

Read the rpm manpage. Especially section detailing --prefix.

I have faced the same problem, follow the command
1-updatedb
2-init 6
3-rpm -ivh package.rpm(if it is already installed)
then
1-init 6
2-rpm -e package.rpm(e for remove the package (it work in redhat only))
3-updatedb (to send a message to update the kernel entry)