Frequent asked Linux Interview Question & Answer

Linux Tips:

  • Image file should be copied with the command dd.
  • Installation client server command in text mode – linux askmethod
  • /usr/bin/setup – command to change settings in mouse, network, printer, keyboard, firewall.etc
  • redhat-config-network- command to change setting in network configuration.
  • redhat-config-services- command to see sevices.
  • ls X* – to show all files starting with X.
  • xclock –display localhost:0.0  – command to display localhost clock
  • xeyes –display localhost:0.0- geometry 100*100-0+0 &
  • kcontrol & – command to change the desktop graphic change
  • Switchdesk  kde  or  Switchdesk gnome  to switch desktop
  • gnome–  to show all gnome results
  • gnome-search-tool  to search any file
  • ls /usr/bin : more  – show all command in rescue mode.
  • ls  /usr/sbin
  • fdisk –l     command to show all hard drive.
  • redhat-config-users
  • cat  /etc/group
  • usermod  -G  project X  perry  here we adding perry the group
  • quotacheck – avcm    – command to check how much diskspace using
  • edquota  user
  • edquota –t
  • useradd –D  to see user default configuration
  • uname –r  command to see kernel versions
  • cat /proc/cpuinfo  –  Command to show processor
  • ls /tmp/ker*  – command to show kernel version
  • cat /etc/grub.conf – command to show configuration file
  • uname –r  to see kernel version
  • less /etc/httpd/conf/httpd.conf    command for apache web server.
  • dig-  dig is a way to conversion of hostname to ip address  and same in opposite way.
  • There are a number of shells including bash, ksh, sh, zsh and csh. They are all very similar in features, but differ in semantics and scripting languages. The most common (from my experience) is bash which is heavy in features and included with almost all distributions.

Linux Interview Questions

Question:

What command is used to remove the password assigned to a group?  –

Answer: gpasswd -r

The gpasswd command is used to change the password assigned to a group. Use the -r option to remove the password from the group.

passwd -d <groupname>

Question:

What is the minimum number of partitions you need to install Linux? What command can you use to review boot messages?

USR.OPT, ROOT, BOOT, SWAP,

Question:

Which file defines all users on your system? Choose one: a. /etc/passwd b. /etc/users c. /etc/password d. /etc/user.conf

Answer: a

The /etc/passwd file contains all the information on users who may log into your system. If a user account is not contained in this file, then the

Describe the boot process of your favorite Linux in as much detail as you can.

Answer: Booting process : first BIOS loads the boot loaders, then boot loaders loads the kernel , then kernel mount the file systems and drivers installation will takes place and in it will be loaded.

Question:

What is kernel updation?

Answers: kernel updation is a process to upgrade the kernel file with a new or latest version of kernel & use of them as a default kernel.

Question:

What command can you use to review boot messages?

Answer: dmesg

Question:

The dmesg command displays the system messages contained in the kernel ring buffer. By using this command immediately after booting your computer, you will see the boot messages.

1. What command you execute to display the last five commands you have entered?

2. Which partitions might you creates on mail server HDDs other than the root, swap and boot partitions?

3. Which partitioning tool is available in all distributions?

4. Which two commands can you use to delete directories?

5. Which file defines all users on your system?

Answers:

1. history|tail -5

2. /var

3. fdisk, parted

4. rm, rmdir

5. /etc/passwd

Question:

What is difference between user right and user permission?

Answer:  user rights is that user is authorized to use password. If his password/file/dir is expired he is not able to login

Answer

user permission: permission is user is permitted to use file/directory. that is authentication

If he is authentication for particular file or not.

Question:

What is contained in the directory /proc? Choose one: a. System information b. Administrative procedures c. Boot procedures d. Documentation on your system

Answer: a

The /proc directory is a virtual filesystem that contains system information.

Question:

You are installing Linux into a computer with two IDE hard drives. You plan on dividing each hard drive into two partitions. What are the names of the partitions? Choose one: a. hda1, hda2, hda3, hda4

b. hda1, hda2, hdb1, hdb2

c. sda1, sda2, sdb1, sdb2

d. sda1, sda2, sda3, sda4

Answer: b

Question:

