Professional job interview tests – can you answer them directly from your head?

No matter how much knowledge and experience you have with almost everything from IT side – when you go to a job interview, you can expect unexpected questions, and when I said “unexpected questions” and I’m not thinking about most stupid questions on planet like “Where do you see yourself in our team for 10 years” or “Why should we employ you -and not someone else” – I mean exactly the very professional questions that you should know and are expected to know.

For example, for a whole day I hang over the command console and nRemoteNG, a black window in front of me all day that I’m Saša Matić – and then I go to a job interview and I stuck down with the question: “With which command you can copy the file xxx.txt from folder AAA folder to folder BBB but to leave the original permissions from source.” Simply, you come across questions in things you never worked with – for example, I have never copied with need to save original file permissions – but of course if I had to do it, I would try first “man cp” and I would see which parameter is related to it – and in this case that is parameter ‘p’ as a ‘preserve’, so the original command would be: cp -p /path/to/AAA/xxx.txt / path / to / BBB

In the tests below, there are tests for three IT positions, from which I was applied for two – System Programmer for Linux, Junior System Administrator and Linux System Administrator (I was not on the Junior test, one of blog followers sent me a test through Facebook) – with sone questions where I still have no answers. All tests were required answers directly from the head and without using any help (man, Google, others). The questions were marked in the way I did them and how I knew them (without any googling for this blogpost) and questions marked with the red color are questions where I didn’t have answer, so if somebody had the answer – he can wrote on comment area of this blog.

BTW, I’m System Administrator and the paradox is: I have the least knowledge for Junior System Administrator position – based on test. I deliberately put a click on the answer in + to try to first hear yourself … whether you would know the answers from the head, without googling and anything else. All answer bellow are from head and I did not use Google, man or anything else for making of this blogpost.

Test for job position:
System Programmer for shell

I’ve answered on all questions on this test correctly – but I had some little mistakes based on typo, for example instead of ‘fi’ I put somewhere ‘fa’ or instead ‘read’ I put ‘reda’ – but that was not a problem for people who held the test – for them it was only important to know that there was, as they said, the right way of thinking and knowing the syntax. In the test, you had a VirtualBox machine for testing purposes – but without a PuTTY/SSH approach (just typing directly into VirtualBox) – so the test code was absolutely impractical … so I hit everything out of my head and without testing. The deadline for completing this test was 30 minutes.

1) Create a shell script that will do the following
  • Input parameter: Enter folder name:
  • Print out the total number of files within that folder
  • Make a file in which the result will be in a human friendly format and print where this file is located
  • Display “Completed”
The answer
read -p "Enter folder name: " FOLDERNAME
if [ -d ${FOLDERNAME} ]
	echo "There is `find ${FOLDERNAME} -type f | wc -l` files in ${FOLDERNAME}" | tee /tmp/output_file.txt
	echo "File with result is: /tmp/output_file.txt"
	echo "Completed"
	echo "There is no folder with name ${FOLDERNAME}. Sorry, try again."
2) Create a shell script that will do the following
  • Input parameter: Enter user:
  • Input parameter: Enter password:
  • Login to mysql with that login credentials
  • Create a file containing a list of all available databases
  • Display “Complete” if login was successful
The answer
read -p "Enter user : "     DB_USER
read -p "Enter password : " DB_PASS
mysql -u ${DB_USER} -p"${DB_PASS}" -e "show databases;" > /tmp/output.txt 2>/dev/null

if [ $? = 0 ] ; then
echo "Complete"
echo "Something goes wrong, does user ${DB_USER} with password ${DB_PASS} exists?"
3) Create a shell script that will do the following
  • Create file with next information in one line: Timestamp – Hostname:
The answer
echo "`date` - `hostname`: " > /tmp/output_file.txt
4) Create a shell script that will do the following
  • Input parameter: Enter first name
  • Input parameter: Enter last name
  • Print on display: Hello Lastname, Firstname
  • Create output file with a result
  • Print current date and time in human friendly format
The answer
read -p "Enter first name: " FIRSTNAME
read -p "Enter last name: " LASTNAME
echo "Hello ${LASTNAME}, ${FIRSTNAME}" | tee /tmp/output_file.txt
echo "Today is: "$(date +'%A, %d.%m.%Y (%H:%M'\))
5) Create a shell script that will do the following
  • Read all lines from file /root/test.txt
  • Show all line on display but with line numbers
