Linux Interview Questions & Material

1) What is Linux and why is it so popular?

Ans : Linux is an operating system based on UNIX, and was first introduced by Linus Torvalds commonly used in servers. It is based on the Linux Kernel, and can run on different hardware platforms manufactured by Intel, MIPS, HP, IBM, SPARC and Motorola. Another popular element in Linux is its mascot, a penguin figure named Tux.Popularity of Linux is because of the following reasons

• It is free and open source. We can download Linux for free and customize it as per our needs. 

• It is very robust and adaptable. 

• Immense amount of libraries and utilities

2) What is BASH?

Ans : BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It combines all the features from the original version of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux.

3) What is the core of Linux Operating System?

Ans : The core of the Linux operating system is Kernel. It is broken down into Shell, Command, Script, and Terminal. Shell is a command Line Interpreter, Command is user Instruction to Computer, Script is collection of commands stored in a file, and Terminal is a command Line Interface.

4) What is the basic difference between UNIX and Linux Operating System?

Ans : Linux is free and open-source software (allowing programmers to program with Linux not around it), the kernel of which is created by Linus Torvalds and community. UNIX, on the other hand, is UNIX is copyrighted name only big companies are allowed to use the UNIX copyright and name, so IBM AIX and Sun Solaris and HP-UX all are UNIX operating systems.

5) What is LILO?

Ans : LILO is a boot loader for Linux. It is used mainly to load the Linux operating system into main memory so that it can begin its operations.

6) What is an INODE?

Ans : All files have its description stored in a structure called „inode‟. The inode contains info about the file-size, access and modification time, permission and so on. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file.

7) What is a swap space?

Ans : A swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing.

8) What is the advantage of open source?

Ans : Open source allows you to distribute your software, including source codes freely to anyone who is interested. People would then be able to add features and even debug and correct errors that are in the source code. They can even make it run better, and then redistribute these enhanced source code freely again. This eventually benefits everyone in the community.

9) What is the basic difference between BASH and DOS?

Ans : The key differences between the BASH and DOS console lies in 3 areas:
  •  BASH commands are case sensitive while DOS commands are not; 
  •  under BASH, / character is a directory separator and \ acts as an escape character. Under DOS, / serves as a command argument  delimiter and \ is the directory separator 
  •  DOS follows a convention in naming files, which is 8 character file name followed by a dot and 3 character for the extension. BASH  follows no such convention. 

10) What is the difference between TCP and UDP?

Ans : The basic difference is that TCP establishes a connection before sending data and this allows it to control the dataflow and guarantee that all packets get delivered. UDP simply chucks datagrams onto the wire and if some get lost or arrive in bad order there‟s no way to request a resend. However UDP has low network overhead so some services such as DNS resolution, SNMP, DHCP, RIP and VOIP use UDP for its speed and any errors are usually dealt with on the application layer rather than network layer.

11) What is the importance of the GNU project?

Ans : This so-called Free software movement allows several advantages, such as the freedom to run programs for any purpose and freedom to study and modify a program to your needs. It also allows you to redistribute copies of a software to other people, as well as freedom to improve software and have it released to the public.

12) How does DNS resolution work?

Ans : A client application requests an IP address from the name server usually by connecting to UDP port 53. The name server will attempt to resolve the FQDN based on its resolver library, which may contain authoritative information about the host requested or cached data about that name from an earlier query. If the name server does not already have the answer, it will turn to root name servers to determine the authoritative for the FQDN in question. Then, with that information, it will query the authoritative name servers for that name to determine the IP address.

13) Describe the root account?

Ans : The root account is like a systems administrator account, and allows you full control of the system. Here you can create and maintain user accounts, assigning different permissions for each account. It is the default account every time you install Linux.

14) What is CLI?

Ans : CLI is short for Command Line Interface. This interface allows user to type declarative commands to instruct the computer to perform operations. CLI offers an advantage in that there is greater flexibility. However, other users who are already accustom with using GUI find it difficult to remember commands including attributes that come with it.

15) What is GUI?

Ans : GUI, or Graphical User Interface, makes use of images and icons that users click and manipulate as a way of communicating with the computer. Instead of having to remember and type commands, the use of graphical elements makes it easier to interact with the system, as well as adding more attraction through images, icons and colors.

16) How can you find out how much memory Linux is using?

Ans : From a command shell, use the “concatenate” command: cat /proc/meminfo for memory usage information. You should see a line starting something like: Mem: 64655360, etc. This is the total memory Linux thinks it has available to use.

17) What is an MX record?

Ans: An MX record numerically ranks the mail servers you would prefer to receive email for a domain. The MX record with the lowest number is pref erred over the others, but you can set multiple email servers with the same value for simple load balancing.

18) Please describe the Linux boot-up sequence?

