Saturday, 22 March 2014

Linux System Admin Interview Questions and Answers Part 2

Q-1: - What is the difference between hardware RAID and Software RAID?
Ans: - The hardware-based RAID is independent from the host. A Hardware RAID device connects to the SCSI controller and presents the RAID arrays as a single SCSI drive. An external RAID system moves all RAID handling "intelligence" into a controller located in the external disk subsystem. The whole subsystem is connected to the host via a normal SCSI controller and appears to the host as a single disk.
Software RAID is implemented under OS Kernel level. The Linux kernel contains an MD driver that allows the RAID solution to be completely hardware independent. The performance of a software-based array depends on the server CPU performance and load.
Q-2: - What are the commonly used RAID types?
Ans: - 
RAID 0
RAID 1
RAID 5
Q-3: - Explain RAID 0?
Ans: - RAID level 0 works on “striping” technique. In RAID 0 the array is broken down into strips and data is written into strips. RAID 0 allows high I/O performance but provides no redundancy. RAID 0 Array Size is equal to sum of disks in array. If one drive fails then all data in the array is lost.
Q-4: - Explain RAID 1?
Ans: - RAID Level 1 is based on Mirroring technique. Level 1 provides redundancy by writing identical data to each member disk of the array. The storage capacity of the level 1 array is equal to the capacity of one of the mirrored hard disks in a Hardware RAID or one of the mirrored partitions in a Software RAID. RAID 1 provides redundancy means good protection against disk failure. In RAID 1 write speed is slow but read speed is good.
Q-5: - Explain RAID 5?
Ans: - RAID Level 5 is based on rotating parity with striping technique. RAID-5 stores parity information but not redundant data (but parity information can be used to reconstruct data). The storage capacity of Software RAID level 5 is equal to the capacity of the member partitions, minus the size of one of the partitions if they are of equal size. The performance of RAID 5 is based on parity calculation process but with modern CPUs that usually is not a very big problem. In RAID 5 read and write speeds are good.
Q-6: - Which kernel module is required for Software RAID?
Ans: - “md” module
Q-7: - which utility or command is used for creating software RAID’s for RHEL5?
Ans: - mdadm
Q-8: - Can we create software RAID during Linux installation?
Yes, we can create Software RAID during Linux Installation by “Disk Druid”
Q-9: - What is the role of chunk size for software RAID?
Ans: - Chunk size is very important parameter on which RAID performance based.
We know stripes go across disk drives. But how big are the pieces of the stripe on each disk? The pieces a stripe is broken into are called chunks.To get good performance you must have a reasonable chunk size.
Q-10: - What is SWAP Space?

Ans: - 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.
Q-11: - What are the steps to create SWAP files or Partition?
Ans: - 

  • Create swap partition or file
  • Write special signature using “mkswap”
  • Activate swap space by “swapon –a” command
  • Add swap entry into /etc/fstab file
Q-12: - How you will create swap file of size 4 GB and explain swap file entry in /etc/fstab file?
Ans: - Use “dd” command to create swap file.
dd if=/dev/zero  of=/SWAPFILE  bs=1024  count=4
mkswap /SWAPFILE
swapon –a
Entry into /etc/fstab file.
/SWAPFILE   swap   swap   defaults   0   0
For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

Linux Shell Scripting Interview Questions and Answers

