linux interview questions

Linux Interview Questions and Answers

Q.How are devices represented in UNIX?

Ans: All devices are represented by files called special files that are located in/dev directory. Thus, device files and other files are named and accessed in the same way. A ‘regular file’ is just an ordinary data file in the disk. A ‘block special file’ represents a device with characteristics similar to a disk (data transfer in terms of blocks). A ‘character special file’ represents a device with characteristics similar to a keyboard (data transfer is by stream of bits in sequential order).

Q.What is ‘inode’?

All UNIX files have its description stored in a structure called ‘inode’. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file. If the file is large, inode has indirect pointer to a block of pointers to additional data blocks (this further aggregates for larger files). A block is typically 8k.
Inode consists of the following fields:

  • File owner identifier
  • File type
  • File access permissions
  • File access times
  • Number of links
  • File size
  • Location of the file data

Q.Brief about the directory representation in UNIX

Ans: A Unix directory is a file containing a correspondence between filenames and inodes. A directory is a special file that the kernel maintains. Only kernel modifies directories, but processes can read directories. The contents of a directory are a list of filename and inode number pairs. When new directories are created, kernel makes two entries named ‘.’ (refers to the directory itself) and ‘..’ (refers to parent directory).
System call for creating directory is mkdir (pathname, mode).

Q.What are the Unix system calls for I/O?

Ans:

  • open(pathname,flag,mode) – open file
  • creat(pathname,mode) – create file
  • close(filedes) – close an open file
  • read(filedes,buffer,bytes) – read data from an open file
  • write(filedes,buffer,bytes) – write data to an open file
  • lseek(filedes,offset,from) – position an open file
  • dup(filedes) – duplicate an existing file descriptor
  • dup2(oldfd,newfd) – duplicate to a desired file descriptor
  • fcntl(filedes,cmd,arg) – change properties of an open file
  • ioctl(filedes,request,arg) – change the behaviour of an open file

The difference between fcntl anf ioctl is that the former is intended for any open file, while the latter is for device-specific operations.

Q.How do you change File Access Permissions?

Ans:

Every file has following attributes:
owner’s user ID ( 16 bit integer )
owner’s group ID ( 16 bit integer )
File access mode word

‘r w x -r w x- r w x’

(user permission-group permission-others permission)
r-read, w-write, x-execute
To change the access mode, we use chmod(filename,mode).
Example 1:
To change mode of myfile to ‘rw-rw-r–’ (ie. read, write permission for user – read,write permission for group – only read permission for others) we give the args as:
chmod(myfile,0664) .
Each operation is represented by discrete values

‘r’ is 4
‘w’ is 2
‘x’ is 1

Therefore, for ‘rw’ the value is 6(4+2).
Example 2:
To change mode of myfile to ‘rwxr–r–’ we give the args as:

chmod(myfile,0744).

Q.What are links and symbolic links in UNIX file system?

Ans: A link is a second name (not a file) for a file. Links can be used to assign more than one name to a file, but cannot be used to assign a directory more than one name or link filenames on different computers.
Symbolic link ‘is’ a file that only contains the name of another file.Operation on the symbolic link is directed to the file pointed by the it.Both the limitations of links are eliminated in symbolic links.
Commands for linking files are:

Link ln filename1 filename2
Symbolic link ln -s filename1 filename2

Q.What is a FIFO?

Ans: FIFO are otherwise called as ‘named pipes’. FIFO (first-in-first-out) is a special file which is said to be data transient. Once data is read from named pipe, it cannot be read again. Also, data can be read only in the order written. It is used in interprocess communication where a process writes to one end of the pipe (producer) and the other reads from the other end (consumer).

Q.How do you create special files like named pipes and device files?

Ans: The system call mknod creates special files in the following sequence.
1. kernel assigns new inode,
2. sets the file type to indicate that the file is a pipe, directory or special file,
3. If it is a device file, it makes the other entries like major, minor device numbers.
For example:
If the device is a disk, major device number refers to the disk controller and minor device number is the disk.

Q.Discuss the mount and unmount system calls

Ans: The privileged mount system call is used to attach a file system to a directory of another file system; the unmount system call detaches a file system. When you mount another file system on to your directory, you are essentially splicing one directory tree onto a branch in another directory tree. The first argument to mount call is the mount point, that is , a directory in the current file naming system. The second argument is the file system to mount to that point. When you insert a cdrom to your unix system’s drive, the file system in the cdrom automatically mounts to /dev/cdrom in your system.

Q.How does the inode map to data block of a file?

Ans: Inode has 13 block addresses. The first 10 are direct block addresses of the first 10 data blocks in the file. The 11th address points to a one-level index block. The 12th address points to a two-level (double in-direction) index block. The 13th address points to a three-level(triple in-direction)index block. This provides a very large maximum file size with efficient access to large files, but also small files are accessed directly in one disk read.

Q.What is a shell?

Ans: A shell is an interactive user interface to an operating system services that allows an user to enter commands as character strings or through a graphical user interface. The shell converts them to system calls to the OS or forks off a process to execute the command. System call results and other information from the OS are presented to the user through an interactive interface. Commonly used shells are sh,csh,ks etc.