Ans : There are seven steps to the boot-up sequence. 
1) BIOS (basic input/output system) – executes the MBR where Boot Loader sits,
2) MBR- Master boot reads Kernel into memory, 
3) GRUB (Grand Unified Bootloader) Kernel starts Init process, 
4) Kernel – Kernel executes the /sbin/init program. Init reads inittab, executes rc.sysinit, 
5) Init – the rc script than starts services to reach the default run level and 
6) Run level programs – these programs are executed from /etc/rc.d/rc*.dl/

19) What is typical size for a swap partition under a Linux system?

Ans : The preferred size for a swap partition is twice the amount of physical memory available on the system. If this is not possible, then the minimum size should be the same as the amount of memory installed.

20) How do you search for a pattern and then replace it in an entire file?

Ans : You use Sed, or in Vi editor, the search uses character „s‟ slash the pattern to be searched, slash the pattern to replace it with, slash „g‟ which stands for entire file.

21) Does the Ctrl+Alt+Del key combination work on Linux?

Ans : Yes, it does. Just like Windows, you can use this key combination to perform a system restart. One difference is that you won‟t be getting any confirmation message and therefore, reboot is immediate.

22) How do you list and flush all Iptables?

Ans : First you use the –L switch to view all the currently present rules and then –F to flush them.

23) How do you change permissions under Linux?

Ans : Assuming you are the system administrator or the owner of a file or directory, you can grant permission using the chmod command. Use + symbol to add permission or – symbol to deny permission, along with any of the following letters: u (user), g (group), o (others), a (all), r (read), w (write) and x (execute). For example the command chmod go+rw FILE1.TXT grants read and write access to the file FILE1.TXT, which is assigned to groups and others.

24) What is a shell? What are their names?

Ans : The shell is the part of the system with which the user interacts. A Unix shell interprets commands such as “pwd”, “cd” or “traceroute” and sends the proper instructions to the actual operating system itself. The shells currently available areAns SH, BASH, CSH, TCSH, NOLOGIN, KSH. Other functions of a shell include scripting capability, path memory, multitasking, and file handling.

25) In Linux, what names are assigned to the different serial ports?

Ans : Serial ports are identified as /dev/ttyS0 to /dev/ttyS7. These are the equivalent names of COM1 to COM8 in Windows.

26) What is a zombie?

Ans : Cheeky answers get bonus points for this one. But in the Linux world, a zombie process is the process output of „ps‟ by the presence of „Z‟ in the STAT column. Zombies are essentially the premature processes whose mature parent processes died without reaping its children. Note that zombies can’t be killed with the usual „kill‟ signal.

27) How do you access partitions under Linux?

Ans : Linux assigns numbers at the end of the drive identifier. For example, if the first IDE hard drive had three primary partitions, they would be named/numbered, /dev/hda1, /dev/hda2 and /dev/hda3.

28) You need to define a macro, a key binding for the existing command. How would you do it?

Ans : There is a command called bind, in bash shell which is capable of defining macro, or binding a key. In order to bind a key with an existing command, we need to generate Character Sequence emitted by the key. Press Ctrl+v and then key F12, I got ^[[24~

29) Your assistant needs to print directory stack, what would you suggest?

Ans : The Linux command 'dirs', will print the directory stack.

For Example: [root@localhost ~]# dirs/usr/share/X11

30) What is the maximum length for a filename under Linux?

Ans : Any filename can have a maximum of 255 characters. This limit does not include the path name, so therefore the entire pathname and filename could well exceed 255 characters.
SelectionFile type iconFile nameDescriptionSizeRevisionTimeUser
Ċ
View Download
  1849k v. 1 Sep 9, 2015, 11:57 AM Pavan Reddy
Ċ
View Download
  317k v. 1 Sep 9, 2015, 11:57 AM Pavan Reddy
Ċ
View Download
  293k v. 1 Sep 9, 2015, 11:57 AM Pavan Reddy
Ċ
View Download
  467k v. 1 Sep 9, 2015, 11:57 AM Pavan Reddy
Ċ
View Download
  319k v. 1 Sep 9, 2015, 11:57 AM Pavan Reddy
Ċ
View Download
  373k v. 1 Sep 9, 2015, 11:58 AM Pavan Reddy
Ċ
View Download
  573k v. 1 Sep 9, 2015, 11:58 AM Pavan Reddy
Ċ
View Download
  475k v. 1 Sep 9, 2015, 11:58 AM Pavan Reddy
Ċ
View Download
  385k v. 1 Sep 9, 2015, 11:58 AM Pavan Reddy
Ċ
View Download
  323k v. 1 Sep 9, 2015, 11:58 AM Pavan Reddy
Ċ
View Download
  601k v. 1 Sep 9, 2015, 11:58 AM Pavan Reddy
Ċ
View Download
  524k v. 1 Sep 9, 2015, 11:59 AM Pavan Reddy
Comments