Thursday, August 19, 2010

How Linux boots

As it turns out, there isn't much to the boot process:
1. A boot loader finds the kernel image on the disk, loads it into memory, and starts it.
2. The kernel initializes the devices and its drivers.
3. The kernel mounts the root filesystem.
4. The kernel starts a program called init.
5. init sets the rest of the processes in motion.
6. The last processes that init starts as part of the boot sequence allow you to log in.
Identifying each stage of the boot process is invaluable in fixing boot problems and understanding the system as a whole. To start, zero in on the boot loader, which is the initial screen or prompt you get after the computer does its power-on self-test, asking which operating system to run. After you make a choice, the boot loader runs the Linux kernel, handing control of the system to the kernel.
There is a detailed discussion of the kernel elsewhere in this book from which this article is excerpted. This article covers the kernel initialization stage, the stage when the kernel prints a bunch of messages about the hardware present on the system. The kernel starts init just after it displays a message proclaiming that the kernel has mounted the root filesystem:
VFS: Mounted root (ext2 filesystem) readonly.
Soon after, you will see a message about init starting, followed by system service startup messages, and finally you get a login prompt of some sort.
NOTE On Red Hat Linux, the init note is especially obvious, because it "welcomes" you to "Red Hat Linux." All messages thereafter show success or failure in brackets at the right-hand side of the screen.
Most of this chapter deals with init, because it is the part of the boot sequence where you have the most control.
There is nothing special about init. It is a program just like any other on the Linux system, and you'll find it in /sbin along with other system binaries. The main purpose of init is to start and stop other programs in a particular sequence. All you have to know is how this sequence works.
There are a few different variations, but most Linux distributions use the System V style discussed here. Some distributions use a simpler version that resembles the BSD init, but you are unlikely to encounter this.
At any given time on a Linux system, a certain base set of processes is running. This state of the machine is called its runlevel, and it is denoted with a number from 0 through 6. The system spends most of its time in a single runlevel. However, when you shut the machine down, init switches to a different runlevel in order to terminate the system services in an orderly fashion and to tell the kernel to stop. Yet another runlevel is for single-user mode, discussed later.
The easiest way to get a handle on runlevels is to examine the init configuration file, /etc/inittab. Look for a line like the following:

This line means that the default runlevel on the system is 5. All lines in the inittab file take this form, with four fields separated by colons occurring in the following order:
• # A unique identifier (a short string, such as id in the preceding example)
• The applicable runlevel number(s)
• The action that init should take (in the preceding example, the action is to set the default runlevel to 5)
• A command to execute (optional)
There is no command to execute in the preceding initdefault example because a command doesn't make sense in the context of setting the default runlevel. Look a little further down in inittab, until you see a line like this:
l5:5:wait:/etc/rc.d/rc 5
This line triggers most of the system configuration and services through the rc*.d and init.d directories. You can see that init is set to execute a command called /etc/rc.d/rc 5 when in runlevel 5. The wait action tells when and how init runs the command: run rc 5 once when entering runlevel 5, and then wait for this command to finish before doing anything else.
There are several different actions in addition to initdefault and wait, especially pertaining to power management, and the inittab(5) manual page tells you all about them. The ones that you're most likely to encounter are explained in the following sections.
The respawn action causes init to run the command that follows, and if the command finishes executing, to run it again. You're likely to see something similar to this line in your inittab file:
1:2345:respawn:/sbin/mingetty tty1

The getty programs provide login prompts. The preceding line is for the first virtual console (/dev/tty1), the one you see when you press ALT-F1 or CONTROL-ALT-F1. The respawn action brings the login prompt back after you log out.
The ctrlaltdel action controls what the system does when you press CONTROL-ALT-DELETE on a virtual console. On most systems, this is some sort of reboot command using the shutdown command.
The sysinit action is the very first thing that init should run when it starts up, before entering any runlevels.
How processes in runlevels start
You are now ready to learn how init starts the system services, just before it lets you log in. Recall this inittab line from earlier:
l5:5:wait:/etc/rc.d/rc 5
This small line triggers many other programs. rc stands for run commands, and you will hear people refer to the commands as scripts, programs, or services. So, where are these commands, anyway?
For runlevel 5, in this example, the commands are probably either in /etc/rc.d/rc5.d or /etc/rc5.d. Runlevel 1 uses rc1.d, runlevel 2 uses rc2.d, and so on. You might find the following items in the rc5.d directory:
S10sysklogd S20ppp S99gpm
S12kerneld S25netstd_nfs S99httpd
S15netstd_init S30netstd_misc S99rmnologin
S18netbase S45pcmcia S99sshd
S20acct S89atd
S20logoutd S89cron

The rc 5 command starts programs in this runlevel directory by running the following commands:
S10sysklogd start
S12kerneld start
S15netstd_init start
S18netbase start
S99sshd start

Notice the start argument in each command. The S in a command name means that the command should run in start mode, and the number (00 through 99) determines where in the sequence rc starts the command.
The rc*.d commands are usually shell scripts that start programs in /sbin or /usr/sbin. Normally, you can figure out what one of the commands actually does by looking at the script with less or another pager program.
You can start one of these services by hand. For example, if you want to start the httpd Web server program manually, run S99httpd start. Similarly, if you ever need to kill one of the services when the machine is on, you can run the command in the rc*.d directory with the stop argument (S99httpd stop, for instance).
Some rc*.d directories contain commands that start with K (for "kill," or stop mode). In this case, rc runs the command with the stop argument instead of start. You are most likely to encounter K commands in runlevels that shut the system down.
Adding and removing services
If you want to add, delete, or modify services in the rc*.d directories, you need to take a closer look at the files inside. A long listing reveals a structure like this:
lrwxrwxrwx . . . S10sysklogd -> ../init.d/sysklogd
lrwxrwxrwx . . . S12kerneld -> ../init.d/kerneld
lrwxrwxrwx . . . S15netstd_init -> ../init.d/netstd_init
lrwxrwxrwx . . . S18netbase -> ../init.d/netbase

The commands in an rc*.d directory are actually symbolic links to files in an init.d directory, usually in /etc or /etc/rc.d. Linux distributions contain these links so that they can use the same startup scripts for all runlevels. This convention is by no means a requirement, but it often makes organization a little easier.
To prevent one of the commands in the init.d directory from running in a particular runlevel, you might think of removing the symbolic link in the appropriate rc*.d directory. This does work, but if you make a mistake and ever need to put the link back in place, you might have trouble remembering the exact name of the link. Therefore, you shouldn't remove links in the rc*.d directories, but rather, add an underscore (_) to the beginning of the link name like this:
mv S99httpd _S99httpd

At boot time, rc ignores _S99httpd because it doesn't start with S or K. Furthermore, the original name is still obvious, and you have quick access to the command if you're in a pinch and need to start it by hand.
To add a service, you must create a script like the others in the init.d directory and then make a symbolic link in the correct rc*.d directory. The easiest way to write a script is to examine the scripts already in init.d, make a copy of one that you understand, and modify the copy.
When adding a service, make sure that you choose an appropriate place in the boot sequence to start the service. If the service starts too soon, it may not work, due to a dependency on some other service. For non-essential services, most systems administrators prefer numbers in the 90s, after most of the services that came with the system.
Linux distributions usually come with a command to enable and disable services in the rc*.d directories. For example, in Debian, the command is update-rc.d, and in Red Hat Linux, the command is chkconfig. Graphical user interfaces are also available. Using these programs helps keep the startup directories consistent and helps with upgrades.
HINT: One of the most common Linux installation problems is an improperly configured XFree86 server that flicks on and off, making the system unusable on console. To stop this behavior, boot into single-user mode and alter your runlevel or runlevel services. Look for something containing xdm, gdm, or kdm in your rc*.d directories, or your /etc/inittab.
Controlling init
Occasionally, you need to give init a little kick to tell it to switch runlevels, to re-read the inittab file, or just to shut down the system. Because init is always the first process on a system, its process ID is always 1.
You can control init with telinit. For example, if you want to switch to runlevel 3, use this command:
telinit 3
When switching runlevels, init tries to kill off any processes that aren't in the inittab file for the new runlevel. Therefore, you should be careful about changing runlevels.
When you need to add or remove respawning jobs or make any other change to the inittab file, you must tell init about the change and cause it to re-read the file. Some people use kill -HUP 1 to tell init to do this. This traditional method works on most versions of Unix, as long as you type it correctly. However, you can also run this telinit command:
telinit q
You can also use telinit s to switch to single-user mode.
Shutting down
init also controls how the system shuts down and reboots. The proper way to shut down a Linux machine is to use the shutdown command.
There are two basic ways to use shutdown. If you halt the system, it shuts the machine down and keeps it down. To make the machine halt immediately, use this command:
shutdown -h now
On most modern machines with reasonably recent versions of Linux, a halt cuts the power to the machine. You can also reboot the machine. For a reboot, use -r instead of -h.
The shutdown process takes several seconds. You should never reset or power off a machine during this stage.
In the preceding example, now is the time to shut down. This argument is mandatory, but there are many ways of specifying it. If you want the machine to go down sometime in the future, one way is to use +n, where n is the number of minutes shutdown should wait before doing its work. For other options, look at the shutdown(8) manual page.
To make the system reboot in 10 minutes, run this command:
shutdown -r +10
On Linux, shutdown notifies anyone logged on that the machine is going down, but it does little real work. If you specify a time other than now, shutdown creates a file called /etc/nologin. When this file is present, the system prohibits logins by anyone except the superuser.
When system shutdown time finally arrives, shutdown tells init to switch to runlevel 0 for a halt and runlevel 6 for a reboot. When init enters runlevel 0 or 6, all of the following takes place, which you can verify by looking at the scripts inside rc0.d and rc6.d:
1. init kills every process that it can (as it would when switching to any other runlevel).
• The initial rc0.d/rc6.d commands run, locking system files into place and making other preparations for shutdown.
• The next rc0.d/rc6.d commands unmount all filesystems other than the root.
• Further rc0.d/rc6.d commands remount the root filesystem read-only.
• Still more rc0.d/rc6.d commands write all buffered data out to the filesystem with the sync program.
• The final rc0.d/rc6.d commands tell the kernel to reboot or stop with the reboot, halt, or poweroff program.
The reboot and halt programs behave differently for each runlevel, potentially causing confusion. By default, these programs call shutdown with the -r or -h options, but if the system is already at the halt or reboot runlevel, the programs tell the kernel to shut itself off immediately. If you really want to shut your machine down in a hurry (disregarding any possible damage from a disorderly shutdown), use the -f option.