The answer
grep -n "" /root/test.txt # :-)
6) Create a shell script that will do the following
  • Input parameters: Enter the Source Folder:
  • Input parameters: Enter the Destination Folder:
  • Create that Destination folder – if doesn’t exists
  • Copy everything from Source Folder to Destination Folder
The answer
read -p "Enter the Source Folder: "      SOURCEFOLDER
read -p "Enter the Destination Folder: " DESTINATIONFOLDER

if [ ! -d "$SOURCEFOLDER" ]; then
  echo "There is no source folder: ${SOURCEFOLDER}"
  exit 1

7) Create a shell script that will do the following
  • Input parameter: Enter 1st number:
  • Input parameter: Enter 2nd number
  • Print bigger number
The answer
read -p "Enter 1st number: " NO1
read -p "Enter 2nd number  " NO2

if [ ${NO1} -gt ${NO2} ] ; then
	echo "${NO1} is bigger"
	echo "${NO2} is bigger"
# Bonus :)
if [ ${NO1} -eq ${NO2} ] ; then
	echo "Numbers are equal"

Test for job position:
Junior System Administrator

This is a test that was sent to me by one of blog’s followers, and it’s about a big company operating in the whole territory of Serbia. Half of these questions I have no idea how to answer, and if I went for testing I would fairly blur myself because there are many questions for Junior System Administrator which I don’t know – and I am System Administrator (without this Junior shit)…and I would not even be in the last 10 in this test. These are questions for the junior system administrator – I could only imagine how look like questions for Senior System Administrator.

1. A Linux command that requires a new IP address from a DHCP server is:
The answer
dhclient -r
2. Windows CLI commda for check: When will domain password expired:
The answer
# Question id confused, I guess they were thinking about this
net user %USERNAME% /domain
3. Do you know which services can be connected via the SSO or did you already had the opportunity to implement something like that in the Windows / Linux environment?

I have no idea what is a answer and I will not google it. If someone have a answer – please write it in comment area – but without googling!

4. Advantages of Linksys WRT54GL router?

I have no idea what is a answer and I will not google it. If someone have a answer – please write it in comment area – but without googling! I guess, as far as Linksys is concerned, it’s a low price – but for this particular model – how the fuck I should know directly from my head. I can also assume that as far as WRT is concerned, it is a firmware that can easily be adapted to local needs.

5. What is the main advantage of the latest version of Samba server?

I have no idea what is a answer and I will not google it. If someone have a answer – please write it in comment area – but without googling! I will wroute here some default stuff for related to new software versions – improved security, disabled weak protocols (SMBv1 for example) and similar shit

This is box title
The answer


7. Default ports:
SSH:__ DNS:__ HTTP:__ SSL:__ VNC:__ RDP:__ PPTP:__ L2TP:__ FTP:__
The answer
SSH:22 DNS:53 HTTP:80 SSL:443 VNC:5901 RDP:3389 PPTP:1723 L2TP:1701 FTP:21

8. What is the command to create permanent links in Linux and how to delete them?

To be honest – I have no idea what is ‘permanent link’ (that is a reason why I marked this question with red), I guess they were thinking about symbolic link…and in that case it’s ln -s /source/file /destination/link, and it they thinking about hardlinks – command is the same but without ‘-s’ parameter. Delete will be with: rm /destination/link

9. What is WPAD?
The answer
A file that provides an automatic configuration for using proxy servers on client devices.
10. Windows CLI command for refresh of Group policy:
The answer
gpupdate or you can force it with: gpupdate /force
11. Recommended commands for update on Ubuntu:
The answer
sudo apt-get update
sudo apt-get upgrade
12. Glassfish is:
The answer

Application server

13. Where is default profile config in Linux?
The answer


14. OpenVPN make a problem with users without administrator rights. What is the solution?:
I have no idea – directly from head. I guess there is some explanation in OpenVPN Wiki/howto (I google it – there is explanation on OpenVPN wiki – but you cannot answer directly from head).
15. After installing CentOS minimal server autocomplete function does not work. How to make it work:
The answer

yum install bash-completion (I googled this, because I installed bilion of CentOS servers and I never had this kind of problem).

This is box title
The answer

yum localinstall package.rpm

17. How to create a secure connection between DHCP and DNS server on the Linux server:

I have no idea what is a answer and I will not google it. If someone have a answer – please write it in comment area – but without googling!