The first letter of the partition names refers to the controller type: ‘h’ for ide and ‘s’ for SCSI. The third letter refers to which disk: ‘a’ for first, ‘b’ for second, etc., and the number refers to which partition: ‘1’ for first, ‘2’ for second, etc.

In order to improve your system’s security you decide to implement shadow passwords. What command should you use?

Answer: pwconv

The pwconv command creates the file /etc/shadow and changes all passwords to ‘x’ in the /etc/passwd file.

/etc/passwd file already exists there.

So, give passwords by “passwd”

Question:

You wish to print the file vacations with 60 lines to a page. Which of the following commands will accomplish this? Choose one: a. pr -l60 vacations | lpr b. pr -f vacations | lpr c. pr -m vacations | lpr d. pr -l vacations | lpr

Answer: a

The default page length when using pr is 66 lines. The -l option is used to specify a different length.

You want to print out a text file called vacations however the lines are of varying length. What text filter could you use to even out the length of the lines?

Answer: fmt

The fmt text utility attempts to make all the lines the same length by joining or splitting lines.

Question:

You have a technician who will come in after hours to install new hardware in your system. You do not want to give him the root password, but he needs to be able to shutdown the system. How can you accomplish this? Choose one: a. you cannot do this; only root can run the shutdown command. b. Add his username to the /etc/shutdown.conf file. c. Add his username to the /etc/shutdown.allow file. d. Give him the root password and change it when you arrive the next morning.

Answer: c

Any user who is listed in the /etc/shutdown.allow file will be able to run the shutdown command without being root.

Question:

You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose?

Answer: whatis

The whatis command displays a summary line from the man page for the specified command.

We can use man and info commands

Question:

What utility can you use to show a dynamic listing of running processes?

Answer: top

The top utility shows a listing of all running processes that is dynamically updated.

top utility is used.

but ps -ef command can also be used .

Question:

What command would you type to use the cpio to create a backup called backup.cpio of all the user’s home directories? _____________

Answer: find /home | cpio -o > backup.cpio

The find command is used to create a list of the files and directories contained in home. This list is then piped to the cpio utility as a list of files to include and the output is saved to a file called backup.cpio.

Question:

What file defines the levels of messages written to system log files?

Answer: kernel.h

To determine the various levels of messages that are defined on your system, examine the kernel.h file.

You want to create a compressed backup of the users’ home directories. What utility should you use?

Answer: tar

You can use the z modifier with tar to compress your archive at the same time as creating it.

tar -zcvf filename.tgz file1 file2

This command is used to take a compress backup

Question:

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.

Answer: zcat

The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.

grep is preffered over zcat

Question:

You are covering for another system administrator and one of the users asks you to restore a file for him. You locate the correct tarfile by checking the backup log but do not know how the directory structure was stored. What command can you use to determine this?

Choose one:

a. tar fx tarfile dirname

b. tar tvf tarfile filename

c. tar ctf tarfile

d. tar tvf tarfile

Answer: d

The t switch will list the files contained in the tarfile. Using the v modifier will display the stored directory structure.

Question:

You suspect that you have two commands with the same name as the command is not producing the expected results. What command can you use to determine the location of the command being run?

Answer: which

The which command searches your path until it finds a command that matches the command you are looking for and displays its full path

Question:

What account is created when you install Linux?

Answer: root

Whenever you install Linux, only one user account is created. This is the superuser account also known as root.

Question:

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 ___________?

Answer: nice

Both the top and nice utilities provide the capability to change the priority of a running process.

nice can be used.

For already existing process, renice is used.

Question:

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?

Answer: passwd boba

The passwd command is used to change your password. If you do not specify a username, your password will be changed.

passwd -d boba

This command however disables the existing passwd and boba can login and issue the same command

$passwd

to set his password

Question:

What would you type to send the last 20 lines of a text file to STDIN?

A) end -n 20 filename

B) last -n 20 filename

C) head -20 filename

D) end -20 filename

E) tail -20 filename

Answer: E – Use the command tail -20 filename to see the last 20 lines of a file. The answers for a and d both point to an invalid command. The answer for b points to a valid command. Typing this answer in with a valid file name will even give you some output. However, the last command tells you who is logged in, it does not actually list the contents of any file named in the command. The answer for c, the head command, is used to look at the beginning of a file, not the end.

Question:

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.

Answer: b

