fbpx
Select Page

Linux Interview Questions And Answers

1: Which command is used to check how many ports are currently being used (listening) on the local machine, and which application is listening on each port?

Answer: To check the listening ports and applications, you can use the netstat command:

netstat -tupln

2:  How can you login to your system in order to change it when you’ve forgotten the root password,?

Answer: For RHEL6 and previous OS’s, Reboot the machine and start the Linux in a single-mode, change the password, and log in with the new password.

3: How can you customize the configuration of the Linux DNS search to first look for DNS and only then in the host’s files?

Answer: Customize hosts parameter in /etc/nsswitch.conf from “files dns” to “dns files”.

4: Which command is used to find, who was logged in to the system, the dates, and the amount of time they were logged in?

Answer: You can use the “last” command in order to find the last users logged in to your system.

For Free Demo classes Call:7798058777
Registration Link: Click Here!

5: Which command is used to find out which process is using the port 80 on your Linux?

Answer: Fuser 80/tcp –v

6: Where can you find the following configuration:

“­min ALL=(ALL) ALL”

Answer: Sudoers configuration in /etc/sudoers file.

7: What is the major difference between ext2 and ext3 file systems?

Answer: The ext3 contains journaling, unlike the ext2.

8: Which service is used to manipulate incoming and outgoing packets in Linux?

Answer: “iptables” service is used to manipulate incoming and outgoing packets in Linux.

9: On a Linux server, your root UMASK value is 022 – what does it mean?

Answer: UMASK is the new file creation permissions mask, and 022 means a new file will be created as 644 permissions and a directory with 755 permissions.

10: Which command is used to find information about your Linux server CPU?

Answer: On a Linux system, your server CPU information is kept on /proc/, You can find the CPU information in /proc/cpuinfo.

11: Which command is used to trace (attach to) a process and trace its system calls and signals (file/memory access)?

Answer: You can use strace command – i.e.

strace -p <process_number>

For Free Demo classes Call:7798058777
Registration Link: Click Here!

12: Which command is used to dump the server boot messages into a local log file myboot.log”?

Answer: For the boot messages you need to use the dmesg command and redirect it to myboot.log

dmesg > myboot.log.

13: Someone is trying to hack your system “valid and invalid users” 

Write a command that will show you failed ssh logins to the system and its date & ip as “Jul 8 12:00:00 username 192.168.10.10”

Answer: Failed logins are stored in the secure log file. Use the following command.

cat /var/log/secure | grep “Failed password for” | sed ‘s/invalid user// g’ | awk ‘{ print $1,$2,$3,$9,$11; }’

14: How do you tell the named to reload the configuration with the DNS admin tool after you have updated your DNS server configuration?

Answer: You can use the DNS admin tool “rndc” to reload the configuration with – “rndc reload” command.

15: What is the use of the “crontab” and the “at” functionality?

Answer: The “at” command is used to schedule the task to run only one time and crontab (cron command) is used to schedule a task daily at the same time (or times) repeatedly.

16: How can you add a file system &#40;partition&#41; that will be mounted automatically when the Linux is booting?

Answer: You need to add the line in /etc/fstab to automatically mount a partition providing Label, mount point, FS Type and options/permissions.

17: You have decided to add 80.161.161.1 to your DNS servers (for DNS resolving), which file should be edited and what should be added to this file?

Answer: you need to add a new line “nameserver 80.161.161.1” at the end of the file. The /etc/resolv.conf holds your DNS servers list.

18: Which command is used to set the eth0 interface to auto-negotiation on?

Answer: You can use the ethtool command to configure the ethernet card:

ethtool –change eth0 autoneg on.

19: Which command is used to display your server routing table (IP view)?

Answer: Use the command “route –n” to get a display of your current routing table without resolving for faster results.

20: You want to run the heavy application with a low priority so it will not take all the resources from the system and run at the lowest priority, how can you do it while starting the application?

Answer: You can use the nice command, you can start an application with the desired nice level.

nice -n 19 heavy application.

For Free Demo classes Call:7798058777
Registration Link: Click Here!

21: How can you set the default graphical login using runlevel 5?

Answer: You need to edit the file /etc/inittab to set the default init runlevel and change the line starting with “id”

– “id:5:initdefault:”

22: What should you do when you have an application crashes, but there is no core file created?

Answer: To disable the creation of the core dump file, make sure that the ulimit -c is not set to 0.

23: The time is 1:00 PM, you have upgraded the kernel and need to reboot, but you won’t be here at night, how can you tell the system to shut down at 1 AM?

Answer: You can define time to the shutdown command: shutdown -r 01:00 will reboot at 1 AM

24: How do you check the SELinux status?

Answer: You can run the command status to get information about the SELinux.

25: What is the use of an exim service on a server?

Answer: The exim server that comes with the Linux installation is an SMTP service. It can replace the regular sendmail service.

26: Which reverse proxy servers are available in Linux?

Answer: The most common is the Squid and it is mostly recommended in Linux, but the two main solutions are Squid and Apache reverse proxy.

27: What is the use of a NIS server?

Answer: A NIS server which stands for Network Information Service. It provides the user with the possibility to log in to different systems with the same credentials as domain users.

28: What tool would you use if you want to benchmark your apache service that holds www.google.com using 5 concurrent requests over 20 overall requests?

Answer: You can use the ab (apache benchmarking) tool on localhost – ab Http://google.com -n 20 -c 5.

29: What is the meaning of each error codes 200, 300, 400 and 500 in the Apache webserver?

Answer: 2xx error codes are for successful requests, 3xx error codes are for redirection, 4xx error codes are for client error and 5xx error codes are for server error codes.

30: Create a new Apache VirtualHost configuration for the host www.google.com that sits at /home/google/public_html/ and default logs on /var/log/httpd/

Answer: <VirtualHost *:80>

DocumentRoot /home/google/public_html

ServerName www.google.com

ServerAlias google.com

CustomLog /var/log/httpd/google.com.log combined

ErrorLog /var/log/httpd/google.com.error.log

</VirtualHost>

For Free Demo classes Call:7798058777
Registration Link: Click Here!

31: Which control script is used to stop the Apache HTTPD service?

Answer: You can use “apachectl” control script for controlling apache. And you can use “apachectl stop” to stop the apache HTTPD service.  

32: What is the meaning of “apachectl restart” and “apachectl graceful”?

Answer: you can use “apachectl restart” to force Apache to stop all its processes and restart the service and you can use “apachectl graceful” to “advise” the httpd processes to restart only after they finish their current work.

33: How can you add the service sshd to start when starting at INIT runlevel 3?

Answer: You need to use the chkconfig command to change the runlevel parameters:

chkconfig –level 3 sshd on.

34: How can you save output of all the packets of http traffic into http.out?

Answer: You should use tcpdump to capture network traffic.

tcpdump tcp port 80 -s0 -w http.out.

35: How can you check a slow download from a remote server to check long download sessions?

Answer: In order to download a file and be able to cap your connection you can use the wget network limitation option:wget http://test.com/bigfile.zip –limit-rate=10k.

Author:
Sameer Maner | SevenMentor Pvt Ltd.

Call the Trainer and Book your free demo Class for now!!!

call icon

© Copyright 2020 | Sevenmentor Pvt Ltd.

 

Pin It on Pinterest

× How can I help you?