Top Linux Interview Questions

So you want to ace that interview for a Linux position in a company and want to know what would be the interview questions you really need to know?

Let’s get into it. We’ll start with a few harder ones and ease you into the easy ones 😉

How do you check for free disk space?

df -ah

01

df is your friend. In an interview you will be expected to talk a little about how these files are taking up space in the file system and what they are for, so do some extra research into those.

How can you see the kernel version of the machine?

uname -a

2

You can also use the -v flag for just the version or -r for the release.

How do you start a service on a Linux System?

You will need to use the service command followed by the service you want to start, for instance, to start up Apache2 server.

service apache2 start

3

You can also use status to see the status of the service or stop to kill the process.

How do you check the IP of a Linux system?

ifconfig

4

You can get a lot more details if you specify the interface you want, for instance if you wanted to only see interface eth0.

ifconfig eth0

How do you check for open ports on Linux?

netstat

5

You can refine the search to only display UDP connections.

netstat -tulpn

What command would you use to print the working directory?

This one comes up a lot to try to catch you out, but the answer is in the question.

[P]rint  [W]orking  [D]irectory.

pwd

6

Let’s say you have an Apache web server running on Linux, where would you find the server’s index.html file?

Easy, but good to know.

cd /var/www/html

7

How, as a root user, do you give full permissions to a file to read, write and execute.

Let’s create a file called hello.py for this example.

sudo nano hello.py

print("hello world!")

cat hello.py

11

So we have the file called hello.py that we just created.9

We can see it in white. This means it has not been given permissions to all users. So let’s change that.

sudo chmod 777 hello.py

10

Now we can see the file is green and ready to execute. You could also give it the same permissions using the following command.

sudo chmod -x hello.py

How do you see all of the running processes on Linux?

Most people will use ps.

12

But if you are a real Linux pro the following command is what will set you apart from other candidates. And it’s an easy one.

top

13

I really hope this helps you in that all important interview and that you nail it.

Please leave a like or a comment and of course follow the blog for more great posts.

Thanks for reading.

We do this for free so please consider contributing to us below. It really helps.

 

QuBits 2020-07-10

 

Leave a comment

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