LINUX-Frequently used commands
| rpm command Managing RPM packages. |
| Syntax |
| rpm [Option] [Package name] |
| The rpm command is a package management command.. You can install, uninstall and update packages and easily manage your Linux software.. This command can only be executed by the super user (root). |
| Frequently used options |
| -i Install -v Display package names -h Display a "# (hash mark)" to indicate the processing status -q Make enquiry -F Upgrading -U If the package is not installed, install it -e Delete. |
| Example: Display a list of installed packages. |
| $ su - ← Become a super user root Password: Enter root password # rpm -qa |grep httpd httpd-tools-2.2.15-15.el6.centos.1.x86_64 httpd-manual-2.2.15-15.el6.centos.1.noarch httpd-devel-2.2.15-15.el6.centos.1.x86_64 httpd-2.2.15-15.el6.centos.1.x86_64 |
| Example: Show details of installed packages. |
| $ su - ← Become a super user root Password: Enter root password # rpm -qi httpd Name : httpd Relocations: (not relocatable) Version : 2.2.15 Vendor: CentOS Release : 15.el6.centos.1 Build Date: 14/02/2012 07:33:29 PM Install Date: 23/02/2012 09:53:47 PM Build Host: c6b18n2.bsys.dev.centos.org Group : System Environment/Daemons Source RPM: httpd-2.2.15-15.el6.centos.1.src.rpm Size : 3062864 License: ASL 2.0 Signature : RSA/SHA1, 14/02/2012 07:33:29 PM, Key ID 0946fca2c105b9de Packager : CentOS BuildSystem <http://bugs.centos.org> URL : http://httpd.apache.org/ Summary : Apache HTTP Server Description : The Apache HTTP Server is a powerful, efficient, and extensible web server. |
| Example: Outputs a list of files contained in the specified package. |
| $ su - ← Become a super user root Password: Enter root password # rpm -ql httpd. |
| Example: Install the package |
| $ su - ← Become a super user root Password: Enter root password # rpm -ivh package-x.y.z.rpm ← -v (--verbose) and -h (--hash) will show you the progress of the installation. |
| Example: Upgrading a package |
| $ su - ← Become a super user root Password: Enter root password # rpm -Uvh package-x.y.z.rpm ← -v (--verbose) and -h (--hash) will show you the progress of the installation. |
| Example: Uninstalling a package |
| $ su - ← Become a super user root Password: Enter root password # rpm -e package-x.y.z.rpm |
| Example: Uninstall the package (in case of dependency-related errors) Deprecated |
| $ su - ← Become a super user root Password: Enter root password # rpm -e --nodeps package-x.y.z.rpm |