Basic Interview Questions (Beginners)

1. Q. How do you list files in a directory?
A. ls - list directory contents
ls -l (-l use a long listing format)

2. Q. How do you list all files in a directory, including the hidden files?
A. ls -a (-a, do not hide entries starting with .)

3. Q. How do you find out all processes that are currently running?
A. ps -f (-f does full-format listing.)

4. Q. How do you find out the processes that are currently running or a particular user?
A. ps -au Myname (-u by effective user ID (supports names)) (a - all users)

5. Q. How do you kill a process?
A. kill -9 8 (process_id 8) or kill -9 %7 (job number 7)
kill -9 -1 (Kill all processes you can kill.)
killall - kill processes by name most (useful - killall java)

6. Q. What would you use to view contents of the file?
A. less filename
cat filename
pg filename
pr filename
more filename
most useful is command: tail file_name - you can see the end of the log file.

7. Q. What would you use to edit contents of the file?
A. vi screen editor or jedit, nedit or ex line editor

8. Q. What would you use to view contents of a large error log file?
A. tail -10 file_name ( last 10 rows)

9. Q. How do you log in to a remote Unix box?
A. Using telnet server_name or ssh -l ( ssh - OpenSSH SSH client (remote login program))

10.Q. How do you get help on a UNIX terminal?
A. man command_name
info command_name (more information)

11.Q. How do you list contents of a directory including all of its
subdirectories, providing full details and sorted by modification time?
A. ls -lac
-a all entries
-c by time

12.Q. How do you create a symbolic link to a file (give some reasons of doing so)?
A. ln /../file1 Link_name
Links create pointers to the actual files, without duplicating the contents of
the files. That is, a link is a way of providing another name to the same file.
There are two types of links to a file:Hard link, Symbolic (or soft) link;

13.Q. What is a filesystem?
A. Sum of all directories called file system.
A file system is the primary means of file storage in UNIX.
File systems are made of inodes and superblocks.

14.Q. How do you get its usage (a filesystem)?
A. By storing and manipulate files.

15.Q. How do you check the sizes of all users� home directories (one command)?
A. du -s

The du command summarizes disk usage by directory. It recurses through all subdirectories and shows disk usage by each subdirectory with a final total at the end.

Q. in current directory
A. ls -ps (p- directory; s - size)

16.Q. How do you check for processes started by user 'pat'?

A. ps -fu pat (-f -full_format u -user_name )

17.Q. How do you start a job on background?

A. bg %4 (job 4)

18 Q. What utility would you use to replace a string '2001' for '2002' in a text file?

A. Grep, Kde( works on Linux and Unix)

19. Q. What utility would you use to cut off the first column in a text file?
A. awk, kde

20. Q. How to copy file into directory?
A. cp /tmp/file_name . (dot mean in the current directory)

21. Q. How to remove directory with files?
A. rm -rf directory_name

22. Q. What is the difference between internal and external commands?
A. Internal commands are stored in the; same level as the operating system while external
commands are stored on the hard disk among the other utility programs.

23. Q. List the three main parts of an operating system command:
A. The three main parts are the command, options and arguments.

24 Q. What is the difference between an argument and an option (or switch)?
A. An argument is what the command should act on: it could be a filename,
directory or name. An option is specified when you want to request additional
information over and above the basic information each command supplies.

25. Q. What is the purpose of online help?
A. Online help provides information on each operating system command, the
syntax, the options, the arguments with descriptive information.
26. Q. Name two forms of security.
A. Two forms of security are Passwords and File Security with permissions specified.

27. Q. What command do you type to find help about the command who?
A. $ man who

28. Q. What is the difference between home directory and working directory?
A. Home directory is the directory you begin at when you log into the
system. Working directory can be anywhere on the system and it is where you are currently

29. Q. Which directory is closer to the top of the file system tree, parent directory or current directory?
A. The parent directory is above the current directory, so it is closer to
the root or top of the
file system.

30. Q. Given the following pathname:
$ /business/acctg/payable/supplier/april
a) If you were in the directory called acctg, what would be the relative
pathname name for the file called april?
b) What would be the absolute pathname for april?
a) $ payable/supplier/april
b) $ /business/acctg/payable/supplier/april

31. Q. Suppose your directory had the following files:
help. 1 help.2 help.3 help.4 help.O1 help.O2
aid.O1 aid.O2 aid.O3 back. 1 back.2 back.3
a) What is the command to list all files ending in 2?
b) What is the command to list all files starting in aid?
c) What is the command to list all "help" files with one character extension?
a) ls *2
b) ls aid.*
c) ls help.?

32. Q. What are two subtle differences in using the more and the pg commands?
A. With the more command you display another screenful by pressing
the spacebar, with pg you press the return key.
The more command returns you automatically to the UNIX
shell when completed, while pg waits until you press return.

33. Q. When is it better to use the more command rather than cat command?
A. It is sometimes better to use the more command when you are viewing
a file that will display over one screen.

34. Q. What are two functions the move mv command can carry out?
A. The mv command moves files and can also be used to rename a file or directory.

35. Q. Name two methods you could use to rename a file.
A. Two methods that could be used:
a. use the mv command
b. copy the file and give it a new name and then remove the original file if no longer needed.

36. The soccer league consists of boy and girl teams. The boy file names begin
with B, the girl teams begin with G. All of these files are in one directory
called "soccer", which is your current directory: Bteam.OOl Bteam.OO2 Bteam.OO4 Gteam.OOl Gteam.OO2 Gteam.OO3
Write the commands to do the following:
a) rename the file to Bteam.OO3.
b) erase the file Gteam. win after you have viewed the contents of the file
c) make a directory for the boy team files called "boys", and one for the girl team files
called" girls"
d) move all the boy teams into the "boys" directory
e) move all the girl teams into the "girls" directory
f) make a new file called Gteam.OO4 that is identical to Gteam.OOl
g) make a new file called Gteam.OO5 that is identical to Bteam.OO2
a) mv Bteam.OO3.
b) cat -or- more
rm Gteam. win
c) mkdir boys
mkdir girls
d) mv Bteam* boys
e) mv Gteam* girls
f) cd girls
cp Gteam.OO1 Gteam.OO4
g) There are several ways to do this. Remember that we are currently in the directory
cp ../boys/Bteam.OO2 Gteam.OO5
cd ../boys
cp Bteam.OO2 ../girls/Gteam.OO5

37. Q. Draw a picture of the final directory structure for the "soccer"
directory, showing all the files and directories.

38. Q. What metacharacter is used to do the following:
1.1 Move up one level higher in the directory tree structure
1.2 Specify all the files ending in .txt
1.3 Specify one character
1.4 Redirect input from a file
1.5 Redirect the output and append it to a file
1. 1.1 double-dot or ..
1.2 asterisk or *
1.3 question or ?
1.4 double greater than sign: >>
1.5 the less than sign or <

39. Q. List all the files beginning with A
A. To list all the files beginning with A command: ls A*