Q.Brief about the initial process sequence while the system boots up.

While booting, special process called the ‘swapper’ or ‘scheduler’ is created with Process-ID 0. The swapper manages memory allocation for processes and influences CPU allocation. The swapper inturn creates 3 children:

  • the process dispatcher,
  • vhand and
  • dbflush

with IDs 1,2 and 3 respectively.
This is done by executing the file /etc/init. Process dispatcher gives birth to the shell. Unix keeps track of all the processes in an internal data structure called the Process Table (listing command is ps -el).

Q.What are various IDs associated with a process?

Ans: Unix identifies each process with a unique integer called ProcessID. The process that executes the request for creation of a process is called the ‘parent process’ whose PID is ‘Parent Process ID’. Every process is associated with a particular user called the ‘owner’ who has privileges over the process. The identification for the user is ‘UserID’. Owner is the user who executes the process. Process also has ‘Effective User ID’ which determines the access privileges for accessing resources like files.

  • getpid() -process id
  • getppid() -parent process id
  • getuid() -user id
  • geteuid() -effective user id

Q.Explain fork() system call.

Ans: The `fork()’ used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent. We can tell which is which by checking the return value from `fork()’. The parent gets the child’s pid returned to him, but the child gets 0 returned to him.

Q.Predict the output of the following program code

main()
{
fork();
printf(“Hello World!”);
}
Answer:

Hello World!Hello World!
Explanation:

The fork creates a child that is a duplicate of the parent process. The child begins from the fork().All the statements after the call to fork() will be executed twice.(once by the parent process and other by child). The statement before fork() is executed only by the parent process.

Q.Predict the output of the following program code

main()
{
fork(); fork(); fork();
printf(“Hello World!”);
}
Answer:
“Hello World” will be printed 8 times.
Explanation:
2^n times where n is the number of calls to fork()

Q.List the system calls used for process management:

Ans: System calls Description

  • fork() To create a new process
  • exec() To execute a new program in a process
  • wait() To wait until a created process completes its execution
  • exit() To exit from a process execution
  • getpid() To get a process identifier of the current process
  • getppid() To get parent process identifier
  • nice() To bias the existing priority of a process
  • brk() To increase/decrease the data segment size of a process.

Q.How can you get/set an environment variable from a program?

Ans: Getting the value of an environment variable is done by using `getenv()’. Setting the value of an environment variable is done by using `putenv()’.

Q.How can a parent and child process communicate?

Ans: A parent and child can communicate through any of the normal inter-process communication schemes (pipes, sockets, message queues, shared memory), but also have some special ways to communicate that take advantage of their relationship as a parent and child. One of the most obvious is that the parent can get the exit status of the child.

Q.What is a zombie?

