10 Useful Interview Questions and Answers on Linux Commands

Linux command Line and the interaction of users with Linux Shell with Linux Commands is the most wonderful part of Linux and is one of the most widely topic from interview point. Here in this article we are coming up with 10 wonderful questions that are important from the interview perspective and will surely add to yours knowledge base.

Linux Interview Questions
Linux Command Questions
1. How will you suspend a running process and put it in the background?
Answer : In order to suspend a running process/job and put it in the background we need to use the key combination Ctrl+z.
2. What are the minimum number of partitions required to install Linux and How will you check boot messages?
Answer : The /root partition alone is sufficient to perform the whole task however minimum three partitions are recommended to install Linux. These are root, boot and swap. An IDE Hard Disk Drive supports upto 63 partitions and SCSI Hard Disk Drive supports up-to 15 partitions.

In order to check boot messages we need to use cat or dmesg commands as shown below.

# cat /var/log/messages

OR 

# dmesg
3. Name the Daemon responsible for tracking System Event on your Linux box?
Answer : The Daemon ‘syslogd’ is responsible for tracking system information and stores the tracked logs in specific log files.
4. What are the minimum requirements to run command ‘fsck’ on root partition?
Answer : The /root partition must be mounted as read only mode and not read-write to execute fsck command on root partition.
5. How to copy /home directory hierarchically to another directory. How will you do it?
Answer : A Linux command ‘cpio’ comes to rescue here. The ‘cpio’ utility copies files and directories hierarchically over another location.
6. How will you automate the rotation of logs in Linux?
Answer : A Linux command ‘logrotate’ comes to rescue when it comes to automate the logs in Linux.
7. How to know who has scheduled the job?
Answer : The Linux command ‘at’ along with switch ‘-l’ is all we need to use in order to check who has scheduled the job.
8. How to view the contents of the tar ball without extracting it. How will you do this?
Answer : We need to use command ‘tar’ with options ‘-tvf’. The options ‘t’ (Display the contents), ‘v’ (Verbose), ‘f’ (files).
9. What is page Fault and how it happens?
Answer : A program request for some data and if it is not available in the Memory it is called as page fault. Page Fault occurs as a result of program shutdown.
10. What are return codes in program?
Answer : A return code is the feature of Shell. The result of return code shows the status of a program. A successful program after execution returns ‘0’, && can be used to prioritize which application will be executing first.

That’s all for now. I’ll be here again with another interesting article soon. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback in the comment section 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.

6 thoughts on “10 Useful Interview Questions and Answers on Linux Commands”

  1. In yum client not access to server , I’m getting the error “access denied” I checked iptables services and configuration files also. all are correct. the error is”ftp://192.168.231.131/pub/rhel6/repodata/repomd.xml: [Errno 14] PYCURL ERROR 67 – “Access denied: 530”
    .. what to do

    Reply
  2. Q: 2…………

    Minimum 2 partitions are needed for installing Linux.
    The one is / or root and another is swap

    Q7. How to know who has scheduled the job?
    As per your answer #at –l command please let know clarity about it.
    Acutely I am not aware of it please…

    Thank you,
    Sathish

    Reply
  3. 8 – I would choose tar -tf archive.tar :) or tar -atf archive.tar.[bz2|gz|xz] ;)

    and on question 2, I suppose space is missed between / and root: /root :)
    And regarding 2nd, cool thing about partitions I didn’t knew, will double check, but I think it has limitation on Partition Table, not just type of disk ;)

    Reply
  4. 1. ^Z suspends a program, but does not run it in the background. To run it in the background you use another command. (You *do* know what it is, don’t you?)

    2. /root is not a partition; it is a directory in the root partition; the root partition is /.

    5. Why not cp -a?

    10. Return codes are not a feature of the shell. All programs leave a return code whetehr they are run by the shell or not.

    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.