18. What is a different between Thin and Tick RAM memory allocation in VMware ESXi server:

I hear now, first time about the Thick and Thin memory space, I know about storage provision – but nothing related to RAM. If by the same philosophy, Thick takes 100% of the allocated RAM regardless of how much it is used until Thin takes only as much as it is used on the hypervisor. However, memory reservation is done in very different way, so – I do not know the answer to this question from the head and I mark it red (it is possible that the trick is a question) so if you have a response – public, I will not google it…

19. Describe in short line:
$IPTABLES -t nat -A PREROUTING -p tcp --dport 5900 -i $INTERNET_if DNAT --to
The answer

Port forwarding to

20. With which command I can edit the document opened by the VI editor, and which command document closes the document by saving the changes?
The answer

insert or little letter i.
:wq! or :x!

Test for job position:
Linux System Administrator

On this test, I’m blamed for all money. Although I knew all the questions, the brain was blocked because I came to test after full-time work on some fucking problem but successfully settled in the end and immediately after the first shift at work (eyes, brain, spine distroyed) so that when I left with I told the talk “Goodbye” to people because there is no excuses. Later, I got a feedback from that company – they just want to see do I know how to approach the problem and know which program or command is there at all about? – for example for question, “Which command is used on computer A to copy the file from computer B to computer C “- it was enough for them to just mention the scp and basic syntax of the ‘scp file blabla…’, not the whole command.

Here I will enter the correct questions (I am now rested, fresh and all I know) but I will mark in the answers what I knew and what not from the head.

Copy the entire contents of the AAA folder to the BBB folder, but leave original permissions
The answer
# I didn't know from head about 'p'
cp -pa AAA/. BBB/
Selinux is short from what?
The answer
Security-Enhanced Linux
Create a 250MB file
The answer
# I didn't know whole syntax from head even I doing this very often
dd if=/dev/zero of=filename bs=1M count=250
How to find all files older than 30 days and that are greater than 20MB and delete them
The answer
# I didn't remember about 'size' - other from this command I know
find /path/ -type f -mtime +30 -size +10M -exec rm -f {} \;
How to copy, using only one command from a computer with IP address - one folder with all files from a computer - to a computer
The answer
# I could not remember full syntax because I never did this 
# The farthest thing I did was scp some-file user@IP:/path/to/ folder
scp user@* user@
I added you a new disk ... extend it to the existing LVM (I even made the blog and instructions from this but the brain block). Print all steps and syntax.

I did not know this directly from a head, even though I worked a million times. I knew the fdisk part in the first place and pvcreate/lvcreate commands… so I answered that I do not know my mind and fuck it. Paradox is – I create manual about this on this blog (in Serbian).

What is called a daemon that fills /var/log/messages?

This is the only question that I really did not know, and the answer is: syslogd

How do give read and execute permissions to members of the dev group for folder named ccccc?
The answer
# I did not know from head and I know it's about ACL. I was to fucking tired....
setfacl -m g:dev:rx /ccccc/
List all information and structure from file /etc/passwd
The answer

Username, Pasword (is set), UID, GID, Info, home folder and default shell. I forgot here password and info part, but fuck it – I will use cat /etc/passwd to see what is inside for God dammit

File in Tomcat where is defined default port and main log file in Tomcat are...?
The answer

server.xml and catalina.out

Where you can see Oracle errors while Oracle works?
The answer

alert.log (I dont know where is relation between this question and Linux, but OK, I know this one)

Default port for Tomcat is....and on what 2 ways you can change it?
The answer

Default: 8080 and you can change it on server.xml file or with port forward.

On which file is information about user password?
The answer

/etc/passwd (is password set for user) and /etc/shadow (encrypted password)

Can a swap be extended without restarting the server?
The anwer

It can, add a separate swap file of so needed size and do a mkswap and swapon without restart…and put this info in fstab

Which command is used for monitoring of server load?
The answer

top, wmstat, sar (if sysstat is installed)

What will happen if RAM and SWAP are 100% full?
The answer

System starting oom_kill_process who kills heavy processes to freeing RAM for normal work.

What is use of hosts.allow file?
The answer

It defines which service can be accessed from where and how (if ALL: ALL is set in hosts.deny).
(here I mashup this with file /etc/hosts so I gave some answer that have absolutely nothing with this file hosts.allow).