Shilpa Nair has just graduated in the year 2015. She went to apply for Trainee position in a National News Television located in Noida, Delhi. When she was in the last year of graduation and searching for help on her assignments she came across Tecmint. Since then she has been visiting Tecmint regularly.
All the questions and answers are rewritten based upon the memory of Shilpa Nair.
“Hi friends! I am Shilpa Nair from Delhi. I have completed my graduation very recently and was hunting for a Trainee role soon after my degree. I have developed a passion for UNIX since my early days in the collage and I was looking for a role that suits me and satisfies my soul. I was asked a lots of questions and most of them were basic questions related to RedHat Package Management.”
Here are the questions, that I was asked and their corresponding answers. I am posting only those questions that are related to RedHat GNU/Linux Package Management, as they were mainly asked.
1. How will you find if a package is installed or not? Say you have to find if ‘nano’ is installed or not, what will you do?
Answer : To find the package nano, weather installed or not, we can use rpm command with the option -q is for query and -a stands for all the installed packages.
# rpm -qa nano OR # rpm -qa | grep -i nano nano-2.3.1-10.el7.x86_64
Also the package name must be complete, an incomplete package name will return the prompt without printing anything which means that package (incomplete package name) is not installed. It can be understood easily by the example below:
We generally substitute vim command with vi. But if we find package vi/vim we will get no result on the standard output.
# vi # vim
However we can clearly see that the package is installed by firing vi/vim command. Here is culprit is incomplete file name. If we are not sure of the exact file-name we can use wildcard as:
# rpm -qa vim* vim-minimal-7.4.160-1.el7.x86_64
This way we can find information about any package, if installed or not.
2. How will you install a package XYZ using rpm?
Answer : We can install any package (*.rpm) using rpm command a shown below, here options -i (install), -v (verbose or display additional information) and -h (print hash mark during package installation).
# rpm -ivh peazip-1.11-1.el6.rf.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:peazip-1.11-1.el6.rf ################################# [100%]
If upgrading a package from earlier version -U switch should be used, option -v and -h follows to make sure we get a verbose output along with hash Mark, that makes it readable.
3. You have installed a package (say httpd) and now you want to see all the files and directories installed and created by the above package. What will you do?
Answer : We can list all the files (Linux treat everything as file including directories) installed by the package httpd using options -l (List all the files) and -q (is for query).
# rpm -ql httpd /etc/httpd /etc/httpd/conf /etc/httpd/conf.d ...
4. You are supposed to remove a package say postfix. What will you do?
Answer : First we need to know postfix was installed by what package. Find the package name that installed postfix using options -e erase/uninstall a package) and –v (verbose output).
# rpm -qa postfix* postfix-2.10.1-6.el7.x86_64
and then remove postfix as:
# rpm -ev postfix-2.10.1-6.el7.x86_64 Preparing packages... postfix-2:3.0.1-2.fc22.x86_64
5. Get detailed information about an installed package, means information like Version, Release, Install Date, Size, Summary and a brief description.
Answer : We can get detailed information about an installed package by using option -qa with rpm followed by package name.
For example to find details of package openssh, all I need to do is:
# rpm -qa openssh [[email protected] tecmint]# rpm -qi openssh Name : openssh Version : 6.8p1 Release : 5.fc22 Architecture: x86_64 Install Date: Thursday 28 May 2015 12:34:50 PM IST Group : Applications/Internet Size : 1542057 License : BSD ....
If You Appreciate What We Do Here On Jassweb, You Should Consider:
Jassweb is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit Jassweb! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.