Q-1: - What is Shell's Responsibilities ?
Ans: - The shell is responsible for the execution of all programs that you request from your terminal. Each time you type in a line to the shell, the shell analyzes the line and then determines what to do.The line that is typed to the shell is known more formally as the command line. The shell scans this command line and determines the name of the program to be executed and what arguments to pass to the program.
Q-2: - What is "$#" Variable ?
Ans: - The $# Variable
Whenever you execute a shell program, the special shell variable $# gets set to the number of arguments that were typed on the command line. 
Q-3: - Explain "Exit Status" for a shell script ?
Ans: - Whenever any program completes execution under the Unix system, it returns an exit status back to the system. This status is a number that usually indicates whether the program successfully ran. By convention, an exit status of zero indicates that a program succeeded, and nonzero indicates that it failed. Failures can be caused by invalid arguments passed to the program, or by an error condition detected by the program. For example, the cp command returns a nonzero exit status if the copy fails for some reason (for example, if it can't create the destination file), or if the arguments aren't correctly specified (for example, wrong number of arguments, or more than two arguments and the last one isn't a directory). In the case of grep, an exit status of zero (success) is returned if it finds the specified pattern in at least one of the files; a nonzero value is returned if it can't find the pattern or if an error occurs (the arguments aren't correctly specified, or it can't open one of the files).
Q-4: - What is "Command Substitution" ?
Ans: - Command substitution is the process by which the shell runs a command and replaces the command substitution with the output of the executed command. That sounds like a mouthful, but it's pretty straightforward in practice.
Q-5: - What is " eval" command ?
Ans: - The eval command exists to supersede the normal command-line substitution and evaluation order, making it possible for a shell script to build up commands dynamically. This is a powerful facility, but it must be used carefully. Because the shell does so many different kinds of substitutions, it pays to understand the order in which the shell evaluates input lines. 
Q-6: - What is awk ?
Ans: - An awk invocation can define variables, supply the program, and name the input files.
Q-7: - What is "grep" program ?
Ans: - The grep program is the primary tool for extracting interesting lines of text from input datafiles. POSIX mandates a single version with different options to provide the behavior traditionally obtained from the three grep variants: grep, egrep, and fgrep.
Q-8: - Name a new feature introduced with PHP 5.
Ans: - PHP 5 introduces (among other things) SQLite support, improved XML support, and a significantly improved object model.
Q-9: - What are the two files used by the shell to initialize itself?
Ans: - /etc/profile
profile
Q-10: - What is Interactive mode?
Ans: - Interactive mode means that the shell expects to read input from you and execute the commands that you specify. This mode is called interactive because the shell is interacting with a user. This is usually the mode of the shell that most users are familiar with: you log in, execute some commands, and log out. When you log out using the exit command, the shell exits.
Q-11: - What is noninteractive mode?
Ans: - In this mode, the shell does not interact with you; instead it reads commands stored in a file and executes them. When it reaches the end of the file, the shell exits.
Q-12: -what is local variable?
Ans: - A local variable is a variable that is present within the current instance of the shell. It is not available to programs that are started by the shell. The variables that you looked at previously have all been local variables.
Q-13: - What is environment variable?
Ans: - An environment variable is a variable that is available to any child process of the shell. Some programs need environment variables in order to function correctly. Usually a shell script defines only those environment variables that are needed by the programs that it runs.
Q-14: - What is shell variable?
Ans: - A shell variable is a special variable that is set by the shell and is required by the shell in order to function correctly. Some of these variables are environment variables whereas others are local variables.
Q-15: - Explain the “Exit” command?
Ans: - Every program whether on UNIX or Linux should end at a certain point of time and successful completion of a program is denoted by the output 0. If the program gives an output other than 0 it defines that there has been some problem with the execution or termination of the problem. Whenever you are calling other function, exit command gets displayed.
Q-16: - How do you find out what’s your shell?
Ans: - echo $SHELL
Q-17: - How you will run a process in the background?
Ans: - ./ProcessName &
Q-18: - How do you write a while loop in shell?
Ans: - Use While Loop
Q-19: - How do you read keyboard input in shell scripts?
Ans: - Use read command
Q-20: - What is GUI Scripting?
Ans: - Graphical user interface provided the much needed thrust for controlling a computer and its applications. This form of language simplified repetitive actions. Support for different applications mostly depends upon the operating system. These interact with menus, buttons, etc.
Q-21: - Explain the term “loops”?
Ans: - Loops enable you to execute a series of commands multiple times. Two main types of loops are the while and for loops.
Q-22: - What is “Nested Loops”?
Ans: - When a loop is located inside the body of another loop it is said to be nested within another loop.
Q-23: - What is “Infinite Loops”?
Ans: - Loops that execute forever without terminating.
Q-24: - What is “File Descriptor”?
Ans: - An integer that is associated with a file. Enables you to read and write from a file using the integer instead of the file's name.
Q-25: - Explain “STDIN”?
Ans: - STDIN Standard Input. User input is read from STDIN. The file descriptor for STDIN is 0.
Q-26: - Explain “STDOUT”?
Ans: - STDOUT Standard Output. The output of scripts is usually to STDOUT. The file descriptor for STDOUT is 1.
Q-27: - Explain “STDERR”?
Ans: - STDERR Standard Error. A special type of output used for error messages. The file descriptor for STDERR is 2.
Q-28: - Explain “Escape Sequence”?
Ans: - An escape sequence is special sequence of characters that represents another
character.
Q-29: - Explain “Output Redirection” in shell scripting?
Ans: - In UNIX or Linux, the process of capturing the output of a command and storing it in a file is called output redirection because it redirects the output of a command into a file instead of the screen.
Q-30: - Explain “Input Redirection” in shell scripting?
Ans: - In UNIX or Linux the process of sending input to a command from a file is called input redirection.
Q-31: - What is “Field separator”?
Ans: - The field separator controls the manner in which an input line is broken into fields. In the shell, the field separator is stored in the variable IFS. In awk, the field separator is stored in the awk variable FS.
Q-32: - What is “Library”?
Ans: - A file that contains only functions is called a library. Usually libraries contain no main code.
For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

Linux System Admin Interview Questions and Answers



   Q-1: - How are devices represented in UNIX?

   Ans: - All devices are represented by files called special files that are located in /dev directory.

   Q-2: - What is inode?

   Ans: - All UNIX files have its description stored in a structure called 'inode'. The inode contains          info about the file-size, its location, time of last access, time of last modification,
 permission and so    on. 
Q-3: - What are the process states in Unix?
Ans: - As a process executes it changes state according to its circumstances. Unix processes have the following states:
Running : The process is either running or it is ready to run .Waiting : The process is waiting for an event or for a resource.Stopped : The process has been stopped, usually by receiving a signal. Zombie : The process is dead but have not been removed from the process table.
Q-4: - What command should you use to check the number of files and disk space used and each user's defined quotas?
Ans: - repquota 
Q-5: - What command is used to remove the password assigned to a group?
Ans: - gpasswd -r
Q-6: - What can you type at a command line to determine which shell you are using?
Ans: - echo $SHELL
Q-7: -  Write a command to find all of the files which have been accessed within the last 30 days.Ans: - find / -type f -atime -30 > filename.txt
Q-8: - What is a zombie?
Ans: - Zombie is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table.
Q-9: - What daemon is responsible for tracking events on your system?
Ans: - syslogd 
Q-10: -  What do you mean a File System?
Ans: - File System is a method to store and organize files and directories on disk. A file system can have different formats called file system types. These formats determine how the information is stored as files and directories.
Q-11: -  Tell me the name of directory structure hierarchy for Linux
Ans: -
/root
/boot
/bin
/sbin
/proc
/mnt
/usr
/var
/lib
/etc
/dev
/opt
/srv
/tmp
/media  
Q-12: - What does /boot directory contains?
Ans: - The /boot/ directory contains static files required to boot the system, such as the Linux kernel, boot loader configuration files. These files are essential for the system to boot properly. 
Q-13: - If some one deletes /boot directory from your server, than what will happen?
Ans: - In that case your server will be in unbootable state. Your Server can’t boot without /boot directory because this directory contains all bootable files 
Q-14: - What does /dev directory contain?
Ans: - The /dev directory contains all device files that are attached to system or virtual device files that are provided by the kernel.
Q-15: -  What is the role of udev daemon?Ans: - The udev demon used to create and remove all these device nodes or files in /dev/ directory. 
Q-16: - Tell me the name of device file for PS/2 mouse connection.
Ans: - /dev/psaux
Q-17: - Tell me the name of device file for parallel port (Printers).
Ans: - /dev/lp0 
Q-18: - What does /etc/X11/ directory contains?

Ans: - The /etc/X11/ directory is for X Window System configuration files, such as xorg.conf.
Q-19: - What does /etc/skell directory contains?

Ans: - The /etc/skel directory contains files and directories that are automatically copied over to a new user's home directory when such user is created by the useradd or adduser command.
Q-20: - Tell me name of Linux File systems?
Ans: - Ext2, Ext3, Ext4.
For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

Thursday, 20 March 2014

Install Canon Printer Driver for Ubuntu Linux 13.10, 13.04, 12.10, 12.04 Step by Step

In my this blog post i am showing how to install Canon Printer Driver for Ubuntu 13.10 Saucy, 13.04 Raring, 12.10 Quantal and 12.04 Precise.

There is now a PPA repository which contains official drivers of Canon printers and multifunction devices, included versions 2.20 and newer (2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8).


To get started, we need to add the PPA repository first by running following 2 commands in terminal (Press Ctrl+Alt+T to open it):


#sudo add-apt-repository ppa:michael-gruz/canon-stable


#sudo apt-get update


After that, find out the package name of your Canon printer in the list below. Then install the package using Synaptic Package Manager (install it in Ubuntu Software Center):


















Or, Install the package via apt-get command by terminal:


#sudo apt-get install PACKAGE-NAME-HERE


Here’s the list of Canon Printers and package names of the Ubuntu Drivers:

  1. Canon iP100 series: cnijfilter-ip100series
  2. Canon iP1800, iP1880, iP1890: cnijfilter-ip1800series
  3. Canon BJ F9000 series: cnijfilter-bjf9000series
  4. Canon BJ F900 series: cnijfilter-bjf900series
  5. Canon BJ S300 series: cnijfilter-bjs300series
  6. Canon BJ S500 series: cnijfilter-bjs500series
  7. Canon BJ S700 series: cnijfilter-bjs700series
  8. Canon PIXMA E500 series: cnijfilter-e500series
  9. Canon PIXMA E510 series: cnijfilter-e510series
  10. Install Canon PIXMA E600 series: cnijfilter-e600series
  11. Canon PIXMA E610 series: cnijfilter-e610series
  12. Canon i250 series: cnijfilter-i250series
  13. Canon i255 series: cnijfilter-i255series
  14. Canon i550 series: cnijfilter-i550series
  15. Canon i560 series: cnijfilter-i560series
  16. Canon i850 series: cnijfilter-i850series
  17. Canon i860 series: cnijfilter-i860series
  18. Canon i950 series: cnijfilter-i950series
  19. Canon i990 series: cnijfilter-i990series
  20. Canon iP1900 series: cnijfilter-ip1900series
  21. Canon iP2200 series: cnijfilter-ip2200series
  22. Canon iP2500 series: cnijfilter-ip2500series
  23. Canon iP2600 series: cnijfilter-ip2600series
  24. Canon iP2700 series: cnijfilter-ip2700series
  25. Canon iP3000 series: cnijfilter-ip3000series
  26. Canon iP3300 series: cnijfilter-ip3300series
  27. Canon iP3500 series: cnijfilter-ip3500series
  28. Canon iP3600 series: cnijfilter-ip3600series
  29. Canon iP4000 series: cnijfilter-ip4000series
  30. Canon iP4200 series: cnijfilter-ip4200series
  31. Canon iP4300 series: cnijfilter-ip4300series
  32. Canon iP4500 series: cnijfilter-ip4500series
  33. Canon iP4600 series: cnijfilter-ip4600series
  34. Canon iP4700 series: cnijfilter-ip4700series
  35. Canon iP4800 series: cnijfilter-ip4800series
  36. Canon iP4900 series: cnijfilter-ip4900series
  37. Canon iP5000 series: cnijfilter-ip5000series
  38. Canon iP5200 series: cnijfilter-ip5200rseries
  39. Canon iP6600 series: cnijfilter-ip6600dseries
  40. Canon iP7200 series: cnijfilter-ip7200series
  41. Canon iP7500 series: cnijfilter-ip7500series
  42. Canon iP8500 series: cnijfilter-ip8500series
  43. Canon iP90 series: cnijfilter-ip90series
  44. Canon iX6500 series: cnijfilter-ix6500series
  45. Canon MG2100 series: cnijfilter-mg2100series
  46. Canon MG2200 series: cnijfilter-mg2200series
  47. Canon MG3100 series: cnijfilter-mg3100series
  48. Canon MG3200 series: cnijfilter-mg3200series
  49. Canon MG4100 series: cnijfilter-mg4100series
  50. Canon MG4200 series: cnijfilter-mg4200series
  51. Canon MG5100 series: cnijfilter-mg5100series
  52. Canon MG5200 series: cnijfilter-mg5200series
  53. Canon MG5300 series: cnijfilter-mg5300series
  54. Canon MG5400 series: cnijfilter-mg5400series
  55. Canon MG6100 series: cnijfilter-mg6100series
  56. Canon MG6200 series: cnijfilter-mg6200series
  57. Canon MG6300 series: cnijfilter-mg6300series
  58. Canon MG8100 series: cnijfilter-mg8100series
  59. Canon MG8200 series: cnijfilter-mg8200series
  60. Canon MP140 series: cnijfilter-mp140series
  61. Canon MP160 series: cnijfilter-mp160series
  62. MP190, MP210, MP230, MP240, MP250, MP270, MP280, MP490, MP495, MP500, MP510, MP520, MP540, MP550, MP560, MP600, MP610, MP620, MP630, MP640, MP750, MP780: cnijfilter-mp***series (you know, relpace *** with the numbers)
  63. MX320, MX330, MX340, MX350, MX360, MX370, MX390, MX410, MX410, MX430, MX450, MX510, MX520, MX710, MX720, MX860, MX870, MX880, MX890, MX920: cnijfilter-mx***series
  64. Canon PIXMA IP1000, PIXMA IP1500: cnijfilter-pixmaip1000series cnijfilter-pixmaip1500series
  65. Canon Pixus250i, Pixus255i, Pixus550i, Pixus560i, Pixus850i, Pixus860i, Pixus950i, Pixus990i, Pixus ip3100, Pixus ip4100, Pixus ip8600: cnijfilter-pixus***series
  66. After the driver is installed, connect your Canon printer to computer and turn it on. Your printer will automatically be detected by the system.
For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

Tuesday, 18 March 2014

Installing LAMP Server in Ubuntu Linux 13.10

In my this blog post here's the quickest way to get LAMP Server (Apache, MySQL and PHP) in Ubuntu Linux 13.10.
To start installation process press Ctrl + Alt + T on your keyboard to open the terminal. When it's open, run the following command to install them with a single command:

#sudo apt-get install lamp-server






To verify Apache service, just type localhost in your web browser:














To verify PHP run the commands below to create a test page in the root directory on the web-server:


#sudo gedit /var/www/test.php


and add the below line into the file and save it.


<?php phpinfo();?>
























Now to verify PHP type the below link into your web browser:

http://localhost/test.php

























Finally, to verify MySQL run the below command .

You have to must type the password which is you have created for MySQL during the installation:

#mysql -u root -p


#mysql>


For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

Thursday, 13 March 2014

Disable Guest Account from Ubuntu Linux 13.10 Login Screen


If you have not noticed, at the login screen of Ubuntu, anyone can select the “Guest Session” and login to your computer without password. Of course, the guest won’t be able to access your files and folders. What they will see is the default Ubuntu desktop and they won’t be able to store any file permanently as all saved files are deleted on reboot

In my this post i am going to show beginners how to disable the Guest session from Ubuntu 13.10 Saucy LightDM Login Screen.


Guest Session comes default in Ubuntu Unity, which anyone can log into from the login screen without password. You can easily remove it by the steps below:



Step-1: Press Ctrl+Alt+T on your keyboard to open terminal. When it opens, copy and paste below command and press enter:

#sudo gedit /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf


Step-2: It opens the config file. now we need to do is add below line into the file and click save:


allow-guest=false


#sudo restart lightdm


Alternatively, we can restart the system.

For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

Upgrade to Ubunut Linux 13.04 to Ubuntu Linux 13.10 using terminal or console step by step

The Ubuntu team was released Ubuntu 13.10 for Desktop, Server, Cloud, Phone, and Core products on 17th Oct 2013. In my this post i am explaining how to upgrade from Ubuntu Linux 13.04 (Raring) to Ubuntu Linux 13.10 (Saucy)

Before upgrading the version, it is recommended for you to update the system. Open your terminal and run this command:

Step-1:
We need to update the system first. Open the terminal (CTRL + ALT + T) and insert this command below:

# sudo apt-get update && sudo apt-get dist-upgrade

Step-2: Update Manager
When system has been updated, press ALT + F2 to open the command box. Then type update-manager -d.
click on update-manager -d to run it when it appears in the dash.

#sudo update-manger -d

Step-3: Upgrade
Once it has finished checking the sources for available updates, you should see the following message:
                         The software on this computer is up to date.
                         However Ubuntu 13.10 is now available (you have Ubuntu 13.04).

Click on the Upgrade button and follow the instructions afterwards.

For any query please feel free to contact me my email id is sashwatkatore@gmail.com.

Screenshot tour of Ubuntu Linux 13.10 Saucy Salamander

Here is the screenshot tour for the Ubuntu 13.10 Saucy Salamander Ubunut Linux 13.10 comes with great look and some improved design.
You can upgrade or download and enjoy Ubuntu 13.10.












For any query please feel free to contact me my email id is sashwatkatore@gmail.com.