You can use the su command to imitate any user including root. You will be prompted for the password for the root account. Once you have provided it you are logged in as root and can do any administrative duties.

Question:

In order to prevent a user from logging in, you can add a(n) ________at the beginning of the password field.

Answer: asterick

If you add an asterick at the beginning of the password field in the /etc/passwd file, that user will not be able to log in.

You can also use

passwd -l with the username to lock his account.

Question:

You have a file called phone nos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long?

Answer: split

The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.

Question:

You have the /var directory on its own partition. You have run out of space. What should you do?

Choose one:

a. Reconfigure your system to not write to the log files.

b. Use fips to enlarge the partition.

c. Delete all the log files.

d. Delete the partition and recreate it with a larger size.

Answer: d

The only way to enlarge a partition is to delete it and recreate it. You will then have to restore the necessary files from backup.

If we feel that we may need to enlarge the partition in future then we can use LVM partitions

LVM partitions can be used to enlarge to reduce the partitions

LVM can be used with RAID too

We can also redirect the log files path, so we can store log files on any other partition or on any other system

Question:

You changed /etc/lilo.conf to cause a boot: prompt to show, however, when you restart your computer you still do not have a prompt. What should you do?

Choose one:

a. Rename your configuration file to /etc/lilo.conf.new.

b. Install the configuration changes by issuing the command /sbin/lilo

c. Install the configuration changes by issuing the command /sbin/lilo -t

d. Install the configuration changes by issuing the command /sbin/lilo –u

Answer: b

You have to reinstall LILO in order for any configuration changes to take effect. This is done by running /sbin/lilo without any options.

INSTALL LILO RPM

AND CHANGE THE DEFAULT OPTION TO

1 FROM 0 IN GRUB FILE

Question:

What is difference between AT and CRON?

Answers:

cron can be set only for a particular time but at is used to schedule and execute.

Question:

Where are the startup scripts defined?

Choose one:

a. /etc/initd

b. /etc/scripts

c. /etc/start

d. /etc/inittab

Answer: d

The /etc/inittab defines which start up scripts to run at each runlevel.

inittab defines the run level but not

the startup scripts.

In the dir. init.d there are different directorys according to run levels where we can define startup scripts.

Question:

Which file do you need to change to alter how the updatedb database is created?

Choose one:

a. /etc/which.conf

b. /etc/conf.updatedb

c. /etc/updatedb.conf

d. /etc/conf.which

Answer: c

The /etc/updatedb.conf file is used to manage the creation of the updatedb database.

In Linux How to exclude ip from the given range please help me out

Type system-config-network and configure.

Question:

You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type?

Answer: tar xf MyBackup.tar memo.ben

This command uses the x switch to extract a file. Here the file memo.ben will be restored from the tarfile MyBackup.tar.

Question:

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?

Answer:

cpio -if backup.cpio memo.ben

The i tells cpio to extract, F specifies the archive to examine and the file to extract is memo.ben.

Question:

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

Answer: a

This command will run the script usrs at 5 am tomorrow (which in this case is Wednesday).

Question :

What is the name and path of the main system log?

Answer: /var/log/messages

By default, the main system log is /var/log/messages.

Question :

What utility can you use to automate rotation of logs?

Answer: logrotate

The logrotate command can be used to automate the rotation of various logs.

Question :

The maximum size of the swap partition is _______ MB.

Answer: 128

Although the maximum size for a swap partition is 128 MB, you can have multiple swap partitions.

Question :

You are going to reboot your system but want to warn your users to log off. Which of the following commands will send a message to the users.

Choose one:

a. init

b. halt

c. reboot

d. shutdown

Answer: d

The shutdown command will send a warning message to your users before bringing the system down. Neither the reboot or halt command send messages before stopping the system.

Question :

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.

Answer: b

The ‘x’ indicates that passwords are stored in the /etc/shadow file rather than /etc/passwd.

Question :

What command should you use to check the number of files and disk space used and each user’s defined quotas?

Answer: repquota

The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.

Question :

In order to run fsck on the root partition, the root partition must be mounted as ___________.

Answer: readonly

You cannot run fsck on a partition that is mounted as read-write.

Question :

When you only back up one partition, this is called a ______ backup.

Choose one

a. Differential

b. Full

c. Partial

d. Copy