40. Q. Which of the quoting or escape characters allows the dollar sign ($) to retain its special meaning?
A. The double quote (") allows the dollar sign ($) to retain its special meaning.
Both the backslash (\) and single quote (') would remove the special meaning of the dollar sign.

41. Q. What is a faster way to do the same command?
mv fileO.txt newdir
mv filel.txt newdir
mv file2.txt newdir
mv file3.txt newdir
A. A shortcut method would be: mv file?.txt newdir

42. Q. List two ways to create a new file:
a. Copy a file to make a new file.
b. Use the output operator e.g. ls -l > newfile.txt

43. Q. What is the difference between > and >> operators?
A. The operator > either overwrites the existing file (WITHOUT WARNING) or creates a new file.
The operator >> either adds the new contents to the end of an existing file or creates a new file.

44. Write the command to do the following:
44.1 Redirect the output from the directory listing to a printer.
44.2 Add the file efg.txt to the end of the file abc.txt.
44.3 The file testdata feeds information into the file called program
44.4 Observe the contents of the file called xyz.txt using MORE.
44.5 Observe a directory listing that is four screens long.
44.1 ls > lpr
44.2 cat efg.txt >> abc.txt
44.3 program < testdata
44.4 more < xyz.txt
44.5 ls > dirsave | more

45. Q. How do you estimate file space usage
A. Use du command (Summarize disk usage of each FILE, recursively for
directories.) Good to use arguments du -hs
(-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)
(-s, --summarize display only a total for each argument)

46. Q. How can you see all mounted drives?
A. mount -l

47. Q. How can you find a path to the file in the system?
A. locate file_name (locate - list files in databases that match a pattern)

48. Q. What Linux HotKeys do you know?
A. Ctrl-Alt-F1 Exit to command prompt
Ctrl-Alt-F7 or F8 Takes you back to KDE desktop from command prompt
Crtl-Alt-Backspace Restart XWindows
Ctrl-Alt-D Show desktop

49. Q. What can you tell about the tar Command?
A. The tar program is an immensely useful archiving utility. It can combine
an entire directory tree into one large file suitable for transferring or

50. Q. What types of files you know?
A. Files come in eight flavors:
Normal files
Hard links
Symbolic links
Named pipes
Character devices
Block devices

51. Q. How to copy files from on PC to another on the same network
A. Use the following command:scp yur_file you_login@your_IP
example: copy .conf file from your PC to alex computer-
scp /etc/X11/xorg.conf alex@

52. Q. Please describe information below:

-rw-rw-r-- 1 dotpc dotpc 102 Jul 18 2003 file.buf
drwxr-xr-x 9 dotpc dotpc 4096 Oct 21 09:34 bin
lrwxrwxrwx 1 dotpc dotpc 20 Mar 21 15:00 client -> client-2.9.5
drwxrwxr-x 11 dotpc dotpc 4096 Sep 2 2005 client-2.8.9
drwxrwxr-x 7 dotpc dotpc 4096 Dec 14 12:13 data
drwxr-xr-x 12 dotpc dotpc 4096 Oct 21 09:41 docs
drwxr-xr-x 5 dotpc dotpc 4096 Dec 7 14:22 etc
drwxr-xr-x 11 dotpc dotpc 4096 Mar 21 15:54 client-2.9.5
-rw-r--r-- 1 dotpc dotpc 644836 Mar 22 09:53 client-2.9.5.tar.gz

A. This is a result of command $ls -l
we have two files, 6 directories and one link to client-2.9.5 directory.
There is number of files in every directory, size and data of last change.

53. Q. If you would like to run two commands in sequence what operators you can use?

A. ; or && the difference is:
if you separate commands with ; second command will be run automatically.
if you separate commands with && second command will be run only in the case
the first was run successfully.

54. Q. How you will uncompress the file?
A. Use tar command (The GNU version of the tar archiving utility):
tar -zxvf file_name.tar.gz

55. Q.How do you execute a program or script, my_script in your current directoty?
A. ./my_script

56. Q.How to find current time configuration in the file my_new.cfg
A. grep time my_new.cfg
Grep searches the named input files (or standard input if
no files are named, or the file name - is given) for lines
containing a match to the given pattern.

Q. What does grep() stand for?
A. General Regular Expression Parser.

57. Q. What does the top command display?
A. Top provides an ongoing look at processor activity in real
time. It displays a listing of the most CPU-intensive
tasks on the system, and can provide an interactive inter¬
face for manipulating processes. (q is to quit)

58. Q. How can you find configuration on linux?
A. by using /sin/ifconfig
If no arguments are given, ifconfig displays the status of the cur-
rently active interfaces. If a single interface argument is given, it displays the status of the given interface only; if a single -a argu-
ment is given, it displays the status of all interfaces, even those
that are down. Otherwise, it configures an interface.

59. Q. How to find difference in two configuration files on the same server?
A. Use diff command that is compare files line by line
diff -u /usr/home/my_project1/etc/ABC.conf /usr/home/my_project2/etc/ABC.conf

60. Q. What is the best way to see the end of a logfile.log file?
A. Use tail command - output the last part of files
tail -n file_name ( the last N lines, instead of the last 10 as default)

61. Q. Please write a loop for removing all files in the current directory that contains a word 'log'
A. for i in *log*; do rm $i; done

62. Question: How to switch to a previously used directory?
Answer: cd -

Please answer these questions

Explain Process management and related commands

Explain Memory management and related commands

What is Open Group standards?

Secify seciaal usage for each one of the following file
/dev/null - Send unwanted output
/dev/random - Random number generation
/dev/zero - Cache or Destroy data on a partition - dd if=/dev/zero of=/dev/sda98

What is SELinux?

Write a command to find all of the files which have been accessed within the last 10 days.

What is LILO?

What is Grub?

Explain the difference between LILO and Grub

What is NFS?

What is NAMED?

What is MySQLD?

What is mysql?

What is CVS?

Why You Shouldn't Use the root Login for everyday work?

Describe the default partition scheme in Redhat Linux?

Describe the default partition scheme in Solaris? What is the slice number?

Describe all default mount point?

What is boot block?

What is logical block?

Describe the process for adding a new hard disk to UNIX box?

Describe the process for adding a new hard disk to Linux box?

Describe the process for adding a new hard disk to Linux LVM to grow /home?

Explain one major difference between a regular file system and a journaling file system?

Define JFS

Define UFS

How do you lock and unlock user account / password?

Describe RPM and command to install / remove / update Linux system?

Explain difference between rpm and up2date command.

Explain difference between rpm and apt-get command.

Explain difference between rpm and yum command.

Describe usage for pkgadd, pkginfo and pkgchk command

How do you find files on UNIX or Linux system?

Explain /etc/rc3.d

Explain ntsysv or chkconfig command

How do you get rid of process if kill PID is not working for you?

What is the purpose of the command?
fdisk -l

Explain LVM
1) What is a superblock ?
2) What is a parity bit?
3) What is an inod?
4) Explain top command ?
5) How to disable the root login in SSH ?
6) use of sysctl command ?
7) LVM how to ?
8)Different RAID levels ?

What are the services required for nfs, apache(http) and NIS?

What is the best way to check the status of any service?

What do you mean by parity in RAID and which RAID is useful now a days?

Explain Linux Boot process especially kernel and initrd.

Why we do have two commands useradd and 
adduser when their functialnality is same?

Some small interview Questions

Q: How do you display your running kernel version? (Solaris, AIX, Linux)
A: Linux # uname –r , Solaris # showrev

Q: Which command do you use to display a table of running processes? (Solaris, AIX, Linux)
A: Linux # ps –ef and top , Solaris # prstat

Q: Which file do you modify to configure a domain name resolver? (Solaris, AIX, Linux)
A: Linux # /etc/resolv.conf , Solaris # /etc/resolv.conf

Q: Which file contains a list of locally defined hostnames and corresponding IP addresses? (Solaris, AIX, Linux)
A: Linux # /etc/hosts , Solaris # /etc/hosts and linked file /etc/inet/hosts

Q: How do you display a routing table? (Solaris, AIX, Linux)
A: Linux # ip route show or #netstat –nr or #route –n and Solaris # netstat –nr and #route -n

Q: Which command would you use to view partitions and their sizes on Solaris?
A: # df -kh

Q: Which OpenBoot command would you use to print/view OpenBoot environment variables on a SUN server?
A: #printenv

Q: What does ”ypwhich” command do? (Solaris, AIX, Linux)
A: # Will display NIS server to which client is connected to and which NIS Server is master for particular map specified with this command

Q: which command would you use to create an OS user on Solaris and Linux?
A: Linux # useradd and Solaris #useradd

Q: Which file contains passwords for local users on Solaris, Linux and on AIX?
A: Linux #/etc/shadow and Solaris # /etc/shadow

Q: Which command would you use to list partitions on Linux?
A: Linux # mount –l or # df -kh

Q: Which command/commands would you use to manage installed packages on RedHat Linux?
A: Linux # rpm

Q: What is the default port for SSH server?
A: 22

Q: Which command/commands would you use to manage installed packages on Solaris?
A: #pkginfo #pkgrm # pkgadd #pkgchk

Q: What command would you use to install an OS patch on Solaris?
A: #showrev –p and #patchadd -p

Q: Which Veritas command would you use to display a list of Veritas volumes?
A: # vxprint

Q: Which Veritas command would you use to display a list of disks on a system?
A: # vxdx list

Q: What is the main system configuration utility in AIX?

Q: Which file has a list of filesystems to be mounted at boot time on Solaris, Linux and AIX?
A: Linux # /etc/fstab and Solaris #/etc/vfstab

Q: Which Veritas Cluster Server command would you use to display the status of a cluster and it’s resources?

Q: Which command would you use to rename a disk for VMware Guest virtual machine on ESX server 3 storage volume?

Q: Which command would use on VMware ESX 3 server to display virtual switch configuration?

