Hawaiʻi's Technology Community

A recruiter called, said the job interview was all over the phone, one and done. These are sample questions. Seem pretty simple to me. What do you think?

  1. Explain what this command does, and what is different between the first and the second command:

    1. su - myapp -c

    2. su myapp -c

    3. (A) You are running a script "" with the user account "myapp." The first example will also use the application environment (login environment) of the user "myapp" while the second example will use the environment of the user who ran the command.

  2. You are reading lines of a  colon delimited text file with a shell script into a variable "MYVAR." Explain how to extract and assign the third delimited field of that file to the variable "MYFIELD"

    1. Possible answers should look like one of these. (Candidate may ask to type it locally or write it down before answering - bonus points if they don't ask for more time):

      1. MYFIELD=`echo "$MYVAR" | awk -F: '{ print $3 }'`

      2. MYFIELD=$(echo "$MYVAR" | awk -F: '{ print $3 }') 

      3. MYFIELD=`echo "$MYVAR" | cut -d":" -f3`

      4. MYFIELD=$(echo "$MYVAR" | cut -d":" -f3)

  3. You are executing a shell script "" as another user account, but the script exits abnormally with a permission error but it is unclear what directory or file is causing the problem. How would you go about troubleshooting the script to find out the source of the permission problem?

    1. (A) Validate that you are able to execute anything as the other user account first. Next, invoke that shell with the '-x' option ahead for the script to show debug information while the script is executing. (example: su <account> -c 'sh -x' )  

    2. Follow-up question if they got the last part correct: If you had to do the same but only wanted to debug a portion of the shell script, how would you do that?

      1. (Af) edit the script you are running and place a 'set -x' statement at the starting point of the debug section and a 'set +x' statement at the ending of the code section you are testing.

  4. How do you display the exit code of the last executed command in the current shell?

    1. (A) echo $?

  5. If you execute 'ls -ld *' in your current directory and you get the error that reads something like the argument list is too long, what is the problem and what would you do to get around the problem?

    1. (A) There are various answers to this issue, but in essence, the number of characters that 'ls' is trying to provide output for has exceeded the length of the shell interpreter. Either there are too many files, too long of a path, or all the file names are too lengthy, or a combination of one or more of these conditions can all lead to the problem. Look for the interviewee to answer using a program like 'xargs' or 'find' to solve the problem.

  6.  What is an inode?

    1. (A) It is a file descriptor, that contains information like file ownership, permission, creation and modification times, etc.

Views: 139

Replies to This Discussion

  1. How can you make an entire chain for directories (I.e.  /opt/abc/xyz/files/) in 1 command, where the sub directories do not already exist?

    1. (A) mkdir –p <full path to directory> 

  2. How can you grep ‘-c’  strings from a file?

    1. (A) grep -- -c <filename>

  3. How can you check a Perl scripts’ syntax with a command?

    1. (A) perl –c

  4. How can you troubleshoot/debug a ssh connection? 

    1. (A) ssh -vvvv

What’s an SQL Injection and how do you prevent it?

What does SQL stand for?

What is Obj Oriented Programming?



web design, web development, localization

© 2022   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service