Published March 18, 2018 by

Linux Interview Question

Linux Interview Question

What is Linux?
Linux is a family of free and open-source software operating systems built around the Linux kernel. Typically, Linux is packaged in a form known as a Linux distribution for both desktop and server use.

Different between Linux and Unix?

Linux is an open source, free to use operating system widely used for computer hardware and software, game development, tablet PCS, mainframes etc. 

Unix is an operating system commonly used in internet servers, workstations and PCs by Solaris, Intel, HP etc.

What is the importance of GNU project?

In the GNU Manifesto, Stallman listed four freedoms essential to software users: freedom to run a program for any purpose, freedom to study the mechanics of the program and modify it, freedom to redistribute copies, and freedom to improve and change modified versions for public use.

What is Linux Kernel?

A kernel is the lowest level of easily replaceable software that interfaces with the hardware in your computer. It is responsible for interfacing all of your applications that are running in “user mode” down to the physical hardware, and allowing processes, known as servers, to get information from each other using inter-process communication (IPC).

What is Shell?

The shell is a program that takes commands from the keyboard and gives them to the operating system to perform. In the old days, it was the only user interface available on a Unix-like system such as Linux. Nowadays, we have graphical user interfaces (GUIs) in addition to command line interfaces (CLI) such as the shell.

What is BASH?

Bash is a command processor that typically runs in a text window, where the user types command that cause actions. Bash can also read and execute commands from a file, called a shell script.

What are Daemons?

A daemon is a type of program on Unix-like operating systems that runs unobtrusively in the background, rather than under the direct control of a user, waiting to be activated by the occurrence of a specific event or condition.

What is LILO?

LILO is a boot loader for Linux and was the default boot loader for most Linux distributions in the years after the popularity of load Linux.

What are the advantages of Linux?

  • Open Source
  • Free to Use
  • Secure
  • Perfect for Programmer
  • Customization
  • Variety of Distributions
  • Reliability
  • Privacy
What are the Basic components of Linux?
  • Kernel
  • System Library
  • System Utilities
How to check Memory Stats and CPU stats?
$ free                  // for memory check 
$ vmstat             // for memory check
$ sar                   // for CPU check

How to reduce or shrink the size of LVM partition?

https://www.tecmint.com/extend-and-reduce-lvms-in-linux/

Explain the functionality of root user?

  • Superuser
  • Unlimited access to files/folder
  • Default account
What is CLI?
A command-line interface (CLI) is a type of human-computer interface (i.e., a way for humans to interact with computers) that relies solely on textual input and output. That is, the entire display screen, or the currently active portion of it, shows only characters (and no images), and input is usually performed entirely with a keyboard.

What is GUI?

A graphical user interface (GUI) is a human-computer interface (i.e., a way for humans to interact with computers) that uses windows, icons, and menus and which can be manipulated by a mouse (and often to a limited extent by a keyboard as well). 

How can you find out how much memory Linux is Using?
$ free -g 
$ free -m
$ car /proc/meminfo

What is swap space?

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

What is the typical size for a Swap partition under Linux system?

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB.

How do you access partitions under Linux?

$ fdisk -l

How are hard drives and floppy drives referred in Linux file system?

Floppy drive can be acees by using: /dev/fd0 and /dev/fd1

Hard drive can be accessed by using: /dev/hda, /dev/hdb, /dev/hdc, and so forth.  

How are names assigned to the different serial ports?

Serial ports are identified as /dev/ttyS0 to /dev/ttyS7

How are parallel ports referenced in Linux?

https://www.vmware.com/support/ws5/doc/ws_devices_parallel_configure_linux.html

What is the kind of permissions available in Linux?
  • Read
  • Write
  • Execute
How do you change permissions under Linux?
$ chmod
$ chown
$ chgrp
https://www.youtube.com/watch?v=zR_Ibd-ZOzo

What are symbolic links?
A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file. It simply points to another entry somewhere in the file system.

What are the qualities of a soft link?

  • Soft link files have different inode numbers than the source file
  • The soft link file will be of no use if the original file is deleted. 
  • Soft links are not updated
  • They can create links between directories
  • They can cross file system boundaries
What is a hard link?
A hard link is merely an additional name for an existing file on Linux or other Unix-like operating systems. Any number of hard links, and thus any number of names, can be created for any file. Hard links can also be created to other hard links.

What is the maximum length of a filename under Linux?

255 characters

Which type of files are prefixed with a dot(.)?

hidden file

What does a nameless (empty) directory represent?

This empty directory name serves as the nameless base of the Linux file system. This serves as an attachment for all other directories, files, drives, and devices.

How can you create folders and files using terminal?

$ mkdir
$ cat
$ vi
$ vim
$ gedit
$ kate/kwrite
$ pico
$ nano      

What is the functionality of 'Tab' key in CLI?

When at the MS-DOS, Windows command line, or a Linux or Unix shell typing in long file names or directories can become a burden. Use the tab key to auto-complete the names of directories and files while in the command line.

What is Redirection in Linux?
Redirection is the switching of a standard stream of data so that it comes from a source other than its default source or so that it goes to some destination other than its default destination.

What is GREP command?
Grep command in Unix/Linux is a powerful tool that searches for matching a regular expression against text in a file, multiple files or a stream of input. It searches for the pattern of text that you specify on the command line and prints output for you.

How to terminate an ongoing process in Linux?
Every process in the system is identified by a unique process id or pid. Use the kill command followed by the pid in order to terminate that process. To terminate all process at once.
For example, $ kill 0

How to insert comments in command prompt?
use # sign before the comment text.
For example,
# This is a comment. 

How to insert several commands in a single command line entry?
Use semicolon(;) between two commands
For example,
$ mkdri1; cd dir1; touch subhash.txt 

Write a command that will display all the '.txt' files, along with its permissions.
$ ls -a -l *.txt

Write a command that will look for files with "txt" extension, and has the occurrence of the string "serverkaka" in it.
$ find / -name *.txt | xargs grep -i serverkaka

How to login as a root in Linux from the terminal?
$ sudo su -
$ su -

How you can run a Linux program in the background simultaneously when you start your Linux server?

$ nohup 

Which daemon tracks events on your system?

syslogd

Which command is used to set a processor-intensive job to execute in less CPU time?
$ nice 

What is a partial backup?
A partial backup is similar to a full database backup, but it does not contain all the filegroups. It contains all the data in the primary filegroup, every read/write filegroup and any optionally-specified read-only files. A partial backup is an operating system backup short of a full backup, taken while the database is open or shut down.

What is an Inode?
http://www.linux-mag.com/id/8658/

What are shadow passwords? And how are they enabled?
https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-users-groups-shadow-utilities.html