Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management

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.

Linux Interview Questions on RPM
Linux Interview Questions on RPM

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

[root@tecmint 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
....

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Avishek
A Passionate GNU/Linux Enthusiast and Software Developer with over a decade in the field of Linux and Open Source technologies.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

14 Comments

Leave a Reply
  1. Hi,

    Very nice job.

    About question #1, sometimes we don’t know the exact name of the package.

    For that reason, I would use ‘grep‘ command. like:

    # rpm -qa | grep -i nano
    

    Let’s say if there is a package names ‘gnaao’, ‘Nano’ or ‘nano-7.2’ we will know about it.

    Thank you

    Reply
  2. hi

    is any one has idea about why some time use same priority in MX for example google MX record

    Priority Mail Server
    5 ALT1.ASPMX.L.GOOGLE.COM.
    5 ALT2.ASPMX.L.GOOGLE.COM.
    Thank You

    Reply
    • I think its too late If you have not yet find the answer.

      By using multiple MX records with the same preference (ie 5) will provide some load balancing

      Reply
  3. I am also a trainee Linux geek but unable to find this kind of jobs in Delhi and NCR area, all companies hire for minimum 2 year of experience. Can. You help me to come out this situation?

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.