Answer: c

A partial backup is where you select only a portion of your file hierarchy or a single partition to back up. This is not dependent upon whether or not the file has changed since the last backup.

Question :

What can you type at a command line to determine which shell you are using?

Answer: echo $SHELL

The name and path to the shell you are using is saved to the SHELL environment variable. You can then use the echo command to print out the value of any variable by preceding the variable’s name with $. Therefore,

Typing echo $SHELL will display the name of your shell.

Question:

Where is standard output usually directed?

Answer: to the screen or display

By default, your shell directs standard output to your screen or display.

The Shell’s standard output is CONSOLE

Question:

You copy the administration directory to George’s home directory.

-rw-rw–w- 1 root admin 7202 Sep 17 9:10 administration

The only group that George is a member of  users. He calls you to say he cannot list the contents of the administration directory. Why can’t he look at its contents since it is in his home directory?

Choose one:

a. In order to view the contents of a directory, you must have read permission. George only has write permission.

b. Only the owner of a directory can list its contents.

c. George needs to change his default group to admin.

d. George needs to make himself the owner of the administration directory.

Answer: a

George only has the permissions granted to others which in this case is write. Without the read permission on the directory, he will not be able to list its contents.

Question :

When you issue the command ls -l, the first character of the resulting display represents the file’s ___________.

Answer: type

The first character of the permission block designates the type of file that is being displayed.

Question :

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

Answer: d

This would run at 15 minutes after the hour on every Monday, Wednesday, and Friday of every month no matter what the date

Question :

What command should you use to check your filesystem?

Answer: fsck

The fsck command is used to check the integrity of the filesystem on your disk.

Question :

What key combination can you press to suspend a running job and place it in the background?

Answer: ctrl-z

Using ctrl-z will suspend a job and put it in the background.

Question :

If you type the command cat dog &> cat what would you see on your display?
Choose one:

a. Any error messages only.
b. The contents of the file dog.
c. The contents of the file dog and any error messages.
d. Nothing as all output is saved to the file cat.

Answer: d

When you use &> for redirection, it redirects both the standard output and standard error. The output would be saved to the file cat.

Question :

Which of the following commands can be used to get information about a package?
[Choose all correct answers]

A) man
B) list
C) apropos
D) info
E) more

Answer(s): A, C, D – The man command pulls up man pages, the info command pulls up texinfo pages which have replaced the man pages for some packages, and the apropos command helps you to find related commands. Answers b and e are not methods of getting information about a package

Question :

Can Linux Use More than 3 Serial Ports by Sharing Interrupts?

Yes, but won’t be able to use simultaneously two ordinary ports which share an   interrupt (without some trickery). This is a limitation of the ISA Bus architecture.

Question :

Can Linux Use the Same Hard Drive as MS-DOS? OS/2? 386BSD? Win95?

Yes. Linux supports many, many file systems, including the standard MS-DOS partitioning scheme, so it can share your disk with other operating systems.

Linux supports all known versions of the Microsoft FAT and VFAT file systems, including those used by Windows 95, Windows 98, Windows NT, Windows 2000 and Windows ME through loadable kernel modules. In a correctly configured system, they should load automatically when the partitions are mounted.

Question :

Which command do you use to change run levels?

A) initlevel
B) runlevel
C) level
D) run
E) init

Answer: E – The command used to change runlevels is init. Answers a, c, and d point to invalid commands. Answer b is a valid command, but does not set the current runlevel. The runlevel command displays the current runlevel, and the one that was used directly before entering this one.

Question :

Which of the following commands will show a list of the files in your home directory including hidden files and the contents of all subdirectories?
Choose one:

a. ls -c home
b. ls -aR /home/username
c. ls -aF /home/username
d. ls -l /home/username

Answer: b

The ls command is used to display a listing of files. The -a option will cause hidden files to be displayed as well. The -R option causes ls to recurse down the directory tree. All of this starts at your home directory.

Question :

What file would you edit in your home directory to change which window manager you want to use?

Answer: B – The ~/.xinitrc file allows you to set which window man-ager you want to use when logging in to X from that account. Answers a, d, and e are all invalid files. Answer c is the main X server configuration file.

Question :

Where is a good place to store shell scripts that are for use by the author?

A) ~/bin
B) /bin
C) /usr/bin
D) /root

