10 Useful ‘Interview Questions and Answers’ on Linux Shell Scripting

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

24 Responses

  1. Tomas Raulickis says:

    I’ve found a little mistake in the 8th question about cut command.

    In the first example, the -c option is used and it extracts characters not columns as stated.

  2. Ankit says:

    Can I ask shell scripting related questions on your site and if not then can you suggest me some other good sites?

  3. Sudhakar amineni says:

    Yes As said above by Zess, ls command is used for to see list of files.

    Its wrong what you mentioned here

  4. zen says:

    isn’t command ls used to list files in a directory?

    • Zool says:

      It meant to say “less” rather than “ls”. As it is, yeah. It’s wrong.

    • Warron French says:

      The way the question was asked wasn’t very clearly stated to accomplish the use of the command ls and echo to answer it in the affirmative and explain.

      The question should have been, “Is it possible to list the file and directory names of a given ‘parent directory’ using a command other than ‘ls?'”

      Yes, the use of “echo *” will perform the equivalent of a plain “ls.”

  5. jagan says:


    I need to execute a script on remote as a sudo user or root user from my local VM. It is not password less login. we need to pass password thorugh command line.

    sshpass -p “xxxx” ssh -o StrictHostKeyChecking=no [email protected] <<EOF
    echo "password" | 'sudo su -'
    sh script.sh

    Note : there is no sshpass in remote server and we cannot install it for security reason.

    I am able to login to remote user as user but i can't login as a sudo user , Please help me how to achieve this. i have seen many quires but none one helped me


    • Ravi Saive says:


      In CentOS, there isn’t any sudo user by default and the all the programs run with root privileges as root user, if you want to run enable sudo for user, you shoud use visudo command to enable it as shown:

      # visudo

      And add this entry to enable sudo privileges to your user.

      yourusername ALL=(ALL) ALL

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.