Q: Which Veritas Cluster Server command would you use to display the status of a cluster and it’s resources?
A: clustat and to manage the cluster configruation use clusvcadm

Q: Which command would you use to rename a disk for VMware Guest virtual machine on ESX server 3 storage volume?
A: the best way is clone vm to different datastore or in the same datastore with different name
vmkfstools -i \\vmfs\old_vm.vmdk \\vmfs\new_vm.vmdk
this will take care of it all

Q: Which command would use on VMware ESX 3 server to display virtual switch configuration?
A: esxcfg-vswitch -l or user esxcfg-vswitch -help to see all options

Access common commands quicker ?ps -ef | grep -i $@
Alternative for top command ?prstat –a
Change to a directory, which is having very long name ?
cd CDMA_3X_GEN*Here original directory name is . .CDMA_3X_GENERATION_DATAnswer:.
Delete blank lines in a file ?
cat sample.txt | grep -v ?^$? > new_sample.txt
Display disk usage in Kilobytes ?
du -k
Display Ethernet Address arp table ?
arp -a
Display the all files recursively with path under current directory ?
find . -depth -print
Display the Disk Usage of file sizes under each directory in currentDirectory ?
du -k * | sort .nr (or) du .k . | sort -nr
Display the files in the directory by file size ?
ls .ltr | sort .nr .k 5
Display the inter-process communication facility status ?

Desired Profile for Linux Admins keep your self Updated

Installation, Configuration, Maintenance of OS ( Linux : RedHat, Suse )
Handling CVS and SVN for repository on Linux Platform.
Installation and troubleshooting of Oracle Database, Application Server ( Weblogic),

Apache, Tomcat etc. and Web servers
Shell sciprting skills to automate the backups.
Good Knowledge of NFS,NIS and File Systems.
Configuration of Services like FTP,Telnet, SSH, etc
Sound knowledge of Solaris .
Preferably RHCE Certified Engineer.
Installation, Configuration, Maintenance of OS ( Linux : RedHat,

Suse )
Handling CVS and SVN for repository on Linux Platform.
Installation and troubleshooting of Oracle Database, Application Server ( Weblogic),

Apache, Tomcat etc. and Web servers
Shell sciprting skills to automate the backups.
Good Knowledge of NFS,NIS and File Systems.
Configuration of Services like FTP,Telnet, SSH, etc
Sound knowledge of Solaris .
Preferably RHCE Certified Engineer.

Name as many shells as you can (or) How many SHELL are there in Unix/Linux