Answer: A – It is best to keep scripts meant only for your account under ~/bin. Answers b, c, d, and e are all valid locations, but not the best places to keep user-specific scripts.

Question :

What type of local file server can you use to provide the distribution installation materials to the new machine during a network installation?

A) Inetd
B) FSSTND
C) DNS
D) NNTP
E) NFS

Answer: E – You can use an NFS server to provide the distribution installation materials to the machine on which you are performing the installation. Answers a, b, c, and d are all valid items but none of them are file servers. Inetd is the superdaemon which controls all intermittently used network services. The FSSTND is the Linux File System Standard. DNS provides domain name resolution, and NNTP is the transfer protocol for usenet news.

Question :

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.

Answer: a

This would show the parent child relationship of all the user’s processes.

#ps ef

(no dash between command and arguments)
#ps -ef
(There “is a dash” between command and arguments)

Both have entirely different outputs

The first one will display the output with current shell’s some global variables
eg:USER,LOGNAME,HOME,PATH,MAIL,SHELL,SSH_CLIENT,SSH_CONNECTION,SSH_TTY,TERM,LS_COLORS,HOSTNAME,SHELL,HISTSIZE

The second one;
ps with option -e will display all processes in system and -f
will display full information about all running processes

Question :

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.

Answer: c

The password field must not be blank before converting to shadow passwords.

Question :

Which first-level segment of the file system contains a majority of system and server configuration files within its subdirectories?

A) /var
B) /etc
C) /bin
D) /sbin
E) /lib

Answer: B – The /etc portion of the file system contains a number of system and daemon configuration files. Answers a, c, d, and e are valid first-level directories, but are incorrect. The /var directory contains items that change on a regular basis, such as log files and print and mail spool directories. The /bin directory contains system binaries, whereas the /sbin directory contains binaries that run with SUID privileges or as a specific user. The /lib directory contains system libraries, both shared and non-shared.

Question :

Where Is the Latest Kernel Version on the Internet?

The easiest way to update your kernel is to get the update directly from the distribution which you are running.

If you need or want to configure and compile your own kernel, the web page at http://www.kernel.org/ lists the current versions of the development and production kernels.
If you want to download the source code, FTP to ftp.xx.kernel.org, where xx is the two-letter Internet domain abbreviation of your country; e.g., us for United States, ca for Canada, or de for Germany.Kernel versions 2.2.x are archived in the directory pub/linux/kernel/v2.2, as are patches for the released versions. The kernel source code is archived as a .tar.gz file, and as a .tar.bz2 file.
Follow the instructions in any of the standard references to compile the kernel, as you would with any other custom kernel. The Documentation subdirectory contains information by the authors of various subsystems and drivers, and much of that information is not documented elsewhere.

Question :

What is UserLabel Thread?

Answers:

User-level avoids the kernel and manages the tables itself. Often this is called “cooperative multitasking” where the task defines a set of routines that get “switched to” by manipulating the stack pointer. Typically each thread “gives-up” the CPU by calling an explicit switch, sending a signal or doing an operation that involves the switcher. Also, a timer signal can force switches. User threads typically can switch faster than kernel threads

Question :

Many factors are taken into account when planning a backup strategy. The one most important one is how often does the file ____________.

Answer: change

If a file is static and never changes, then you can back it up less frequently. However, if a file changes daily or hourly, then you will want to back it up more frequently to prevent the loss of data.

Question :

What is Kernel-Level Threads?

Answers:

Kernel-level threads often are implemented in the kernel using several tables (each task gets a table of threads). In this case, the kernel schedules each thread within the time slice of each process. There is a little more overhead with mode switching from user->kernel-> user and loading of larger contexts, but initial performance measures indicate a negligible increase in time.

kernel thread is a process that always in kernel mode , it only accesses kernel address spaces , managing kernel activities that need to managed on an ongoing basis .(and not waiting for an interrupt or system call)

Question :

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

Answer: b

The seven fields required for each line in the /etc/passwd file are username, UID, GID, comment, home directory, command. Each of these fields must be separated by a colon even if they are empty.

Question :

Which of the following commands will show a list of the files in your home directory including hidden files and the contents of all subdirectories?

Answers:

The ls command is used to display a listing of files. The -a option will cause hidden files to be displayed as well. The -R option causes ls to recurse down the directory tree. All of this starts at your home directory.

Question :

You have a directory called /home/ben/memos and want to move it to /home/bob/memos so you issue the command mv /home/ben/memos /home/bob. What is the results of this action?
Choose one:

a. The files contained in /home/ben/memos are moved to the directory /home/bob/memos/memos.
b. The files contained in /home/ben/memos are moved to the directory /home/bob/memos.
c. The files contained in /home/ben/memos are moved to the directory /home/bob/.
d. The command fails since a directory called memos already exists in the target directory.

Answer: a

When using the mv command to move a directory, if a directory of the same name exists then a subdirectory is created for the files to be moved.

Question:

Which two documents should you consult before making any final purchasing recommendations?

Answer(s): A, B – The distribution’s hardware compatibility listing and the general Linux hardware compatibility listing. These two documents should be consulted before purchasing any equipment for a Linux box. The simplest way to get things set up is to use hardware covered in the distribution itself. However, if you need something that outside drivers are available for, you will find that kind of information in the general hardware listing. Answers c, d, and e are all premature. Installation, use, and administration instructions are not necessary until you actually get to the point where the system is already installed, which is far after the equipment is procured.

Question:

What is the minimum number of partitions you need to install Linux?

Answer: 2

Linux can be installed on two partitions, one as / which will contain all files and a swap partition.

Only two partitions / and /boot are required, because in

systems which have sufficient RAM you don’t really need the
/swap partition as we all know that the reason for having the swap partition.

Question:- 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.

Answer: a

This would show the parent child relationship of all the user’s processes.

#ps ef

(no dash between command and arguments)
#ps -ef
(There “is a dash” between command and arguments)

Both have entirely different outputs

The first one will display the output with current shell’s some global variables
eg:USER,LOGNAME,HOME,PATH,MAIL,SHELL,SSH_CLIENT,SSH_CONNECTION,SSH_TTY,TERM,LS_COLORS,HOSTNAME,SHELL,HISTSIZE

The second one;
ps with option -e will display all processes in system and -f
will dispaly full information about all running processes

Question:- What command should you type to see all the files with an extension of ‘mem’ listed in reverse alphabetical order in the /home/ben/memos directory.

