Top 10 Linux interview questions

In this post we are going to cover up top 10 Linux interview questions. These are the most common Linux system administration job interview questions that you’ll find out in the wild. There will also be more specific Linux interview questions. It depends upon the position you’re actually interviewing for. For any given position might also involve a lots of other tech too. While this covers the majority types of things that are asked during junior Linux sys admin interviews. You may also wants to know the similar types of questions for database, TCP/IP and network programming or specific programming language. There may also be infrastructure or architecture questions if you are applying for mid-level or senior level position. Likewise you may be asked about specific applications or services. Your interviewer only has couple of minutes to figure out if you worth more time investment. So regardless of what kind of job interview you’re preparing for if it involves Linux in some capacity you should be very comfortable with these basic things.

As a last piece of caution or advise do not just memorize these things because even if you make it through the interview they are gonna be pretty pissed if it turns out that you actually don’t understand what you’re doing after you make it through memorizing answers to these basic questions. Use these basic Linux interview questions as a jumping-off point for further exploration All right! enough talk. Let’s jump right in.

Here are the top 10 Linux interview questions

How can you see which kernel version a system is currently using?

Answer:- The answer is uname. uname prints out the system information. specifically with -a flag will give you all the system parameters. It will show you hostname, OS, kernel, release, kernel version.

#uname -a

How can you check system’s current IP address?

Answer:- This question can be asked in many other ways like, What is your IP for eth0 interface or what is your IPv6 address? So there’s generally two ways to know that. Old and the new way. The old way is: ifconfig interface. you can simply type ifconnfig to list network information for all the networking interfaces.

#ifconfig eth0

And the new way to do this is using IP command. you can type ip addr show and it will give you all the network specifications for all of your networking devices or you can add one more argument as device name in this command to show device specific information.

#ip addr show eth0

How do you check for free disk space?

Answere:- Other versions of this question are “How would you check how much disk space is left” or “What percentage of disk space are you using?” Don’t get tripped up by different ways of asking these. For this question the command df is your friend. To show all file systems in human readable form issue this command with –ah flags as shown below.

#df -ah

How do you manage services on a system?

Answer:- Managing services is a completely normal part of being a Linux sys-admin or working with Linux in general. Don’t be surprised if someone asks you how would you see if service is running or how would you start or stop a service or how would you reload a service. Most major Linux distributions have switched to systemd however in older system you would follow the structure given below.

#service servicename status
#service servicename start
#service servicename reload
#service servicenae stop

On a newer systemd system you would use systemctl  command.

#systemctl status servicename
#systemctl start servicename
#systemctl stop servicename
#systemctl restart servicename

How would you check the size of a directory’s contents on disk?

#du -sh /directory-name

This command will go ahead and telly up the disk usage for the given directory

How would you check for open ports on Linux machine?

Answer:- This question can be asked in couple of different ways such as “check network listing sockets” and “check for services that are listening on TCP/UDP ports or sockets”. So ff you hear the word “open ports” or “running services” start thinking about the command netstat. by default the netstat command will give you uselessly big output. It meant to be filtered down with other Linux or Unix tools.  Run the netstat command as show below with following arguments.

#netstat -tulpn

This command will filter the output. It will show you the local address that services are listening on along with the PID. Make sure to use this command with root privileges otherwise it won’t show the PID.

How would you check CPU usage for a given process?

#ps -aux | grep processname

We used pipe in this command if you are not familiar with this then we highly recommend to read some basic bash rules and properties. You can also use real-time resource monitor utility name top.

How would you mount new devices?

Answer:- Linux generally has directory called mnt in root file-system for mounting new storage devices but you can mount the new storage device wherever you like. we would use mount command in given structure.

#mount /dev/device-name /mountpoint

mount /dev/sda1 /mnt

Likewise checking for existing mounts you would just run the command mount with no arguments.

How do you look up something you don’t know?

Answer:- Finally the most important part. To look up some information on something you don’t know we would use the man  pages. using man pages is really easy. you just have to type “man <command name>” and this will show you the full manual of the command. You can quickly go through this and find your information.”

#man httpd
#man netstat
#man systemctl

If you are still confused about these simple Linux interview questions, You can also check out Linux Commands – cheat sheet to understand the basic of Linux system.


About the author

Ajay Verma

A Computer Science Graduate, who works extensively on open source projects. His Areas Of interest are: Network Security, Linux Administration, FOSS, Python, and C programming.

Add Comment

Click here to post a comment