Ans: When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it – for example, the parent may need to check the child’s exit status. To be able to get this information, the parent calls `wait()’; In the interval between the child terminating and the parent calling `wait()’, the child is said to be a `zombie’ (If you do `ps’, the child will have a `Z’ in its status field to indicate this.)

Q.What are the process states in Unix?

Ans: As a process executes it changes state according to its circumstances. Unix processes have the following states:
Running : The process is either running or it is ready to run .
Waiting : The process is waiting for an event or for a resource.
Stopped : The process has been stopped, usually by receiving a signal.
Zombie : The process is dead but have not been removed from the process table.

Q.What are MySQL transactions?

Ans: A set of instructions/queries that should be executed or rolled back as a single atomic unit.

Explain multi-version concurrency control in MySQL.

Each row has two additional columns associated with it – creation time and deletion time, but instead of storing timestamps, MySQL stores version numbers.

Explain MySQL locks.

Table-level locks allow the user to lock the entire table, page-level locks allow locking of certain portions of the tables (those portions are referred to as tables), row-level locks are the most granular and allow locking of specific rows.

Explain MySQL architecture.

The front layer takes care of network connections and security authentications, the middle layer does the SQL query parsing, and then the query is handled off to the storage engine. A storage engine could be either a default one supplied with MySQL (MyISAM) or a commercial one supplied by a third-party vendor (ScaleDB, InnoDB, etc.)

Q.List the main applications of 8 bit microprocessors?

Ans: 8 bit microprocessors are used in a variety of applications such as appliances , automobiles ,industrial process and control applications.

Q.What is NV-RAM?

Ans: Nonvolatile Read Write Memory, also called Flash memory. It is also know as shadow RAM

Q.Can ROM be used as stack?

Ans: ROM cannot be used as stack because it is not possible to write to ROM.

Q.What is stack?

Ans: Stack is a portion of RAM used for saving the content of Program Counter and general purpose registers.

Q.What is flag?

Ans: Flag is a flip-flop used to store the information about the status of a processor and the status of the instruction executed most recently

Q.Which processor structure is pipelined?

Ans: All x86 processors have pipelined structure.

Q.What is a compiler?

Ans: Compiler is used to translate the high-level language program into machine code at a time. It doesn’t require special instruction to store in a memory, it stores automatically. The Execution time is less compared to Interpreter.

Q.Differentiate between RAM and ROM?

Ans: RAM: Read / Write memory, High Speed, Volatile Memory. ROM: Read only memory, Low Speed, Non Voliate Memory.

Q.Which transistor is used in each cell of EPROM?

Ans: Floating .gate Avalanche Injection MOS (FAMOS) transistor is used in each cell of EPROM.

Q.What is called .Scratch pad of computer.?

Ans: Cache Memory is scratch pad of computer.

Q.What is cache memory?

Ans: Cache memory is a small high-speed memory. It is used for temporary storage of data & information between the main memory and the CPU (center processing unit). The cache memory is only in RAM.

Q.What is interrupt?

Ans: Interrupt is a signal send by external device to the processor so as to request the processor to perform a particular work.

Q.Difference between static and dynamic RAM?

Ans: Static RAM: No refreshing, 6 to 8 MOS transistors are required to form one memory cell, Information stored as voltage level in a flip flop. Dynamic RAM: Refreshed periodically, 3 to 4 transistors are required to form one memory cell, Information is stored as a charge in the gate to substrate capacitance.

Q.What is the difference between primary & secondary storage device?

Ans: In primary storage device the storage capacity is limited. It has a volatile memory. In secondary storage device the storage capacity is larger. It is a nonvolatile memory. Primary devices are: RAM / ROM. Secondary devices are: Floppy disc / Hard disk.

Q.Why does microprocessor contain ROM chips?

Ans: Microprocessor contain ROM chip because it contain instructions to execute data.

Q.What is meant by LATCH?

Ans: Latch is a D- type flip-flop used as a temporary storage device controlled by a timing signal, which can store 0 or 1. The primary function of a Latch is data storage. It is used in output devices such as LED, to hold the data for display.

Q.What is the difference between microprocessor and microcontroller?

Ans: In Microprocessor more op-codes, few bit handling instructions. But in Microcontroller: fewer op-codes, more bit handling Instructions, and also it is defined as a device that includes micro processor, memory, & input / output signal lines on a single chip.

Q.What is the disadvantage of microprocessor?

Ans: It has limitations on the size of data. Most Microprocessor does not support floating-point operations.

Q.Is the data bus is Bi-directional?

Ans: The data bus is Bi-directional because the same bus is used for transfer of data between Micro Processor and memory or input / output devices in both the direction.

Q.Is the address bus unidirectional?

Ans: The address bus is unidirectional because the address information is always given by the Micro Processor to address a memory location of an input / output devices.

Q.Define HCMOS?

Ans: High-density n- type Complimentary Metal Oxide Silicon field effect transistor.

Q.What is 1st / 2nd / 3rd / 4th generation processor?

Ans: The processor made of PMOS / NMOS / HMOS / HCMOS technology is called 1st / 2nd / 3rd / 4th generation processor, and it is made up of 4 / 8 / 16 / 32 bits.

Q.Why 8085 processor is called an 8 bit processor?

Ans: Because 8085 processor has 8 bit ALU (Arithmetic Logic Review). Similarly 8086 processor has 16 bit ALU.

Q.Give examples for 8 / 16 / 32 bit Microprocessor?

Ans: 8-bit Processor – 8085 / Z80 / 6800; 16-bit Processor – 8086 / 68000 / Z8000; 32-bit Processor – 80386 / 80486.

Q.What is a Microprocessor?

Ans: Microprocessor is a program-controlled device, which fetches the instructions from memory, decodes and executes the instructions. Most Micro Processor is single- chip devices.

 Q.What command would you use to create an empty file without opening it to edit it?

Ans: You use the touch command to create an empty file without needing to open it. Answers a and e point to invalid commands, though either of these might actually be aliased to point to a real command. Answers b and c utilize editors, and so do not satisfy the requirements of the question.

actually touch is used to change the timestamps of a file if its exits, otherwise a new file with current timestamps will be created

Q.Which of the following commands can you use to cleanly restart a Linux machine?

Ans: The commands used to restart a Linux box are shutdown -r, reboot, and init 6. Answers c and e are incorrect. Both of these are used to shut down a Linux box, not restart it.

init 6 command is used to restart the Linux machine .

Q.What do you type to stop a hung process that resists the standard attempts to shut it down?

Ans: The kill command by itself tries to allow a process to exit cleanly. You type kill -9 PID, on the other hand, to abruptly stop a process that will not quit by any other means. Also, pressing Ctrl+C works for many programs. Answers b and d are only valid in some contexts, and even in those contexts will not work on a hung process.

Q.Which command do you use to change run levels?

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

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

Ans: You can use rmdir or rm -rf to delete a directory. Answer a is incorrect, because the rm command without any specific flags will not delete a directory, it will only delete files. Answers d and e point to a non-existent command.

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

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

last choice will be correct answer because only tail command is used to see the last content of any file by default it take 10 line

Q.Which daemon controls the network service -> POP3 mail service?

Ans: The intend super daemon controls the POP3 mail service. The POP3 mail service runs through the super daemon, not on its own. Answers c and e point to nonexistent, or at least nonstandard daemons. Answer d points to the Usenet news

daemon.

Q.Who owns the data dictionary?

Ans: The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created. The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

how we can configure sata hard derive during redhat 9 installation.

Have the data driver on a floppy drive. At the start of installation, when u boot from the CD/DVD, on the prompt, write “dd”. It will ask for the driver floppy later on and will load the sata driver. Then you can configure/partition the drive using disk druid or fdisk

Q.What is difference between AT and CRON?

Ans: Cron command is used to schedule the task daily at the same time repeatedly ,”at” command is used to schedule the task only once i.e. to run only one time.

Q.What is difference between user right and user permission?

Ans: user rights:user rights is that user is authorized to used password. if his password/file/dir is expired he is not able to login

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

if he is authentication for particular file or not.

it might be true as per my suggestion.

Q.What is the real mean of DHCP?

Ans: Dynamic addressing simplifies network administration because the s/w keeps track of IP addresses rather than requiring an administrator to manage the task. That means new computer can be added to the network without any risk of manually assigning unique IP address.

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

Boot process takes place in 4 scenes with 4 main characters.

Scene 1

when the computer

is switched on, it automatically invokes BIOS[a ROM chip embedded in the motherboard].The BIOS will start the processor and perform a POST[power on self test] to check whether the connected device are ready to use and are working properly.

Once the POST is completes BIOS will jump to a specified location in the RAM and check for the booting device. The boot sector is always the first sector of the hard disk and BIOS will load the MBR into the memory.

Scene 2

Here the boot loader takes the control of the booting process.LILO or GRUB is the boot loaders commonly available. It will help the user to select various boot options. Depending on the boot option selected the kernel is loaded.

scene 3

After kernel is loaded the kernel will take the control of the booting process and it will initialize all the hardwares including I/O processors etc.kernel then creates a root device and mounts the partitions.

Scene 4

INIT is loaded.

How to install 8139 realtek drivers in rhel5.0$ Please help me out.

Download the driver from internet.

then just unzip the tarball using tar -zxvf

then for first compile it using make and make install

For proper installation of the driver read the INSTALL / README file given in the tarball.

 Q.You are debugging a new application that is crashing. You want to watch the messages as they are being written to the log. What command should you use?

Ans: The tail command allows you to keep a log open and see each new message as it is written to the log.

Q.Which of the following tasks cannot be accomplished with the touch command?

Ans: The touch command is usually used to modify either a file’s access or modification time. It can also be used to create a new file.

Q.You want to copy the user’s home directories to a new location. Which of the following commands will accomplish this?

Ans: The -r option tells the cp command to recurs the directories. The -P option retains the original permissions.

Q.You read an article that lists the following command: dd if=/dev/fd0 bs=512 of=/new What does this accomplish?

Ans: The dd command is a special copy command often used for floppy disks and tapes. The if= option specifies the source; the bs= is the block size; and the of= option is the output.

Q.You attempt to delete a file called sales.mem using the rm command but the command fails. What could be the problem?

Ans: In order to delete a file, you must have write rights to the directory containing the file.

 Linux Interview Questions             Linux Interview Questions and Answers

Q.You want to search for sale and sales. What regular expression

should you use?

Ans: Use the asterick (*) to match to zero or more characters. The ‘$’ matches to any one character so sale$ would not find sale.

Q.You have a file named ‘kickoff’ and would like to find every line beginning with a number. Which of the following commands will accomplish this?

Ans: The command grep ^[0-9] kickoff will cause grep to search the file kickoff for any line beginning with a digit.

Q.You want to know how many lines in the kickoff file contains ‘prize’. Which of the following commands will produce the desired results?

Ans: Using the -c option with the grep command will show the total number of lines containing the specified pattern rather than displaying the lines containing the pattern.

Q.You want to verify which lines in the file kickoff contain ‘Bob’. Which of the following commands will accomplish this?

Ans: The -n option when used with sed prints only the lines containing the pattern. In this case, the pattern is ‘Bob’ and the file to be searched is kickoff.

Q.You have a file called docs.Z but do not know what it is. What is the easiest way to look at the contents of the file?

Ans: The .Z extension indicates that this is a file that has been compressed using the compress utility. The zcat utility provides the ability to display the contents of a compressed file.

Q.You want to make it possible for your users to mount floppy disks. What do you need to do?

Ans: If you add the user option to the line in the fstab file that defines how to mount your CD-ROM, then your users will be able to mount it.

What is contained in the directory

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

 Q.After copying a file to a floppy disk, what should you do before removing the disk?

Ans: If you do not unmount the floppy before removing it, the files on the floppy may become corrupted.

Q.You have set quotas for all your users but half of your users are using more space than they have been allotted. Which of the following could be the problem?

Ans: Quotas are set on a partition by partition basis. If your users have home directories on different partitions, you will need to configure quotas for each partition.

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

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

Q.you have a large spreadsheet located in the /data directory that five different people need to be able to change. How can you enable each user to edit the spreadsheet from their individual home directories?

Ans: By creating a link to the file in each user’s home directory, each user is able to easily open and edit the spreadsheet. Also, any changes that are made are seen by all the users with access.

Q.You have a file called sales data and create symbolic links to it in bob’s home directory. Bob calls you and says that his link no longer works. How can you fix the link?

Ans: Because the link in bob’s directory is a symbolic link, if the file sales data in the /data directory is deleted, the symbolic link will no longer work.

Q.You have two files in two different directories with the same inode. What type of link is involved?

Ans: Hard links all have the same inode number, unlike symbolic links.

Q.You need to locate a file called sales data that one of your user’s created in his home directory but you do not know which one. How could you use the find command to locate this file?

Ans: When using the find command to locate a file by name you must specify the starting place in the directory

hierarchy and the -name option to specify the file to search for.

Q.However, when Bob attempts to open the file he is unsuccessful. What command do you need to use to give Bob ownership of the file?

Ans: The chown command can be used by root to give ownership of a file to any user.

Q.What is meant by sticky bit?

Ans: When the sticky bit is set on a world writable directory, only the owner can delete any file contained in that directory.

Q.Your default umask is 002. What does this mean?

Ans: The digits of your umask represent owner, group and others in that order. The 0 gives read and write for files and the 2 gives read only for files.

Q.Which of the following commands will replace all occurrences of the word rate with the word speed in the file racing?

Ans: When using sed to do a search and replace, its default action is to only replace the first occurrence in each line. Adding the ‘g’ makes sed replace all occurrences of the search term even when it occurs multiple times on the same line.

 Q.You have a tab delimited file called phonenos and want to change each tab to four spaces. What command can you use to accomplish this?

Ans: By default, expand converts tabs to eight spaces. Use the -t option to change this behavior.

Q.You issue the command head *. What would the resulting output be?

Ans: If the number of lines to display is not specified, the first ten lines of the specified file are displayed. The asterick tells head to display the content of each file in the present working directory.

Q.what text filter can you use to display a binary file in octal numbers?

Ans: The od text filter will dumpt the contents of a file and display it in 2-byte octal numbers.

Q.What would be the result of the command paste -s dog cat ?

Ans: The paste text filter usually joins two files separating the corresponding lines with a tab. The -s option, however, will cause paste to display the first file, dog, then a new line character, and then the file cat.

Q.You wish to print the file vacations with 60 lines to a page. Which of the following commands will accomplish this?

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

Q.What would be the result of issuing the command cat phonenos?

Ans: The tac text filter is a reverse cat. It displays a file starting with the last line and ending with the first line.

Q.You need to see the last fifteen lines of the files dog, cat and horse. What command should you use?

Ans: The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.

Q.You have the file phonenos that contains telephone numbers and names separated by a comma. You want to change each comma to a semicolon. Which of the following will accomplish this?

Ans: The tr utility is used to replace one string by another. Here the input for tr is provided by the cat command and the commas are all replaced by semicolons.

Q.If you type the command cat dog > cat what would you see on your display?

Ans: When you use > for redirection, it only effects the standard output. Any messages sent to standard error would still appear on your display.

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

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

Q.What command allows you to set a processor-intensive job to use less CPU time?

Ans: The nice command is used to change a job’s priority level, so that it runs slower or faster. Answers a, d, and e are valid commands but are not used to change process information. Answer c is an invalid command.

Q.Which of the following commands can be used to get information about a package?

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

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

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.

Which hardware considerations should you keep in mind when putting together this mail server’s list of components$ [Choose all correct answers]

A mail server benefits from a large amount of RAM, a fast CPU, and large amounts of fast-access hard drive space. The reason it benefits from having a lot of memory is that it can then handle groups of mail messages all at once. A fast CPU helps it move through processes more quickly, especially when it comes to generating postings to large mailing lists. Having a lot of hard drive space ensures that the mail spool will not run out of free room. Answers a and c are unimportant on a machine that is meant to provide mail service. A Linux box serving such a purpose would only be slowed down with a GUI running, and the GUI is the reason to be concerned with both the monitor resolution and video RAM.

Q.Of the following technologies, which is considered a client-side script?

Ans: JavaScript is the only client-side script listed. Java and C++ are complete programming languages

. Active Server Pages are parsed on the server with the results being sent to the client in HTML.

Q.What type of server is used to remotely assign IP addresses to machines during the installation process?

Ans: You can use a DHCP server to assign IP addresses to individual machines during the installation process. Answers a, b, d, and e list legitimate Linux servers, but these servers do not provide IP addresses. The SMB, or Samba, tool is used for file and print sharing across multi-OS networks

. An NFS server is for file sharing across Linux net-works. FTP is a file storage server that allows people to browse and retrieve information by logging in to it, and HTTP is for the Web

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

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

Q.Which password package should you install to ensure that the central password file couldn’t be stolen easily?

Ans: The shadow password package moves the central password file to a more secure location. Answers a, b, and e all point to valid packages, but none of these places the password file in a more secure location. Answer d points to an invalid package.

Q.Which command works in almost all distributions to create a boot disk ?

Ans: The mkbootdisk command creates a boot disk. Answers b and c are incorrect. The make package is used to compile software, not create boot disks. Answers a and d point to invalid commands.

Q.What happens to your ipchains settings when you reboot a machine?

Ans: They cannot be automatically saved unless you do something like make an alias for the shutdown routine that ensures this happens. Settings for ipchains are lost during a reboot or shutdown and there is no “setting” to ensure they are automatically saved. Answers a, b, and c are completely incorrect. Answer e is incorrect, but you can save them by hand if you choose to.

Q.Which package provides secure remote login sessions, such as secure telnet logins?

Ans: The ssh package allows you to configure secure telnet sessions and other remote logins. Answer a points to an invalid package. Answer c points to a valid package, but shadow handles passwords, not data encryption. Answers d and e point to firewalling packages, which regulate what passes in and out of a LAN, but do not handle data encryption.

Q.Which package can you use to regulate which network traffic is allowed to enter a specific machine, but not on any other machines?

Ans: The tcp_wrappers package is used to regulate the TCP/IP network traffic coming in and out of a machine. Answers b and c both point to valid firewalling packages, but these packages are used for an entire LAN, not just one machine. Answer d points to the commun-ications protocol used to transmit data over the Internet. Answer e points to an invalid package.

Q.What type of server is used to remotely assign IP addresses to machines during the installation process?

Ans: you can use a DHCP server to assign IP addresses to individual machines during the installation process. Answers a, b, d, and e list legitimate Linux servers, but these servers do not provide IP addresses. The SMB, or Samba, tool

is used for file and print sharing across multi-OS networks. An NFS server is for file sharing across Linux net-works. FTP is a file storage server that allows people to browse and retrieve information by logging in to it, and HTTP is for the Web

Q.Which partitioning tool is available in all distributions?

Ans: The fdisk partitioning tool is available in all Linux distributions. Answers a, c, and e all handle partitioning, but do not come with all distributions. Disk Druid is made by Red Hat and used in its distribution along with some derivatives. Partition Magic and System Commander are tools made by third-party companies. Answer d is not a tool, but a file system type. Specifically, FAT32 is the file system type used in Windows 98.

Which first-level segment of the file system contains a majority of system

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.

Q.Which file do you edit to set partitions to mount at boot time?

Ans: The file /etc/fstab manages which partitions are automatically mounted onto the file system. Answers b and c refer to valid items, but they are not used to manage the file system. The file /etc/services maps networking services to the ports they utilize, and /etc/smb.conf is the configuration file for the Samba service. Answers d and e point to files that do not exist.

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

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

Q.Which file do you edit to set partitions to mount at boot time?

Ans: The file /etc/fstab manages which partitions are automatically mounted onto the file system. Answers b and c refer to valid items, but they are not used to manage the file system. The file /etc/services maps networking services to the ports they utilize, and /etc/smb.conf is the configuration file for the Samba service. Answers d and e point to files that do not exist.

Q.Which shell do you assign to a POP3 mail-only account?

Ans: You assign a POP3 only account to the /bin/false shell. Answers b and c both point to the same shell, the bash shell. However, assigning this shell to a POP3 only user gives him or her login access, which is what you are trying to avoid. Answers d and e are both invalid options in a standard setup.

Q.What command would you use to create an empty file without opening it to edit it?

Ans: You use the touch command to create an empty file without needing to open it. Answers a and e point to invalid commands, though either of these might actually be aliased to point to a real command. Answers b and c utilize editors, and so do not satisfy the requirements of the question.

actually touch is used to change the timestamps of a file if its exits, otherwise a new file with current timestamps will be created

Q.Which command do you use to change run levels?

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

Q.Which daemon controls the network service -> POP3 mail service?

Ans: The inetd superdaemon controls the POP3 mail service. The POP3 mail service runs through the superdaemon, not on its own. Answers c and e point to nonexistent, or at least nonstandard daemons. Answer d points to the Usenet news daemon.

Q.Who owns the data dictionary ?

Ans: The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

how we can configure sata hard derive during redhat 9 installation.

Have the data driver on a floppy drive. At the start of installation, when u boot

from the CD/DVD, on the prompt, write “dd”. It will ask for the driver floppy later on and will load the sata driver. Then you can configure/partition the drive using disk druid or fdisk.

Q.What is difference between AT and CRON?

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

Contact Author Contact Author Cron command is used to schedule the task daily at the same time repeatedly ,”at” command is used to schedule the task only once i.e. to run only one time.

Q.What is difference between user right and user permission?

Ans: user rights:user rights is that user is authorized to used password. if his password/file/dir is expired he is not able to login

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

if he is authentication for particular file or not.

it might be true as per my suggestion.

Q.What is the real mean of DHCP?

Ans: dynamic Host Configuration Protocol(DHCP) is a protocol used by networked devices (clients) to obtain the IP address.

Contact Author Contact Author Dynamic addressing simplifies network administration because the s/w keeps track of IP addresses rather than requiring an administrator to manage the task. That means new computer

can be added to the network without any risk of manually assigning unique IP address.

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

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.

How to install 8139 realtek drivers in rhel5.0$ Please help me out.

Download the driver from internet.

then just unzip the tarball using tar -zxvf

then for first compile it using make and make install

For proper installation of the driver read the INSTALL / README file given in the tarball.

Q.What is difference between user right and user permission?

Ans: user rights:user rights is that user is authorized to used password. if his password/file/dir is expired he is not able to login user permission:permission is user is permitted to use file/directory. that is authentication if he is authentication for particular file or not.

it might be true as per my suggestion.

Q.What is the real mean of DHCP?

Ans: Dynamic addressing simplifies network administration because the s/w keeps track of IP addresses

rather than requiring an administrator to manage the task. That means new computer can be added to

the network without any risk of manually assigning unique IP address.

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

Ans: Boot process takes place in 4 scenes with 4 main characters.

Scene 1

when the computer is switched on, it automatically invokes BIOS[a ROM chip embedded in the motherboard].The BIOS will start the processor and perform a POST[power on self test] to check whether the connected device are ready to use and are working properly. Once the POST is completes BIOS will jump to a specified location in the RAM and check for the booting device. The boot sector is always the first sector of the hard disk and BIOS will load the MBR into the memory.

Scene 2

Here the boot loader takes the control of the booting process.LILO or GRUB is the boot loaders commonly available. It will help the user to select various boot options. Depending on the boot option selected the kernel is loaded.

scene 3

After kernel is loaded the kernel will take the control of the booting process and it will initialize all the hardwares including I/O processors etc.kernel then creates a root device and mounts the partitions.

Scene 4

INIT is loaded.

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

Ans: 1. Three Partition.

boot partition, swap partition and root partition, these are the minimum partitions to install

the Linux.

  1. dmesg or /var/log/messages

What command you execute to display the last five commands you have entered$ Which partitions might you creates on mail server HDDs other than the root, swap and boot partitions$ Which partitioning tool is available in all distributions$ Which two commands can you use to delete directories$ Which file defines all users on your system$

  1. history|tail -5
  2. /var
  3. fdisk, parted
  4. rm, rmdir
  5. /etc/passwd

Q.How to install 8139 realtek drivers in rhel5.0? Please help me out?

Ans: Download the driver from internet.

then just unzip the tarball using tar -zxvf

then for first compile it using make and make install

For proper installation of the driver read the INSTALL / README file given in the tarball.

Q.What does Security-enhanced Linux give me that standard Linux can’t?

Ans: The Security-enhanced Linux kernel enforces mandatory access control policies that confine user programs and system servers to the minimum amount of privilege they require to do their jobs. When confined in this way, the ability of these user programs and system daemons to cause harm when compromised (via buffer overflows or misconfigurations, for example) is reduced or eliminated. This confinement mechanism operates independently of the traditional Linux access control mechanisms. It has no concept of a “root” super-user, and does not share the well-known shortcomings of the traditional Linux security mechanisms (such as a dependence on setuid/setgid binaries).The security of an unmodified Linux system depends on the correctness of the kernel, all the privileged applications, and each of their configurations. A problem in any one of these areas may allow the compromise of the entire system. In contrast, the security of a modified system based on the Security-enhanced Linux kernel depends primarily on the correctness of the kernel and its security policy configuration. While problems with the correctness or configuration of applications may allow the limited compromise of individual user programs and system daemons, they do not pose a threat to the security of other user programs and system daemons or to the security of the system as a whole.

Q.What is SELinux?

Ans: SELinux

Security-enhanced Linux is a research prototype of the Linux® kernel and a number of utilities with enhanced security functionality designed simply to demonstrate the value of mandatory access controls to the Linux community and how such controls could be added to Linux. The Security-enhanced Linux kernel contains new architectural components originally developed to improve the security of the Flask operating system. These architectural components provide general support for the enforcement of many kinds of mandatory access control policies, including those based on the concepts of Type Enforcement®, Role-based Access Control, and Multi-level Security.

Q.What is the most graceful way to get to run level single user mode?

Ans: The most graceful way is to use the command init s.

If you want to shut everything down before going to single user mode then do init 0 first and from the ok prompt do a boot -s.

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

The following command will find all of the files which have been accessed within the last 10 days

find / -type f -atime -10 > December.files

This command will find all the files under root, which is ‘/’, with file type is file. ‘-atime -30′ will give all the files accessed less than 10 days ago. And the output will put into a file call Monthname.files.

Q.What is the main advantage of creating links to a file instead of copies of the file?

Ans: The main advantage is not really that it saves disk space (though it does that too) but, rather, that a change of permissions on the file is applied to all the link access points. The link will show permissions of lrwxrwxrwx but that is for the link itself and not the access to the file to which the link points. Thus if you want to change the permissions for a command, such as su, you only have to do it on the original. With copies you have to find all of the copies and change permission on each of the copies.

Q.What is LILO?

Ans: LILO stands for Linux boot loader. It will load the MBR, master boot record, into the memory, and tell the system which partition and hard drive to boot from.

Q.What is CVS?

Ans: CVS is Concurrent Version System. It is the front end to the RCS revision control system which extends the notion of revision control from a collection of files in a single directory to a hierarchical collection of directories consisting of revision controlled files. These directories and files can be combined together to form a software release.

There are some useful commands that are being used very often. They are

cvs checkout

cvs update

cvs add

cvs remove

cvs commit

Q.What is NFS? What is its job?

Ans: NFS stands for Network File System. NFS enables filesystems physically residing on one computer system to be used by other computers in the network, appearing to users on the remote host as just another local disk.

Q.In Linux OS, what is the file server?

Ans: The file server is a machine that shares its disk storage and files with other machines on the network.

Q.What are the techniques that you use to handle the collisions in hash tables?

Ans: We can use two major techniques to handle the collisions. They are open addressing and separate chaining. In open addressing, data items that hash to a full array cell are placed in another cell in the array. In separate chaining, each array element consists of a linked list. All data items hashing to a given array index are inserted in that list.

Q.What is the major advantage of a hash table?

Ans: The major advantage of a hash table is its speed. Because the hash function is to take a range of key values and transform them into index values in such a way that the key values are distributed randomly across all the indices of a hash table.

Q.What is Write Command ?

Ans: The write command enables you to write an actual message on the other terminal online. You have to issue the write command with the login ID of the user with whom you want to communicate. The write command informs the user at the other end that there is a message from another user. write pastes that message onto the other user’s terminal if their terminal’s write permissions are set. Even if they are in the middle of an edit session, write overwrites whatever is on the screen. The edit session contents are not corrupted; you can restore the original screen on most editors with Ctrl-L. write is mostly used for one-way communication, but you can have an actual conversation as well

Q.Why You Shouldn’t Use the root Login?

Ans: The root login does not restrict you in any way. When you log in as root, you become the system. The root login is also sometimes called the super user login. With one simple command, issued either on purpose or by accident, you can destroy your entire Linux installation. For this reason, use the root login only when necessary. Avoid experimenting with commands when you do log in as root.

Q.How big should the swap-space partition be?

Ans: Swap space is used as an extension of physical RAM, the more RAM you have, the less swap space is required. You can add the amount of swap space and the amount of RAM together to get the amount of RAM Linux will use. For example, if you have 8MB of RAM on your machine’s motherboard, and a 16MB swap-space partition, Linux will behave as though you had 24MB of total RAM.

Q.Which field is used to define the user’s default shell?

Ans: command-The last field, called either command or login command, is used to specify what shell the user will use when he logs in.

Q.When you create a new partition, you need to designate its size by defining the starting and ending?

Ans: cylinders-When creating a new partition you must first specify its starting cylinder. You can then either specify its size or the ending cylinder.

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

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

Q.In order to display the last five commands you have entered using the fc command, you would type?

Ans: fc -5-The fc command can be used to edit or rerun commands you have previously entered. To specify the number of commands to list, use -n.

Q.What command should you use to check your file system?

Ans: fsck-The fsck command is used to check the integrity of the file system on your disk.

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

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

Q.What account is created when you install Linux?

Ans: root-Whenever you install Linux, only one user account is created. This is the super user account also known as root.

Q.What daemon is responsible for tracking events on your system?

Ans: Syslogd-The syslogd daemon is responsible for tracking system information and saving it to specified log files.

Q.Where standard output is usually directed?

Ans: To the screen or display-By default, your shell directs standard output to your screen or display.

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

Ans: Top-The top utility shows a listing of all running processes that is dynamically updated

Q.Who owns the data dictionary?

Ans: The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.

Q.Compare Linux credit based algorithm with other scheduling algorithms?

Ans: For the conventional time –shared processes, Linux uses a prioritized, credit-based algorithm. Each process possesses a certain number of scheduling credits; when a new task must be chosen to run, the process with most credits is selected. Every time that a timer interrupt occurs, the currently running process loses one credit; when its credits reaches zero, it is suspended and another process is chosen. If no runnable processes have any credits, then Linux performs a recrediting operation, adding credits to every process in the system (rather than just to the runnable ones), according to the following rule:

Credits = credits/2 + priority

The above scheduling class is used for time-shared process and the in Linux for the real-time scheduling is simpler it uses scheduling classes: first come, first served

(FCFS), and round-robin (RR) .In both cases, each process has a priority in addition to its scheduling class. In time-sharing scheduling, however, processes of different priorities can still compete with one another to some extent; in real-time scheduling, the scheduler always runs the process with the highest priority. Among processes of

equal priority, it runs the process that has been waiting longest. The only difference between FCFS and RR scheduling is that FCFS processes continue to run until they either exit or block, whereas a round-robin process will be preempted after a while and will be moved to the end of the scheduling queue, so round-robin processes of equal priority will automatically time share among themselves.

Linux’s real-time scheduling is soft-real time rather than hard-real time. The scheduler offers strict guarantees about the relative priorities of real-time processes, but the kernel does not offer any guarantees about how quickly a real-time process will be scheduled once that process becomes runnable. Thus the Linux uses different scheduling classes for time-shared and real-time processes.

contact for more on Linux Online Training

Linux Interview Questions Overall rating: ★★★★☆ 4.4 based on 427 reviews
5 1

linux interview questions

Write A Review 

Name
Email
Review Title
Rating
Review Content

Linux interview questions Tags

linux interview questions and answers,linux online training, linux interview questions, linux training online, linux training, linux training institute, latest linux interview questions, best linux interview questions 2019, top 100 linux interview questions,sample linux interview questions,linux interview questions technical, best linux interview tips, best linux interview basics, linux Interview techniques, linux Interview Tips.

For  online training videos