Answer: ls -r /home/ben/memos/*.mem

The -c option used with ls results in the files being listed in chronological order. You can use wildcards with the ls command to specify a pattern of file names.

Question:- You want to enter a series of commands from the command-line. What would be the quickest way to do this?

Answers:

Separate each command with a semi-colon (;) and press enter after the last command.

The semi-colon may be used to tell the shell that you are entering multiple commands that should be executed serially. If these were commands that you would frequently want to run, then a script might be more efficient. However, to run these commands only once, enter the commands directly at the command line.

Question :

How to exclude ip address in dhcp ?

my ranges are 192.168.1.2 192.168.1.20
then how do i exclude different ip’s like 192.168.1.4 and 7 and 10 from the range
please help me out

Answers:

You will have to use multiple range statements

range 192.168.1.2 192.168.1.20;
range 192.168.1.23 192.168.1.30;
The above will exclude 21 and 22

Question:- 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

Answer: c

When creating a cronjob, the time fields must be entered in the order of minute, hour, day of the month, month and day of the week.

Question:

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

Answer: c

Using the crontab command with the -l option will display all scheduled cron jobs for all users.

Question:

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

Answer: a

As root, you can use crontab to manage any user’s jobs. The -u option is used to specify which user’s jobs you want to act on. The -r option tells crontab to delete the job.

Question:

What is the name and path of the default configuration file used by the syslogd daemon?

Answer: /etc/syslog.conf

If no configuration file is specified when starting syslogd, then it will start up with the configuration specified in the /etc/syslog.conf file.

Question:- 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/syslogd.pid`
b. kill SIGHUP `cat /var/run/syslogd.pid`
c. kill SIGHUP syslogd
d. kill SIGHINT syslogd

Answer: a

When you use kill with the SIGHUP signal, it stops the daemon, rereads the /etc/syslog.conf file, and then starts the syslogd daemon. The last part of the command line extracts the PID for syslogd.

Question:

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. creates 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

Answer: b

The crond daemon will examine the file /etc/cron.allow whenever a user attempts to install a cron job. If that user’s name is not in the file, he will not be able to install the cron job.

Question:

Which daemon must be running in order to have any scheduled jobs run as scheduled?

a. crond

b. atd

c. atrun

d. crontab

 

Answer: a

The crond daemon is responsible for insuring that scheduled jobs run as scheduled. One of its job is to also use atrun to ensure that at jobs are run as well.

Question:- As the system administrator you need to review Bob’s cronjobs. What command would you use?

a. crontab -lu bob
b. crontab -u bob
c. crontab -l
d. cronq -lu bob

Answer: a

The -l option requests a list of jobs from crontab and the -u option is used to specify which user’s jobs you want to see.

Question:

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

Answer: c

You use the at command to schedule a job to run once. The crontab command is used to schedule recurring jobs.

Question:

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.

Answer: file

The gzip utility cannot compress multiple files in a single operation.

Question:

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

Answer: c

This line will run the MyScript script at 23:45 or 11:45 pm every day of every month and every day of the week.

Question:

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

Answer: a

If there is not /etc/at.deny file, then only the superuser or root may schedule at jobs.

Question:

What is the difference between grub and lilo ?

Answer:

LILO is the Linux Loader. GRUB is the Grand Unified Boot Loader. Both do the same job. Each has advantages and disadvantages, but in a general sort of way LILO was most common in the past, but GRUB is most common now.
LILO only loads linux and other boot loaders. and GRUB loads a large number of OS’s.

LILO stores information regarding the location of the operating systems it can to load physically on the MBR. If you change your LILO config file, you have to rewrite the LILO stage one boot loader to the MBR. Compared with GRUB, this is a much more risky option since a misconfigured MBR could leave the system unbootable. With GRUB, if the configuration file is configured incorrectly, it will simply default to the GRUB command-line interface.

* LILO has no interactive command interface, whereas GRUB does.

* LILO does not support booting from a network, whereas GRUB does.

* LILO stores information regarding the location of the operating systems it can to load physically on the MBR. If you change your LILO config file, you have to rewrite the LILO stage one boot loader to the MBR. Compared with GRUB, this is a much more risky option since a misconfigured MBR could leave the system unbootable. With GRUB, if the configuration file is configured incorrectly, it will simply default to the GRUB command-line interface.

* LILO only loads linux and other boot loaders. and GRUB loads a large number of OSs.

* LILO works by loading itself into a space that will fit on the MBR. Grub has two stages (because it’s too overcomplicated to work as well, err I mean as easily as lilo). It loads stage 1 off the MBR (usually) and stage 2 out of /boot, along with it’s config.

Question:

What is difference between RAID & LVM ?

Answer:

RAID is “Redundant Array of Independent Disks”. Think of it in simplest terms, with say RAID and if you have RAID1 setup with two disks, they basically mirror one another.

Disk 1 has 5 partitions and Disk 2 has the same setup. If Disk 1 has a partition failure on say hda2, Disk 2 will pick up and take over.

Its redundant array of disks for better reliability. In more simply terms, both of those disks will mirror one another, so the data is in two locations instead of just one.

LVM on the other hand is a way to spread data or partitions across multiple disks or partitions, etc. Say you have two hard drives, each 80GB, you could with LVM make it look and act like one big disk, instead of having two disks.

RAID is designed for system reliability. Other than RAID0 which is used to make multiple disks appear as one big one, all RAID levels ensure that loss of a disk will not lead to data loss or system crash.

LVM is RAID0 in that you put together multiple disks into one or more volume groups. Then within each volume group you create logical volumes where you build your file systems. The real power of LVM is that if you have unallocated space in your volume group, then you can unmount a logical volume, extend it in size, extend the file system and then remount the logical volume. In the event, that you don’t have free space in the volume group, you can add more disks to your system, use them to extend the volume group’s size and then extend the logical volumes. If you don’t use LVM and you need a filesystem to be bigger, then your only choice is to unmount the filesystem, back it up to tape, resize the partition, and then restore. Depending on the sizes this could take quite awhile.

LVM and RAID solve two different problems, and should be used to provide maximum reliability and maximum flexibility.

LVM is logical volume manager and is used to extend the logical volume if required. it can be max to the size of disk or physical partition.