* Name as many shells as you can.
Bourne shell (sh)
Almquist shell (ash)
Debian Almquist shell (dash)
Bourne-Again shell (bash)
Friendly interactive shell (fish)
Korn shell (ksh)
C shell (csh)
TENEX C shell (tcsh)
Es shell (e
esh (Unix) Easy Shell
rc shell (rc) - shell for Plan 9 and Unix
runscript The initial shell interpreter used to process startup scripts in Gentoo
scsh (Scheme Shell)
Stand-alone Shell (sash)
Z shell (zsh)

* After u answer that question they may ask " What's your favorite shell? Why? "
bash - it rocks and feature rich.

8 Technology updates

Cloud computing. Using applications and storage in the “cloud”, instead of “on premise”, is fast becoming a cost effective alternative for enterprises. In the new setting, enterprises are likely to rely on Software-as-service (SaaS) for non-core processes allowing CIOs to focus on core processes, and save significant costs in license fees, support and maintenance.

Green IT. Enterprises will invest in technologies and solutions for compliance to regulations in the Green space, to become energy efficient and reduce carbon foot prints. Incidentally, Green IT also helps enterprises lower operating costs.

Open-source software (OSS) has established its role firmly in the IT industry, even though the rate of maturity and saturation-levels vary across market segments. Thus, most mainstream IT organizations are blending the best of open-source and closed-source solutions.

 is an important aspect of an enterprise today. It reduces the human latency in business processes and improves both cost efficiency and customer experience. The underlying technology is based on unified communications which integrates all the channels of voice and non voice communication over IP.

Social computing There is an emerging demand for integrating data in enterprise IT systems with that in social networks, to improve or promote, campaign management, community driven discounting, and intercontinental connections.

Information management is an important aspect of new enterprise as it is moving from a structured data model (text heavy and relational) to unstructured data model (multi modal and search driven).

 in an enterprise is very closely linked to collaboration and social computing. With the exponential rise in the types of mobile devices and their usage in enterprises, it is fast becoming a social experience challenge in a business environment.

Linux some common things to remember

1. In Linux systems, to document access to equipment.

2. Linux kernel boot, from the file / etc / fstab to read the file system to load.

3. Linux file system, each file to identify with the i node.

4. All the disk block consists of four parts, namely, guide blocks, special blocks, i node table blocks and blocks of data storage

5. Links divided into: hard links and symbolic links.

6. Super-block contains the i node table and the free block table and other important file system information.

7. A certain file permissions: d-rw--r - -r -, with values expressed as to the authority, then the octal number: 644, the file attribute is a directory.

8. Foreground the process of starting to use Ctrl + c to terminate. 8. Foreground the process of starting to use Ctrl + c to terminate.

9. Static routing settings, if the network topology change is required by the system administrator to modify the routing settings.

10. The important task of network management: control and monitoring.

11. Install Linux system hard disk partition, there must be two kinds of partition types: file system partition and swap partition.

13. Prepared by Shell to run the script file must be given before the execute permission.

14. System management tasks is to be able to achieve in a distributed environment, programs and data security protection, backup, restore and update.

15. The system swap partition as a virtual memory system, a regional.

16. Kernel is divided into process management systems, memory management system, I / O management system and document management systems, four sub-systems.

17. Kernel configuration is the system administrator to change the system configuration hardware to conduct a major operation.

18. In the installation of Linux systems, use the netconfig program to configure the network, the installation program prompts the user for a step by step, type the host name, domain names, domain name server, IP address, gateway address and subnet mask and other necessary information.

19. That uniquely identifies each user is the user ID and user name.

20. RIP protocol is the most common is an internal agreement, commonly known as dynamic routing information protocol. Agreement is the most common is an internal agreement, commonly known as dynamic routing information protocol.

21. In the Linux system, all the contents are represented as files, organize files in various ways is called the file system.

22. DHCP dynamic IP address assignment can be achieved. 22. DHCP dynamic IP address assignment can be achieved.

23. System network management object is a server administrator, user and server processes and system resources.

24. Network management usually monitoring, transmission and management of three parts, of which management component of the entire network management center.

25. When you want to delete this system without access to the device driver must compile the kernel, when the kernel does not support the device driver on the system, you must upgrade to the kernel.

26 Ping command to test the network, the local systems are able to get to a remote host, so I often used to test network connectivity.

27. Vi editor has two operating modes: command mode and input mode.

28. Can use ls-al command to see the file permissions, the permissions of each file are in 10 bits and is divided into four sections, which accounted for a paragraph that file type, accounting for 3 second paragraph that the owner of the file permissions for the file.

29. The distinction between process and procedure lies in its dynamic nature, dynamic creation and termination of the process from creation to the termination of the basic state can have: Run state, ready state and wait state (blocked state).

30. DNS is actually distributed in the internet database of information on the host, its role is to achieve the IP address and host name conversion.

31. Apache is to achieve WWW server function of the application, known as the "Browse web server" in the server-side web services to provide users here is the apache application.

32. In the Linux system can have two types of backup: a backup system backup and user. Where the former refers to the operating system backup, which refers to applications and user files backed up. Where the former refers to the operating system backup, which refers to applications and user files backed up.

33. CD-ROM standard file system type is iso9660.

34. When the lilo.conf configuration has been completed, bring it into force, should run the command and parameters is lilo.

35. In using the ls command, use the octal display non-printing characters should be used to parameter-b.

36. Linux that supports Windows 9.x/2000 long file name file system type is vfat.

37. Set limits on the use of disk space a user command is quota.

38 In the Linux system, used to store system configuration files and subdirectories needed directory is /etc.

39. Hard link can only be built on the file link. Symbolic links across different file systems can be created. Symbolic links across different file systems can be created.

40. Socket file attribute bit is s.

41. The end of the background process command is kill.

42. There are two ways to run the process, that is independently run and use the parent process to run.

43. Links are divided into hard links and symbolic links.

44. In the super-user Linux system, under the display of all running processes, you should use the command and parameters are ps-aux.

45. Pipeline file attribute bit is p.

46. Will be the standard output of the previous command, after a command as standard input, called pipes.

47. For the implementation of the right of the specified script command and parameters are chmod a + x filename.

48. Remote login commands are telnet.

49. To send 10 packets packets test connectivity with the host, you should use the commands and parameters are: ping 10.

50. DNS server process named named, when it starts to automatically load / etc directory of the named.conf file partition defined in the DNS database file.

51. Apache server process configuration file is httpd.conf.

52. In the Linux system, the compressed files generated after the suffix. Gz file command is gzip.

53. Edit a file using vi, it will be put into the file test.txt file, should be the command mode, type: w test.txt.

54 can be displayed on standard output the whole year calendar orders and parameters are cal-y.

55. In shell programming, the use of square brackets indicate that the rules of test conditions are: there must be space on both sides of the square brackets.

56. Check the installed file system / dev/had5 is normal, if the check is wrong, then the auto-repair, the command and parameters are fsck-a / dev/had5.

57. Windows9.x environment shared Unix / Linux users in the directory tool is a Samba server.

58. System Administrator is responsible for system resource management, system performance management, device management, security management and system performance monitoring.

59 In the Linux system to test DNS server is able to correctly resolve the domain name of the client-side command, use the command nslookup.

60. In the Linux system, the second IDE channel hard disk (slave) was identified as hdb.

61. When the system administrator needs to upgrade the kernel version and change the system hardware configuration, should be re-compile the kernel.

62. If you just want to modify the system IP address, should be amended / etc/rc.d/rc.inet1 configuration file.

63. When the LAN there are no conditions for the establishment DNS server, but want to LAN users can use the computer name to visit each other, we should configure / etc / hosts file.

64. In the vi editor environment, using the Esc key to model.

65. Slackware Linux 9.0 typically use ext3 file system, the system's total disk block consists of four parts.

66. To / home/stud1/naresh directory do archive compression, the compressed generated naresh.tar.gz file, and save this file to the / home directory, to achieve this task tar command format tar zcvf /home/naresh.tar.gz /home/stud1/naresh.

67. Pipeline from the former standard output as a command after a command standard input.

68. In the use of manual methods to configure the network, you can modify / etc / HOSTNAME file to change the host name, to configure the computer's domain name resolution client, the need to configure / etc / resolv.conf file.

69. Startup process is to manually start and scheduling are two ways to start, where to start commonly used scheduling command at, batch, and crontab.

70. domain name is, if you want to configure a domain name server should be defined in the named.conf file, DNS database, working directory.

71. Sendmail e-mail system uses two main protocols are: SMTP and POP, the former is used to send the message, which is used for receiving mail.

72. DHCP is short for Dynamic Host Configuration Protocol, its role is: To network host allocation of IP addresses.

73. At present the use of a proxy server software package there are a variety of teaching materials used in the squid.

74. Rm command to delete files or directories, the main difference is whether to use recursive switch-r or-R.

75. Mv command can move files and directories, you can also rename files and directories.

76. Routing Protocol (RIP) of the number of hops that must pass before the destination gateway number, RIP acceptable to jump the longest distance is 15.

77. Ping command is used to test network connectivity, ping command through the ICMP protocol (internet control message protocol) to achieve.

78. Nfs protocol used to implement Unix (/ linux) file system shared between hosts.
79. In the Linux operating system, devices are accessed through special files.

80. Shell is not only the user command interpreter, it is also a powerful programming language. Bash is the Linux default shell. bash is the Linux default shell.

81. Use ";"; symbol redirects the contents of the output appended to the back of the original.

82. To increase a user's command is: adduser or useradd.

83 for string search using grep command.

84. Use * for each match the number of characters.

85. / Sbin directory is used to store the system administrator using the management procedure

Various technologies for a System administrators


  • HP Smart arrays

  • SSH

  • NIS+

  • NFS

  • DNS

  • Veritas Net backup

  • Mid range/Enterprise Servers Hardware

  • Solaris 10 zones and containers.(virtualization)

  • Red Hat Linux OS

  • Solaris 8 & 10 OS

  • Disk storage management ( Solstice Disk suite and VERITAS Volume Manager)

  • HA skills (VERITAS Cluster server,Sun Cluster (a plus))

  • scripting ( Shell & Perl scripting)

  • Symantec Net backup Administration

  • Network Services: Webserver (Apache/tomcat), DNS, Mail, FTP

  • Fail over/Redundancy: RAID, Clustering, Heartbeat, LVS

  • Virtualization: Xen, Vmware,citrix

  • Security: IPtables, TCP wrappers, SElinux, Hardware based firewalls

  • monitoring tools i.e. open view , Tivoli , Big-brother , Ngaios
  • Must have skills for linux administrator

    User & group administration
    Configuring Linux Networking
    Installing and configuring Linux Operating system
    Basic Operating System Concepts
    Basic experience in Shell Scripts.
    Knowledge on apache server
    Knowledge on FTP,SSH,SSL,Telnet & xinetd
    Knowledge about File system hierarchy
    Basic Network Troubleshooting
    Installing & configuring Linux Software
    Monitoring Server Performance
    Configuring Linux Software RAID
    Expanding Linux Partitions with LVM
    Network Based Linux Installation like NFS, HTTP & FTP
    In-depth knowledge on Linux operating system
    Experience in shell and Perl scripting
    Kernel compilation and fine tuning.
    Configuring Linux Firewalls Using iptables
    Configuring & Managing Disk Usage With Quotas
    Knowledge on TCP/IP
    File system Management
    Expertise in managing and configuring various services like DNS, NIS, NFS, APACHE, FTP, DHCP & SAMBA
    Knowledge on High Availability and Clustering.
    High Level of Troubleshooting skills

    How to give Sudo access to administrators and special users

    /etc/sudoers  (main configuration file)

    usernames/group servername = (usernames command can be run as) command

    Groups are the same as user groups and are differentiated from regular users by a % at the beginning. The Linux user group “users” would be represented by %users.
    You can have multiple usernames per line separated by commas.
    Multiple commands also can be separated by commas. Spaces are considered part of the command.
    The keyword ALL can mean all usernames, groups, commands and servers.
    If you run out of space on a line, you can end it with a back slash (\) and continue on the next line.
    sudo assumes that the sudoers file will be used network wide, and therefore offers the option to specify the names of servers which will be using it.
    In most cases, the file is used by only one server and the keyword ALL suffices for the server name.
    The NOPASSWD keyword provides access without prompting for your password.

    Granting All Access to Specific Users 

    Grant admin1 and admin2 full access to all privileged commands, with this sudoers entry.

    admin1,admin2 ALL=(ALL) ALL

    Granting Access To Specific Users To Specific Files 

    teamlead1, %Project ALL= /sbin/, /usr/sbin

    This entry allows user teamlead1 and all the members of the group Project to gain access to all the program files in the /sbin and /usr/sbin directories

    Granting Access to Specific Files as Another User 

    sudo -u entry allows allows you to execute a command as if you were another user, but first you have to be granted this privilege in the sudoers file.

    This feature can be convenient for programmers who sometimes need to kill processes related to projects they are working on. For example, programmer user1 is on the team developing a financial package that runs a program called thread1 as user accounts. From time to time the application fails, requiring “user1” to stop it with the /bin/kill, /usr/bin/kill or /usr/bin/pkill commands but only as user “accountsmanager”. The sudoers entry would look like this:

    user1 ALL=(accountsmanager) /bin/kill, /usr/bin/kill, /usr/bin/pkill

    User user1 is allowed to stop the thread1 process with this command:

    [user1@learnadmin user1]# sudo -u accountsmanager pkill thread1

    Networking interview Questions

    * What are 10Base2, 10Base5 and 10BaseT Ethernet LANs ?
    * What is the difference between an unspecified passive open and a fully specified passive open
    * Explain the function of Transmission Control Block
    * What is a Management Information Base (MIB)
    * What is anonymous FTP and why would you use it?
    * What is a pseudo tty?
    * What is REX?
    * What does the Mount protocol do ?
    * What is External Data Representation?
    * What is the Network Time Protocol?
    * What is a DNS resource record?
    * What protocol is used by DNS name servers?
    * What is the difference between interior and exterior neighbor gateways?
    * What is the HELLO protocol used for?
    * What are the advantages and disadvantages of the three types of routing tables?
    * What is source route?
    * What is RIP (Routing Information Protocol)?
    * What is SLIP (Serial Line Interface Protocol)?
    * What is Proxy ARP?
    * What is OSPF?
    * What is Kerberos?
    * What is a Multi-homed Host?
    * What is NVT (Network Virtual Terminal)?
    * What is Gateway-to-Gateway protocol?
    * What is BGP (Border Gateway Protocol)?
    * What is autonomous system?
    * What is EGP (Exterior Gateway Protocol)?
    * What is IGP (Interior Gateway Protocol)?
    * What is Mail Gateway?
    * What is wide-mouth frog?
    * What are Digrams and Trigrams?
    * What is silly window syndrome?
    * What is region?
    * What is multicast routing?
    * What is traffic shaping?
    * What is packet filter?
    * What is virtual path?
    * What is virtual channel?
    * What is logical link control?
    * Why should you care about the OSI Reference Model?
    * What is the difference between routable and non- routable protocols?
    * What is MAU?
    * Explain 5-4-3 rule.
    * What is the difference between TFTP and FTP application layer protocols?
    * What is the range of addresses in the classes of internet addresses?
    * What is the minimum and maximum length of the header in the TCP segment and IP datagram?
    * What is difference between ARP and RARP?
    * What is ICMP?
    * What are the data units at different layers of the TCP / IP protocol suite?
    * What is Project 802?
    * What is Bandwidth?
    * Difference between bit rate and baud rate?
    * What is MAC address?
    * What is attenuation?
    * What is cladding?
    * What is RAID?
    * What is NETBIOS and NETBEUI?
    * What is redirector?
    * What is Beaconing?
    * What is terminal emulation, in which layer it comes?
    * What is frame relay, in which layer it comes?
    * What do you meant by “triple X” in Networks?
    * What is SAP?
    * What is subnet?
    * What is Brouter?
    * How Gateway is different from Routers?
    * What are the different type of networking / internetworking devices?
    * What is mesh network?
    * What is passive topology?
    * What are the important topologies for networks?
    * What are major types of networks and explain?
    * What is Protocol Data Unit?
    * What is difference between baseband and broadband transmission?
    * What are the possible ways of data exchange?
    * What are the types of Transmission media?
    * What are the types of Transmission media?
    * What is point-to-point protocol?
    * What are the two types of transmission technology available?
    * Difference between the communication and transmission?
    * What is a different between switch and Hub?
    * What are the Advantages and Disadvantages of DHCP?
    * What is Recovery Console?
    * What is ERD(Emergency Repair Disk)?
    * What is the difference between POP3 and IMAP Mail Server?
    * what is .ost file?
    * Whatz the difference between DNS and WINS?
    * How can we create VPN to connect to branch office of the same office.what would be the priliminary requirment?
    * Why should we care about the OSI Reference Model ? What is the main purpose for creating this osi model? why it is a layered model?
    * What is layer-3 switch?
    * What is an email client? what is differnce between email client and web mail?
    * what is the vlan ? how it is work?
    * Name three network tools used to determine where a network connectivity is lost between two sites A&B.
    * Which protocol is used for retrieving mails?
    * What is piggy backing?
    * What is the default subnet mask for an ipv6 address ?
    * What is fragmentation of a packet ?
    * What is MTU of a link ?
    * Name any field of IP header that can prevent a packet to loop infinitely ?
    * Under what situations a packet can go into infinite loop in a network ?
    * Describe a 3-way TCP/IP Handshake.

    100 linux administration interview questions

    1. You attempt to use shadow passwords but are unsuccessful. What characteristic of the /etc/passwd file may cause this? Choose one: a. The login command is missing. b. The username is too long. c. The password field is blank. d. The password field is prefaced by an asterick.
    2. You create a new user account by adding the following line to your /etc/passwd file. bobm:baddog:501:501:Bob Morris:/home/bobm:/bin/bash Bob calls you and tells you that he cannot logon. You verify that he is using the correct username and password. What is the problem? Choose one: a. The UID and GID cannot be identical. b. You cannot have spaces in the line unless they are surrounded with double quotes. c. You cannot directly enter the password; rather you have to use the passwd command to assign a password to the user. d. The username is too short, it must be at least six characters long.
    3. Which of the following tasks is not necessary when creating a new user by editing the /etc/passwd file? Choose one: a. Create a link from the user’s home directory to the shell the user will use. b. Create the user’s home directory c. Use the passwd command to assign a password to the account. d. Add the user to the specified group.
    4. You create a new user by adding the following line to the /etc/passwd file bobm::501:501:Bob Morris:/home/bobm:/bin/bash You then create the user’s home directory and use the passwd command to set his password. However, the user calls you and says that he cannot log on. What is the problem? Choose one: a. The user did not change his password. b. bobm does not have permission to /home/bobm. c. The user did not type his username in all caps. d. You cannot leave the password field blank when creating a new user.
    5. When using useradd to create a new user account, which of the following tasks is not done automatically. Choose one: a. Assign a UID. b. Assign a default shell. c. Create the user’s home directory. d. Define the user’s home directory.
    6. You issue the following command useradd -m bobm But the user cannot logon. What is the problem? Choose one: a. You need to assign a password to bobm’s account using the passwd command. b. You need to create bobm’s home directory and set the appropriate permissions. c. You need to edit the /etc/passwd file and assign a shell for bobm’s account. d. The username must be at least five characters long.
    7. You have created special configuration files that you want copied to each user’s home directories when creating new user accounts. You copy the files to /etc/skel. Which of the following commands will make this happen? Choose one: a. useradd -m username b. useradd -mk username c. useradd -k username d. useradd -Dk username
    8. Mary has recently gotten married and wants to change her username from mstone to mknight. Which of the following commands should you run to accomplish this? Choose one: a. usermod -l mknight mstone b. usermod -l mstone mknight c. usermod -u mknight mstone d. usermod -u mstone mknight
    9. After bob leaves the company you issue the command userdel bob. Although his entry in the /etc/passwd file has been deleted, his home directory is still there. What command could you have used to make sure that his home directory was also deleted? Choose one: a. userdel -m bob b. userdel -u bob c. userdel -l bob d. userdel -r bob
    10. All groups are defined in the /etc/group file. Each entry contains four fields in the following order. Choose one: a. groupname, password, GID, member list b. GID, groupname, password, member list c. groupname, GID, password, member list d. GID, member list, groupname, password
    11. You need to create a new group called sales with Bob, Mary and Joe as members. Which of the following would accomplish this? Choose one: a. Add the following line to the /etc/group file: sales:44:bob,mary,joe b. Issue the command groupadd sales. c. Issue the command groupadd -a sales bob,mary,joe d. Add the following line to the /etc/group file: sales::44:bob,mary,joe
    12. What command is used to remove the password assigned to a group?
    13. You changed the GID of the sales group by editing the /etc/group file. All of the members can change to the group without any problem except for Joe. He cannot even login to the system. What is the problem? Choose one: a. Joe forgot the password for the group. b. You need to add Joe to the group again. c. Joe had the original GID specified as his default group in the /etc/passwd file. d. You need to delete Joe’s account and recreate it.
    14. You need to delete the group dataproject. Which two of the following tasks should you do first before deleting the group? A. Check the /etc/passwd file to make sure no one has this group as his default group. B. Change the members of the dataproject group to another group besides users. C. Make sure that the members listed in the /etc/group file are given new login names. D. Verify that no file or directory has this group listed as its owner. Choose one: a. A and C b. A and D c. B and C d. B and D
    15. When you look at the /etc/group file you see the group kmem listed. Since it does not own any files and no one is using it as a default group, can you delete this group?
    16. When looking at the /etc/passwd file, you notice that all the password fields contain ‘x’. What does this mean? Choose one: a. That the password is encrypted. b. That you are using shadow passwords. c. That all passwords are blank. d. That all passwords have expired.
    17. In order to improve your system’s security you decide to implement shadow passwords. What command should you use?
    18. What file contains the default environment variables when using the bash shell? Choose one: a. ~/.profile b. /bash c. /etc/profile d. ~/bash
    19. You have created a subdirectory of your home directory containing your scripts. Since you use the bash shell, what file would you edit to put this directory on your path? Choose one: a. ~/.profile b. /etc/profile c. /etc/bash d. ~/.bash
    20. Which of the following interprets your actions when typing at the command line for the operating system? Choose One a. Utility b. Application c. Shell d. Command
    21. What can you type at a command line to determine which shell you are using?
    22. You want to enter a series of commands from the command-line. What would be the quickest way to do this? Choose One a. Press enter after entering each command and its arguments b. Put them in a script and execute the script c. Separate each command with a semi-colon (;) and press enter after the last command d. Separate each command with a / and press enter after the last command
    23. You are entering a long, complex command line and you reach the right side of your screen before you have finished typing. You want to finish typing the necessary commands but have the display wrap around to the left. Which of the following key combinations would achieve this? Choose One a. Esc, /, Enter b. /, Enter c. ctrl-d, enter d. esc, /, ctrl-d
    24. After typing in a new command and pressing enter, you receive an error message indicating incorrect syntax. This error message originated from.. Choose one a. The shell b. The operating system c. The command d. The kernel
    25. When typing at the command line, the default editor is the _____________ library.
    26. You typed the following at the command line ls -al /home/ hadden. What key strokes would you enter to remove the space between the ‘/’ and ‘hadden’ without having to retype the entire line? Choose one a. Ctrl-B, Del b. Esc-b, Del c. Esc-Del, Del d. Ctrl-b, Del
    27. You would like to temporarily change your command line editor to be vi. What command should you type to change it?
    28. After experimenting with vi as your command line editor, you decide that you want to have vi your default editor every time you log in. What would be the appropriate way to do this? Choose one a. Change the /etc/inputrc file b. Change the /etc/profile file c. Change the ~/.inputrc file d. Change the ~/.profile file
    29. You have to type your name and title frequently throughout the day and would like to decrease the number of key strokes you use to type this. Which one of your configuration files would you edit to bind this information to one of the function keys?
    30. In your present working directory, you have the files maryletter memo1 MyTelephoneandAddressBook What is the fewest number of keys you can type to open the file MyTelephoneandAddressBook with vi? Choose one a. 6 b. 28 c. 25 d. 4
    31. A variable that you can name and assign a value to is called a _____________ variable.
    32. You have installed a new application but when you type in the command to start it you get the error message Command not found. What do you need to do to fix this problem? Choose one a. Add the directory containing the application to your path b. Specify the directory’s name whenever you run the application c. Verify that the execute permission has been applied to the command. d. Give everyone read, write and execute permission to the application’s directory.
    33. You telnet into several of your servers simultaneously. During the day, you sometimes get confused as to which telnet session is connected to which server. Which of the following commands in your .profile file would make it obvious to which server you are attached? Choose one a. PS1=’\h: \w>’ b. PS1=’\s: \W>’ c. PS1=’\!: \t>’ d. PS1=’\a: \n>’
    34. Which of the following environment variables determines your working directory at the completion of a successful login? Choose one a. HOME b. BASH_ENV c. PWD d. BLENDERDIR
    35. Every time you attempt to delete a file using the rm utility, the operating system prompts you for confirmation. You know that this is not the customary behavior for the rm command. What is wrong? Choose one a. rm has been aliased as rm -i b. The version of rm installed on your system is incorrect. c. This is the normal behavior of the newest version of rm. d. There is an incorrect link on your system.
    36. You are running out of space in your home directory. While looking for files to delete or compress you find a large file called .bash_history and delete it. A few days later, it is back and as large as before. What do you need to do to ensure that its size is smaller? Choose one a. Set the HISTFILESIZE variable to a smaller number. b. Set the HISTSIZE to a smaller number. c. Set the NOHISTFILE variable to true. d. Set the HISTAPPEND variable to true.
    37. In order to display the last five commands you have entered using the history command, you would type ___________.
    38. In order to display the last five commands you have entered using the fc command, you would type ___________.
    39. You previously ran the find command to locate a particular file. You want to run that command again. What would be the quickest way to do this? Choose one a. fc -l find fc n b. history -l find history n c. Retype the command d. fc -n find
    40. Using command substitution, how would you display the value of the present working directory? Choose one a. echo $(pwd) b. echo pwd c. $pwd d. pwd | echo
    41. You need to search the entire directory structure to locate a specific file. How could you do this and still be able to run other commands while the find command is still searching for your file? Choose one a. find / -name filename & b. find / -name filename c. bg find / -name filename d. &find / -name filename &
    42. In order to create a file called DirContents containing the contents of the /etc directory you would type ____________.
    43. What would be displayed as the result of issuing the command ps ef? Choose one a. A listing of the user’s running processes formatted as a tree. b. A listing of the stopped processes c. A listing of all the running processes formatted as a tree. d. A listing of all system processes formatted as a tree.
    44. What utility can you use to show a dynamic listing of running processes? __________
    45. The top utility can be used to change the priority of a running process? Another utility that can also be used to change priority is ___________?
    46. What key combination can you press to suspend a running job and place it in the background?
    47. You issue the command jobs and receive the following output: [1]- Stopped (tty output) pine [2]+ Stopped (tty output) MyScript How would you bring the MyScript process to the foreground? Choose one: a. fg %2 b. ctrl-c c. fg MyScript d. ctrl-z
    48. You enter the command cat MyFile | sort > DirList & and the operating system displays [4] 3499 What does this mean? Choose one a. This is job number 4 and the PID of the sort command is 3499. b. This is job number 4 and the PID of the job is 3499. c. This is job number 3499 and the PID of the cat command is 4. d. This is job number 4 and the PID of the cat command is 3499.
    49. You attempt to log out but receive an error message that you cannot. When you issue the jobs command, you see a process that is running in the background. How can you fix this so that you can logout? Choose one a. Issue the kill command with the PID of each running command of the pipeline as an argument. b. Issue the kill command with the job number as an argument. c. Issue the kill command with the PID of the last command as an argument. d. Issue the kill command without any arguments.
    50. You have been given the job of administering a new server. It houses a database used by the sales people. This information is changed frequently and is not duplicated anywhere else. What should you do to ensure that this information is not lost? Choose one a. Create a backup strategy that includes backing up this information at least daily. b. Prepare a proposal to purchase a backup server c. Recommend that the server be made part of a cluster. d. Install an additional hard drive in the server.
    51. When planning your backup strategy you need to consider how often you will perform a backup, how much time the backup takes and what media you will use. What other factor must you consider when planning your backup strategy? _________
    52. Many factors are taken into account when planning a backup strategy. The one most important one is how often does the file ____________.
    53. Which one of the following factors does not play a role in choosing the type of backup media to use? Choose one: a. How frequently a file changes b. How long you need to retain the backup c. How much data needs to be backed up d. How frequently the backed up data needs to be accessed
    54. When you only back up one partition, this is called a ______ backup. Choose one a. Differential b. Full c. Partial d. Copy
    55. When you back up only the files that have changed since the last backup, this is called a ______ backup. Choose one a. Partial b. Differential c. Full d. Copy
    56. The easiest, most basic form of backing up a file is to _____ it to another location.
    57. When is the most important time to restore a file from your backup? Choose one a. On a regular scheduled basis to verify that the data is available. b. When the system crashes. c. When a user inadvertently loses a file. d. When your boss asks to see how restoring a file works.
    58. As a system administrator, you are instructed to backup all the users’ home directories. Which of the following commands would accomplish this? Choose one a. tar rf usersbkup home/* b. tar cf usersbkup home/* c. tar cbf usersbkup home/* d. tar rvf usersbkup home/*
    59. What is wrong with the following command? tar cvfb / /dev/tape 20 Choose one a. You cannot use the c option with the b option. b. The correct line should be tar -cvfb / /dev/tape20. c. The arguments are not in the same order as the corresponding modifiers. d. The files to be backed up have not been specified.
    60. You need to view the contents of the tarfile called MyBackup.tar. What command would you use? __________
    61. After creating a backup of the users’ home directories called backup.cpio you are asked to restore a file called memo.ben. What command should you type?
    62. You want to create a compressed backup of the users’ home directories so you issue the command gzip /home/* backup.gz but it fails. The reason that it failed is that gzip will only compress one _______ at a time.
    63. You want to create a compressed backup of the users’ home directories. What utility should you use?
    64. You routinely compress old log files. You now need to examine a log from two months ago. In order to view its contents without first having to decompress it, use the _________ utility.
    65. Which two utilities can you use to set up a job to run at a specified time? Choose one: a. at and crond b. atrun and crontab c. at and crontab d. atd and crond
    66. You have written a script called usrs to parse the passwd file and create a list of usernames. You want to have this run at 5 am tomorrow so you can see the results when you get to work. Which of the following commands will work? Choose one: a. at 5:00 wed usrs b. at 5:00 wed -b usrs c. at 5:00 wed -l usrs d. at 5:00 wed -d usrs
    67. Several of your users have been scheduling large at jobs to run during peak load times. How can you prevent anyone from scheduling an at job? Choose one: a. delete the file /etc/at.deny b. create an empty file called /etc/at.deny c. create two empty files: /etc/at.deny and /etc/at.allow file d. create an empty file called /etc/at.allow
    68. How can you determine who has scheduled at jobs? Choose one: a. at -l b. at -q c. at -d d. atwho
    69. When defining a cronjob, there are five fields used to specify when the job will run. What are these fields and what is the correct order? Choose one: a. minute, hour, day of week, day of month, month b. minute, hour, month, day of month, day of week c. minute, hour, day of month, month, day of week d. hour, minute, day of month, month, day of week
    70. You have entered the following cronjob. When will it run? 15 * * * 1,3,5 myscript Choose one: a. at 15 minutes after every hour on the 1st, 3rd and 5th of each month. b. at 1:15 am, 3:15 am, and 5:15 am every day c. at 3:00 pm on the 1st, 3rd, and 5th of each month d. at 15 minutes after every hour every Monday, Wednesday, and Friday
    71. As the system administrator you need to review Bob’s cronjobs. What command would you use? Choose one: a. crontab -lu bob b. crontab -u bob c. crontab -l d. cronq -lu bob
    72. In order to schedule a cronjob, the first task is to create a text file containing the jobs to be run along with the time they are to run. Which of the following commands will run the script MyScript every day at 11:45 pm? Choose one: a. * 23 45 * * MyScript b. 23 45 * * * MyScript c. 45 23 * * * MyScript d. * * * 23 45 MyScript
    73. Which daemon must be running in order to have any scheduled jobs run as scheduled? Choose one: a. crond b. atd c. atrun d. crontab
    74. You want to ensure that your system is not overloaded with users running multiple scheduled jobs. A policy has been established that only the system administrators can create any scheduled jobs. It is your job to implement this policy. How are you going to do this? Choose one: a. create an empty file called /etc/cron.deny b. create a file called /etc/cron.allow which contains the names of those allowed to schedule jobs. c. create a file called /etc/cron.deny containing all regular usernames. d. create two empty files called /etc/cron.allow and /etc/cron.deny
    75. You notice that your server load is exceptionally high during the hours of 10 am to 2 noon. When investigating the cause, you suspect that it may be a cron job scheduled by one of your users. What command can you use to determine if your suspicions are correct? Choose one: a. crontab -u b. crond -u c. crontab -l d. crond -l
    76. One of your users, Bob, has created a script to reindex his database. Now he has it scheduled to run every day at 10:30 am. What command should you use to delete this job. Choose one: a. crontab -ru bob b. crontab -u bob c. crontab -du bob d. crontab -lu bob
    77. What daemon is responsible for tracking events on your system?
    78. What is the name and path of the default configuration file used by the syslogd daemon?
    79. You have made changes to the /etc/syslog.conf file. Which of the following commands will cause these changes to be implemented without having to reboot your computer? Choose one: a. kill SIGHINT `cat /var/run/` b. kill SIGHUP `cat /var/run/` c. kill SIGHUP syslogd d. kill SIGHINT syslogd
    80. Which of the following lines in your /etc/syslog.conf file will cause all critical messages to be logged to the file /var/log/critmessages? Choose one: a. *.=crit /var/log/critmessages b. *crit /var/log/critmessages c. *=crit /var/log/critmessages d. *.crit /var/log/critmessages
    81. You wish to have all mail messages except those of type info to the /var/log/mailmessages file. Which of the following lines in your /etc/syslogd.conf file would accomplish this? Choose one: a. mail.*;mail!=info /var/log/mailmessages b. mail.*;mail.=info /var/log/mailmessages c. mail.*; /var/log/mailmessages d. mail.*;mail.!=info /var/log/mailmessages
    82. What is the name and path of the main system log?
    83. Which log contains information on currently logged in users? Choose one: a. /var/log/utmp b. /var/log/wtmp c. /var/log/lastlog d. /var/log/messages
    84. You have been assigned the task of determining if there are any user accounts defined on your system that have not been used during the last three months. Which log file should you examine to determine this information? Choose one: a. /var/log/wtmp b. /var/log/lastlog c. /var/log/utmp d. /var/log/messages
    85. You have been told to configure a method of rotating log files on your system. Which of the following factors do you not need to consider? Choose one: a. date and time of messages b. log size c. frequency of rotation d. amount of available disk space
    86. What utility can you use to automate rotation of logs?
    87. You wish to rotate all your logs weekly except for the /var/log/wtmp log which you wish to rotate monthly. How could you accomplish this. Choose one: a. Assign a global option to rotate all logs weekly and a local option to rotate the /var/log/wtmp log monthly. b. Assign a local option to rotate all logs weekly and a global option to rotate the /var/log/wtmp log monthly. c. Move the /var/log/wtmp log to a different directory. Run logrotate against the new location. d. Configure logrotate to not rotate the /var/log/wtmp log. Rotate it manually every month.
    88. You have configured logrotate to rotate your logs weekly and keep them for eight weeks. You are running our of disk space. What should you do? Choose one: a. Quit using logrotate and manually save old logs to another location. b. Reconfigure logrotate to only save logs for four weeks. c. Configure logrotate to save old files to another location. d. Use the prerotate command to run a script to move the older logs to another location.
    89. What command can you use to review boot messages?
    90. What file defines the levels of messages written to system log files?
    91. What account is created when you install Linux?
    92. While logged on as a regular user, your boss calls up and wants you to create a new user account immediately. How can you do this without first having to close your work, log off and logon as root? Choose one: a. Issue the command rootlog. b. Issue the command su and type exit when finished. c. Issue the command su and type logoff when finished. d. Issue the command logon root and type exit when finished.
    93. Which file defines all users on your system? Choose one: a. /etc/passwd b. /etc/users c. /etc/password d. /etc/user.conf
    94. There are seven fields in the /etc/passwd file. Which of the following lists all the fields in the correct order? Choose one: a. username, UID, GID, home directory, command, comment b. username, UID, GID, comment, home directory, command c. UID, username, GID, home directory, comment, command d. username, UID, group name, GID, home directory, comment
    95. Which of the following user names is invalid? Choose one: a. Theresa Hadden b. thadden c. TheresaH d. T.H.
    96. In order to prevent a user from logging in, you can add a(n) ________at the beginning of the password field.
    97. The beginning user identifier is defined in the _________ file.
    98. Which field is used to define the user’s default shell?
    99. Bob Armstrong, who has a username of boba, calls to tell you he forgot his password. What command should you use to reset his command?
    100. Your company has implemented a policy that users’ passwords must be reset every ninety days. Since you have over 100 users you created a file with each username and the new password. How are you going to change the old passwords to the new ones? Choose one: a. Use the chpasswd command along with the name of the file containing the new passwords. b. Use the passwd command with the -f option and the name of the file containing the new passwords. c. Open the /etc/passwd file in a text editor and manually change each password. d. Use the passwd command with the -u option.

    How does DNS work step by step

    ZoneEdit.Com : Simplified example of how DNS works
     Client enters a domain name ( into his browser
    The browser contacts the Client's ISP for the IP address of the domain name
    The ISP first tries to answer by itself using "cached" data.
    the answer is found it is returned. Since the ISP isn't in charge of the DNS, and is just acting as a "dns relay", the answer is marked "non-authoritative"
    If the answer isn't found, or it's too old (past the TTL), then the ISP DNS contacts the nameservers for the domain directly for the answer.
    If the nameservers are not known, the ISP's looks for the information at the 'root servers', or 'registry servers'. For com/net/org, these start with
    NOTE: The 'whois' information is never used for DNS, and is often misleading and inaccurate

    Installing and Configuring Monit Step by Stepm

    install and configure monit

    apt-get install monit

    Monit Configuration file is  /etc/monit/monitrc

    Now make the list of services you want to monitor 

    for example sshd,apache,Mysql 

    Now for monit web interface the default port number is 2812

    Now let us configure the monit 

    vi /etc/monit/monitrc
    set daemon  60    // time interval of the daemon
    set logfile syslog facility log_daemon
    set mailserver localhost
    set mail-format { from: }
    set alert root@localhost // mail id to send email alerts
    set httpd port 2812 and  // If you want to chang port number change here better leave it default
         SSL ENABLE          // for SSL
         PEMFILE  /var/certs/monit.pem   // SSL certificate location
         allow admin:test                // user name and password Basic Auth
    // monitoring sshd
    check process sshd with pidfile /var/run/
       start program  "/etc/init.d/ssh start"
       stop program  "/etc/init.d/ssh stop"
       if failed port 22 protocol ssh then restart
       if 5 restarts within 5 cycles then timeout
    // monitoring mysql
    check process mysql with pidfile /var/run/mysqld/
       group database
       start program = "/etc/init.d/mysql start"
       stop program = "/etc/init.d/mysql stop"
       if failed host port 3306 then restart
       if 5 restarts within 5 cycles then timeout
    // monitoring apache
    check process apache with pidfile /var/run/
       group www
       start program = "/etc/init.d/apache2 start"
       stop program  = "/etc/init.d/apache2 stop"
       if failed host port 80 protocol http
          and request "/monit/token" then restart
    here monit tries to connect on port 80 and tries to access a file
    the actual location of /monit/token is 
    as our website document root is   
    if monit cannot access this file it means apache is not runnig so it will
    restart apache.
    Creation of token is given below  
       if cpu is greater than 60% for 2 cycles then alert
       if cpu > 80% for 5 cycles then restart
       if totalmem > 500 MB for 5 cycles then restart
       if children > 250 then restart
       if loadavg(5min) greater than 10 for 8 cycles then stop
       if 3 restarts within 5 cycles then timeout
    you can add your custom process for 
    monitoring here


    Creation of token
    &lt;a href=";sec=article;fold=below;tile=3;sz=300x250;ord=123456789?" target="_blank"&gt;&lt;img src=";sec=article;fold=below;tile=3;sz=300x250;ord=123456789?" width="300" height="250" border="0" alt=""&gt;&lt;/a&gt;

    mkdir /var/www/

    echo "hello" > /var/www/ 

    Creation of SSL-encrypted monit web interface

    (  /var/certs/monit.pem  )

    openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem
    openssl gendh 512 >> /var/certs/monit.pem
    openssl x509 -subject -dates -fingerprint -noout -in /var/certs/monit.pem
    chmod 700 /var/certs/monit.pem 

    then we need to configure OpenSSL configuration file to create our certificate 
    vi /var/certs/monit.cnf

    example file is  
    # create RSA certs - Server
    RANDFILE = ./openssl.rnd
    [ req ]
    default_bits = 1024
    encrypt_key = yes
    distinguished_name = req_dn
    x509_extensions = cert_type
    [ req_dn ]
    countryName = Country Name (2 letter code)
    countryName_default = MO
    stateOrProvinceName             = State or Province Name (full name)
    stateOrProvinceName_default     = Monitoria
    localityName                    = Locality Name (eg, city)
    localityName_default            = Monittown
    organizationName                = Organization Name (eg, company)
    organizationName_default        = Monit Inc.
    organizationalUnitName          = Organizational Unit Name (eg, section)
    organizationalUnitName_default  = Dept. of Monitoring Technologies
    commonName                      = Common Name (FQDN of your server)
    commonName_default              =
    emailAddress                    = Email Address
    emailAddress_default            =
    [ cert_type ]
    nsCertType = server
    enable monit daemon now
    in this file set startup =1 and interval for running the monit daemon
    example file is below 
    # Defaults for monit initscript
    # sourced by /etc/init.d/monit
    # installed at /etc/default/monit by maintainer scripts
    # Fredrik Steen 
    # You must set this variable to for monit to start
    # To change the intervals which monit should run uncomment
    # and change this variable.
    now let us start monit
    /etc/init.d/monit start  
    Now point your browser to
     (make sure port 2812 is not blocked by your firewall), log in with admin and test 
    as specified in /etc/monit/monitrc