linux interview questions and answers

Download Linux Interview Questions and Answers

If you can't read please download the document

Upload: balamurugan-swaminathan

Post on 20-Nov-2014

26 views

Category:

Documents


1 download

TRANSCRIPT

Linux Interview Questions and AnswersWe saw the mention on the Linux BIOS website about one million devices shipped with Linux BIOS. Could you tell us more about these devices? Yes, these are internet terminals that were built in India, based on the [x86 system-on-chip] STPC chip, I am told; also, there evidently is a Turkish-built digital TV that runs Linux BIOS. I have also heard that there are routers and many other embedded devices running Linux BIOS. I think at this point that 1 million is a low number. I am in contact with other set-top box vendors that are talking about numbers in the 10s of millions for their products. These numbers actually make the OLPC numbers seem small, which is in it amazing. Whats your goal for your talk at FOSDEM? Id like to communicate the basic ideas that Linux is a good BIOS, and why; why Linux BIOS is built the way it is; where we are going; and how people can help. Most importantly, why it all matters and it really matters a lot. Were on the verge of losing control of the systems we buy, and we need to make a conscious effort, as a community, to ensure this loss of control does not happen. That effort will not be without some sacrifice, but if we are to maintain our ability to use and program our machines, and have fun with them, we have to act now. Because, if the computing business stops being fun, whats the point$ If We Send You an Invoice, Then Will You Pay Us? Now SCO says it will send out invoices to the 1500 companies that got the earlier warning from them, and maybe you too, in the next weeks or months. What$ You mean you arent in a hurry to stand before a judge$ Expected response from one and all: yawn. Heres the article: SCO Group Inc is preparing to invoice customers running or developing with Linux, while broadening its copyright net to include manufacturers of embedded systems. . . . Invoices will be dispatched in the next weeks or months a company spokesperson confirmed. Those being billed will include 1,500 end-users who were earlier this year informed by SCO in writing they should seek legal advice as running Linux violated the companys copyright. Customers running Linux who were not on SCOs original mailing list will also be targeted. Chris Sontag says you end user pirates better not wait for the legal case to be over, or youll have to face the consequences: SCO has the right to defend its copyright all the way down to the end user, said Sontag. If necessary we will start picking end users to enforce our

rights. Sontag warned that SCO had no qualms about enforcing its claimed rights anywhere in the world - including the UK. And if that doesnt work, then theyll huff and theyll puff and theyll blow your house down. As most people know, SCO is working with IBM and Sequent (which IIRC IBM bought a while back) to develop a new 64 bit Unix. How will these two OSes work together on your systems$ Are you planning on using Linux only on low-end machines, while Monterey runs on IA-64, or will Linux be a stopgap OS to run on your systems until Monterey is finished$ Once again, we find yet another way any identical code could have come to be in both SCOs code and Linux. We just reported yesterday that Compaq worked with Chinas Red Flag Linux with the goal of scaling to 64-bit. Now we find Old SCO was working hard to do the same thing. You think its possible to write a kernel monitoring utility for Linux without touching or looking at the Linux kernel$ They were donating code by the buckets, apparently, judging from their own statements, and they were proud of it. How in the world they can prove it was IBM that did it, or even IBM that facilitated it, when Old SCO itself was working to make Linux scale in precisely some of the high-end ways they now list in their complaint as an offense, is truly a mystery to me, what with all the possible suspects. And something appears to be off in SCOs historic timeline in its legal papers. Could that be why they took these pages down$ Well, lets not get paranoid or anything. But, you think$ What does your future roadmap for SCO Unix look like$ - Are you going the SGI path and gradually phasing out your own Unix in favor of Linux, or are you pursuing a parallel development path of both OSs$ What features currently in SCO that are not in Linux do you feel is necessary for wider corporate acceptance of Linux$ McCrabb: Our formal product roadmap is undergoing a complete overhaul. When we begin to outline our OS deliverables for the next 18 months, you will see that UnixWare 7 and SCO Open Server 5 will continue moving ahead. Look forward to new developments as well. Enterprises building their businesses on a server platform are interested in reliability and availability. Although we believe in a high degree of reliability that comes from the level of code inspection provided by the Open Source Community, we feel it needs to be quantified with benchmarking statistics like MTBSS. This opens a number of possible further improvements journalizing file systems, support for hot-plug PCI, multi-path I/O things that make is easier to never bring the system down, or to recover the system more quickly. Will SCO be contributing/open-sourcing any technology and/or patents that it holds as part of its Linux adoption effort$ Also, did your market research pan out - is Linux really being used in large businesses or is it still primarily used by small startup companies strapped for cash$

McCrabb: SCO is accelerating its participation in, and contributions to, the Open Source Community. In some cases, we will be taking current technology that we think is needed in the Linux market and driving it forward as the project maintainers. Right now, we are focusing on bringing some of our high-performance Intel development tools to Linux. In other cases, we will make some sources available as reference documents, without a specific intention of driving them forward as projects. How do you see your role fitting into the NCLB goals? With district goals? With building goals? With departmental goals? As Instructional Media and Technology Coordinator, my role is to help others realize the promise of technology to impact teaching, learning and leadership. Effectively integrating technology, using digital content to enhance learning to foster inquiry, analysis, collaboration, and creativity is what NCLB Title 2, Part D is about. Aligning federal, state, district and building goals can only be done by facilitating ever-deepening conversations about what it means to use digital content and technology to change teacher and leadership practices. My role specifically has to focus on helping teachers and administrators SEE what teaching and learning can be like, then supporting them as they grow to discover their own technologyenhanced teaching style. In fact, in my previous position, 3 initiatives were celebrated as success stories in the new Educational Technology Plan. Aside from serving as a leader, Im also committed to handling the day-today aspects of dealing with technology equipment, software and supply purchases. While I am a guide on the side in the use of technology in the classroom, I can take a role that is more active when ensure district compliance with appropriate laws and administrative procedures. Technology can bridge the chasm between classrooms, public perception, and administrative procedure. Increasing transparency of what we are doing is frightening. However, being unafraid in front of your class, your peers, to the benefit of all, is exactly what were called to do as educators. What do you see happening in educational technology in the next 2, 5 and 10 years? Powerful technologies are enhancing the voices of individuals. With the advent of web-based tools for data aggregation/disaggregation, online publishing, communication and mass collaboration, people we never imagined will be joining the dialogue. Ive experienced this first-hand with my foray into blogging and podcasting, and the ability to collaborate with others around the globe. I imagine it will be like when everyone bought modems for their computers. Like that Christmas after the movie War Games where a teenager almost began a global thermonuclear war, when everyone ran out to buy a modem, people are going to congregate in online communities. I was one of those

teenagers who spent many a night having conversations with people around my home town. Now, those conversations are happening with people around the globe. My role in this position will be to facilitate and model the appropriate use of the Read/Write Web. In a world where everyone can contribute, the need for information literacy and problem-solving is critical. My experiences in guiding educators through Big6 information problemsolving approach has not only familiarized me with these approaches, but also helped me guide others. Merging information-problem-solving approaches with the Levels of Technology Implementation (LOTI) framework can help teachers move a lesson activity from a lower level of the revised Blooms Taxonomy, such as synthesis to creation. Mass collaboration and peer production will pull the rug out from traditional educational technology efforts. In 10 years, if not less, educational technology will become THE deciding factor in whether schools are judged successful or not, but will do so from a completely different direction than we imagined. In the past, ed-tech was about individual productivity. Increasingly in the future, it will be about mass communication, mass collaboration, working in virtual environments like Second Life mean that educational technology will become an anachronism. What are MySQL transactions? 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.)

List the main applications of 8 bit microprocessors? 8 bit microprocessors are used in a variety of applications such as appliances , automobiles ,industrial process and control applications. What is NV-RAM? Nonvolatile Read Write Memory, also called Flash memory. It is also know as shadow RAM Can ROM be used as stack? ROM cannot be used as stack because it is not possible to write to ROM. What is stack? Stack is a portion of RAM used for saving the content of Program Counter and general purpose registers. What is flag? 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 Which processor structure is pipelined? All x86 processors have pipelined structure. What is a compiler? Compiler is used to translate the high-level language program into machine code at a time. It doesnt require special instruction to store in a memory, it stores automatically. The Execution time is less compared to Interpreter. Differentiate between RAM and ROM? RAM: Read / Write memory, High Speed, Volatile Memory. ROM: Read only memory, Low Speed, Non Voliate Memory. Which transistor is used in each cell of EPROM? Floating .gate Avalanche Injection MOS (FAMOS) transistor is used in each cell of EPROM. What is called .Scratch pad of computer.? Cache Memory is scratch pad of computer. What is cache memory? 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.

What is interrupt? Interrupt is a signal send by external device to the processor so as to request the processor to perform a particular work. Difference between static and dynamic RAM? 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. What is the difference between primary & secondary storage device? 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. Why does microprocessor contain ROM chips? Microprocessor contain ROM chip because it contain instructions to execute data. What is meant by LATCH? 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. What is the difference between microprocessor and microcontroller? 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. What is the disadvantage of microprocessor? It has limitations on the size of data. Most Microprocessor does not support floating-point operations. Is the data bus is Bi-directional? 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.

Is the address bus unidirectional? 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. Define HCMOS? High-density n- type Complimentary Metal Oxide Silicon field effect transistor. What is 1st / 2nd / 3rd / 4th generation processor? 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. 3. Why 8085 processor is called an 8 bit processor? Because 8085 processor has 8 bit ALU (Arithmetic Logic Review). Similarly 8086 processor has 16 bit ALU. Give examples for 8 / 16 / 32 bit Microprocessor? 8-bit Processor - 8085 / Z80 / 6800; 16-bit Processor - 8086 / 68000 / Z8000; 32-bit Processor - 80386 / 80486. What is a Microprocessor? Microprocessor is a program-controlled device, which fetches the instructions from memory, decodes and executes the instructions. Most Micro Processor is single- chip devices. What command would you use to create an empty file without opening it to edit it? 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 Which of the following commands can you use to cleanly restart a Linux machine? 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 .

What do you type to stop a hung process that resists the standard attempts to shut it down? 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. Which command do you use to change run levels? 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. Which two commands can you use to delete directories ? 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. What would you type to send the last 20 lines of a text file to STDIN? 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 Which daemon controls the network service -> POP3 mail service? 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. Who owns the data dictionary? 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 What is difference between AT and CRON? 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. What is difference between user right and user permission? 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. What is the real mean of DHCP? 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. 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? The tail command allows you to keep a log open and see each new message as it is written to the log. Which of the following tasks cannot be accomplished with the touch command? The touch command is usually used to modify either a files access or modification time. It can also be used to create a new file. You want to copy the users home directories to a new location. Which of the following commands will accomplish this? The -r option tells the cp command to recurs the directories. The -P option retains the original permissions. You read an article that lists the following command: dd if=/dev/fd0 bs=512 of=/new What does this accomplish? 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. You attempt to delete a file called sales.mem using the rm command but the command fails. What could be the problem? In order to delete a file, you must have write rights to the directory containing the file. You want to search for sale and sales. What regular expression should you use? Use the asterick (*) to match to zero or more characters. The $ matches to any one character so sale$ would not find sale.

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? The command grep ^[0-9] kickoff will cause grep to search the file kickoff for any line beginning with a digit. You want to know how many lines in the kickoff file contains prize. Which of the following commands will produce the desired results? 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. You want to verify which lines in the file kickoff contain Bob. Which of the following commands will accomplish this? 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. 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? 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. You want to make it possible for your users to mount floppy disks. What do you need to do? 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. After copying a file to a floppy disk, what should you do before removing the disk? If you do not unmount the floppy before removing it, the files on the floppy may become corrupted. 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? 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.

What command should you use to check the number of files and disk space used and each users defined quotas? 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. 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? By creating a link to the file in each users 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. You have a file called sales data and create symbolic links to it in bobs home directory. Bob calls you and says that his link no longer works. How can you fix the link? Because the link in bobs directory is a symbolic link, if the file sales data in the /data directory is deleted, the symbolic link will no longer work. You have two files in two different directories with the same inode. What type of link is involved? Hard links all have the same inode number, unlike symbolic links. You need to locate a file called sales data that one of your users created in his home directory but you do not know which one. How could you use the find command to locate this file? 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. 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? The chown command can be used by root to give ownership of a file to any user. What is meant by sticky bit? When the sticky bit is set on a world writable directory, only the owner can delete any file contained in that directory. Your default umask is 002. What does this mean? 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.

Which of the following commands will replace all occurrences of the word rate with the word speed in the file racing? 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. 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? By default, expand converts tabs to eight spaces. Use the -t option to change this behavior. You issue the command head *. What would the resulting output be? 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. what text filter can you use to display a binary file in octal numbers? The od text filter will dumpt the contents of a file and display it in 2-byte octal numbers. What would be the result of the command paste -s dog cat ? 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. You wish to print the file vacations with 60 lines to a page. Which of the following commands will accomplish this? The default page length when using pr is 66 lines. The -l option is used to specify a different length. What would be the result of issuing the command cat phonenos? The tac text filter is a reverse cat. It displays a file starting with the last line and ending with the first line. You need to see the last fifteen lines of the files dog, cat and horse. What command should you use? The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.

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? 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. If you type the command cat dog > cat what would you see on your display? When you use > for redirection, it only effects the standard output. Any messages sent to standard error would still appear on your display. Which first-level segment of the file system contains a majority of system and server configuration files within its subdirectories? 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. What command allows you to set a processor-intensive job to use less CPU time? The nice command is used to change a jobs 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. Which of the following commands can be used to get information about a package? 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 userspecific scripts. Which hardware considerations should you keep in mind when putting together this mail servers 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. Of the following technologies, which is considered a client-side script? 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. What type of server is used to remotely assign IP addresses to machines during the installation process? 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 What type of local file server can you use to provide the distribution installation materials to the new machine during a network installation? 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. Which password package should you install to ensure that the central password file couldnt be stolen easily? 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.

Which command works in almost all distributions to create a boot disk ? 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. What happens to your ipchains settings when you reboot a machine? 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. Which package provides secure remote login sessions, such as secure telnet logins? 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. Which package can you use to regulate which network traffic is allowed to enter a specific machine, but not on any other machines? 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. What type of server is used to remotely assign IP addresses to machines during the installation process? 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

Which partitioning tool is available in all distributions? 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. Which file do you edit to set partitions to mount at boot time? 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. Which first-level segment of the file system contains a majority of system and server configuration files within its subdirectories? 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. Which file do you edit to set partitions to mount at boot time? 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.

Which shell do you assign to a POP3 mail-only account? 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. What command would you use to create an empty file without opening it to edit it? 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 Which command do you use to change run levels? 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. Which daemon controls the network service -> POP3 mail service? 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. Who owns the data dictionary ? 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.

What is difference between AT and CRON? 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. What is difference between user right and user permission? 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. What is the real mean of DHCP? 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. What is difference between user right and user permission? 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.

What is the real mean of DHCP? 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. What is the minimum number of partitions you need to install Linux? What command can you use to review boot messages? 1. Three Partition. boot partition, swap partition and root partition, these are the minimum partitions to install the Linux. 2. 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 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. What does Security-enhanced Linux give me that standard Linux cant? 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. What is SELinux? 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.

What is the most graceful way to get to run level single user mode? 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. What is the main advantage of creating links to a file instead of copies of the file? 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. What is LILO? 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. What is CVS? 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

What is NFS? What is its job? 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. In Linux OS, what is the file server? The file server is a machine that shares its disk storage and files with other machines on the network. What are the techniques that you use to handle the collisions in hash tables? 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. What is the major advantage of a hash table? 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. What is Write Command ? 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 users terminal if their terminals 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 Why You Shouldnt Use the root Login? 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.

How big should the swap-space partition be? 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 machines motherboard, and a 16MB swap-space partition, Linux will behave as though you had 24MB of total RAM. Which field is used to define the users default shell? command-The last field, called either command or login command, is used to specify what shell the user will use when he logs in. When you create a new partition, you need to designate its size by defining the starting and ending? cylinders-When creating a new partition you must first specify its starting cylinder. You can then either specify its size or the ending cylinder. What can you type at a command line to determine which shell you are using? 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 variables name with $. Therefore, typing echo $SHELL will display the name of your shell. In order to display the last five commands you have entered using the fc command, you would type? 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. What command should you use to check your file system? fsck-The fsck command is used to check the integrity of the file system on your disk. What file defines the levels of messages written to system log files? kernel.h-To determine the various levels of messages that are defined on your system, examine the kernel.h file. What account is created when you install Linux? root-Whenever you install Linux, only one user account is created. This is the super user account also known as root.

What daemon is responsible for tracking events on your system? Syslogd-The syslogd daemon is responsible for tracking system information and saving it to specified log files. Where standard output is usually directed? To the screen or display-By default, your shell directs standard output to your screen or display. What utility can you use to show a dynamic listing of running processes? Top-The top utility shows a listing of all running processes that is dynamically updated Who owns the data dictionary? The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created. Compare Linux credit based algorithm with other scheduling algorithms? For the conventional time shared processes, Linux uses a prioritized, creditbased 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.

Linuxs 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 realtime processes.

SQL interview questions and answers1. What are two methods of retrieving SQL? 2. What cursor type do you use to retrieve multiple recordsets? 3. What is the difference between a "where" clause and a "having" clause? - "Where" is a kind of restiriction statement. You use where clause to restrict all the data from DB.Where clause is using before result retrieving. But Having clause is using after retrieving the data.Having clause is a kind of filtering command. 4. What is the basic form of a SQL statement to read data out of a table? The basic form to read data out of table is SELECT * FROM table_name; An answer: SELECT * FROM table_name WHERE xyz= whatever; cannot be called basic form because of WHERE clause. 5. What structure can you implement for the database to speed up table reads? Follow the rules of DB tuning we have to: 1] properly use indexes ( different types of indexes) 2] properly locate different DB objects across different tablespaces, files and so on.3] create a special space (tablespace) to locate some of the data with special datatype ( for example CLOB, LOB and ) 6. What are the tradeoffs with having indexes? - 1. Faster selects, slower updates. 2. Extra storage space to store indexes. Updates are slower because in addition to updating the table you have to update the index. 7. What is a "join"? - join used to connect two or more tables logically with or without common field. 8. What is "normalization"? "Denormalization"? Why do you sometimes want to denormalize? - Normalizing data means eliminating redundant information from a table and organizing the data so that future changes to the table are easier. Denormalization means allowing redundancy in a table. The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing. 9. What is a "constraint"? - A constraint allows you to apply simple referential integrity checks to a table. There are four primary types of constraints that are currently supported by SQL Server: PRIMARY/UNIQUE - enforces uniqueness of a particular table column. DEFAULT - specifies a default value for a column in case an insert operation does not provide one. FOREIGN KEY - validates that every value in a column exists in a column of another table. CHECK - checks that every value stored in a column is in some specified list. Each type of constraint performs a specific type of action. Default is not a

constraint. NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only constraint which is not a table level constraint. 10. What types of index data structures can you have? - An index helps to faster search values in tables. The three most commonly used index-types are: - B-Tree: builds a tree of possible values with a list of row IDs that have the leaf value. Needs a lot of space and is the default index type for most databases. - Bitmap: string of bits for each possible value of the column. Each bit string has one bit for each row. Needs only few space and is very fast.(however, domain of value cannot be large, e.g. SEX(m,f); degree(BS,MS,PHD) - Hash: A hashing algorithm is used to assign a set of characters to represent a text string such as a composite of keys or partial keys, and compresses the underlying data. Takes longer to build and is supported by relatively few databases. 11. What is a "primary key"? - A PRIMARY INDEX or PRIMARY KEY is something which comes mainly from database theory. From its behavior is almost the same as an UNIQUE INDEX, i.e. there may only be one of each value in this column. If you call such an INDEX PRIMARY instead of UNIQUE, you say something about your table design, which I am not able to explain in few words. Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property. 12. What is a "functional dependency"? How does it relate to database table design? Functional dependency relates to how one object depends upon the other in the database. for example, procedure/function sp2 may be called by procedure sp1. Then we say that sp1 has functional dependency on sp2. 13. What is a "trigger"? - Triggers are stored procedures created in order to enforce integrity rules in a database. A trigger is executed every time a data-modification operation occurs (i.e., insert, update or delete). Triggers are executed automatically on occurance of one of the data-modification operations. A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL statements A trigger is a solution to the restrictions of a constraint. For instance: 1.A database column cannot carry PSEUDO columns as criteria where a trigger can. 2. A database constraint cannot refer old and new values for a row where a trigger can. 14. Why can a "group by" or "order by" clause be expensive to process? - Processing of "group by" or "order by" clause often requires creation of Temporary tables to process the results of the query. Which depending of the result set can be very expensive. 15. What is "index covering" of a query? - Index covering means that "Data can be found only using indexes, without touching the tables" 16. What types of join algorithms can you have? 17. What is a SQL view? - An output of a query can be stored as a view. View acts like small table which meets our criterion. View is a precomplied SQL query which is used to select data from one or more tables. A view is like a table but it doesnt physically take any space. View is a good way to present data in a particular format if you use that query quite often. View can also be used to restrict users from accessing the tables directly.

Linux command line Q&A1. You need to see the last fifteen lines of the files dog, cat and horse. What command should you use? tail -15 dog cat horse The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file. 2. Who owns the data dictionary? The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created. 3. 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. zcat The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file. 4. 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? 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. 5. You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose. whatis The whatis command displays a summary line from the man page for the specified command. 6. You wish to create a link to the /data directory in bobs home directory so you issue the command ln /data /home/bob/datalink but the command fails. What option should you use in this command line to be successful. Use the -F option In order to create a link to a directory you must use the -F option. 7. When you issue the command ls -l, the first character of the resulting display represents the files ___________. type The first character of the permission block designates the type of file that is being displayed. 8. What utility can you use to show a dynamic listing of running processes? __________ top The top utility shows a listing of all running processes that is dynamically updated. 9. Where is standard output usually directed? to the screen or display By default, your shell directs standard output to your screen or display.

10. You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type? 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. 11. You need to view the contents of the tarfile called MyBackup.tar. What command would you use? tar tf MyBackup.tar The t switch tells tar to display the contents and the f modifier specifies which file to examine. 12. You want to create a compressed backup of the users home directories. What utility should you use? tar You can use the z modifier with tar to compress your archive at the same time as creating it. 13. What daemon is responsible for tracking events on your system? syslogd The syslogd daemon is responsible for tracking system information and saving it to specified log files. 14. You have a file called phonenos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long? split The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines. 15. You would like to temporarily change your command line editor to be vi. What command should you type to change it? set -o vi The set command is used to assign environment variables. In this case, you are instructing your shell to assign vi as your command line editor. However, once you log off and log back in you will return to the previously defined command line editor. 16. What account is created when you install Linux? root Whenever you install Linux, only one user account is created. This is the superuser account also known as root. 17. What command should you use to check the number of files and disk space used and each users defined quotas? 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.

Linux application programming questions1. Explain the difference between a static library and a dynamic library? - Static library is linked into the executable, while a dynamic library (or shared object) is loaded while the executable has started. 2. How do you create a static library? - If you have a collection of object (.o) files, you can do it by running ar command. Generally a static library has a .a extension, and you can link it into an executable by providing -l libraryname to gcc. 3. Where should the developed libraries be installed on the system? - GNU recommends /usr/local/bin for binaries and /usr/local/lib for libraries. 4. Whats LD_LIBRARY_PATH? - Its an environment variable that lists all the directories which should be searches for libraries before the standard directories are searched. 5. How do you create a shared library? - Create the object file with -fPIC for positionindependent code, then run gcc with -shared option. 6. How do you install a shared library? - Run ldconfig in the standard directory that its installed in. 7. What does ldd do? - It shows a list of installed shared libraries. 8. How do you dynamically load a library in your app? - Use dlopen() 9. What does nm command do? - It reports the list of symbols in a given library.

Basic shell scripting questions1. 2. 3. 4. 5. 6. 7. 8. How do you find out whats your shell? - echo $SHELL Whats the command to find out todays date? - date Whats the command to find out users on the system? - who How do you find out the current directory youre in? - pwd How do you remove a file? - rm How do you remove a - rm -rf How do you find out your own username? - whoami How do you send a mail message to somebody? - mail [email protected] -s Your subject -c [email protected] 9. How do you count words, lines and characters in a file? - wc 10. How do you search for a string inside a given file? - grep string filename 11. How do you search for a string inside a directory? - grep string * 12. How do you search for a string in a directory with the subdirectories recursed? grep -r string * 13. What are PIDs? - They are process IDs given to processes. A PID can vary from 0 to 65535. 14. How do you list currently running process? - ps 15. How do you stop a process? - kill pid 16. How do you find out about all running processes? - ps -ag 17. How do you stop all the processes, except the shell window? - kill 0 18. How do you fire a process in the background? - ./process-name &

19. How do you refer to the arguments passed to a shell script? - $1, $2 and so on. $0 is your script name. 20. Whats the conditional statement in shell scripting? - if {condition} then fi 21. How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt, -ge 22. How do you test for file properties in shell scripts? - -s filename tells you if the file is not empty, -f filename tells you whether the argument is a file, and not a directory, d filename tests if the argument is a directory, and not a file, -w filename tests for writeability, -r filename tests for readability, -x filename tests for executability 23. How do you do Boolean logic operators in shell scripting? - ! tests for logical not, -a tests for logical and, and -o tests for logical or. 24. How do you find out the number of arguments passed to the shell script? - $# 25. Whats a way to do multilevel if-elses in shell scripting? - if {condition} then {statement} elif {condition} {statement} fi 26. How do you write a for loop in shell? - for {variable name} in {list} do {statement} done 27. How do you write a while loop in shell? - while {condition} do {statement} done 28. How does a case statement look in shell scripts? - case {variable} in {possible-value1}) {statement};; {possible-value-2}) {statement};; esac 29. How do you read keyboard input in shell scripts? - read {variable-name} 30. How do you define a function in a shell script? - function-name() { #some code here return } 31. How does getopts command work? - The parameters to your script can be passed as -n 15 -x 20. Inside the script, you can iterate through the getopts array as while getopts n:x option, and the variable $option contains the value of the entered option.

Linux Interview Questions And Answers Set - 1You need to see the last fifteen lines of the files dog, cat and horse. What command should you use? tail -15 dog cat horse The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file. Who owns the data dictionary? The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created. 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. zcat The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file. 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? 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. You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose. whatis The whatis command displays a summary line from the man page for the specified command. You wish to create a link to the /data directory in bob's home directory so you issue the command ln /data /home/bob/datalink but the command fails. What option should you use in this command line to be successful. Use the -F option In order to create a link to a directory you must use the -F option. When you issue the command ls -l, the first character of the resulting display represents the file's ___________. type

The first character of the permission block designates the type of file that is being displayed. What utility can you use to show a dynamic listing of running processes? __________ top The top utility shows a listing of all running processes that is dynamically updated. Where is standard output usually directed? to the screen or display By default, your shell directs standard output to your screen or display. You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type? 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. You need to view the contents of the tarfile called MyBackup.tar. What command would you use? tar tf MyBackup.tar The t switch tells tar to display the contents and the f modifier specifies which file to examine. You want to create a compressed backup of the users' home directories. What utility should you use? tar You can use the z modifier with tar to compress your archive at the same time as creating it. What daemon is responsible for tracking events on your system? syslogd The syslogd daemon is responsible for tracking system information and saving it to specified log files. You have a file called phonenos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long? split The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.

You would like to temporarily change your command line editor to be vi. What command should you type to change it? set -o vi The set command is used to assign environment variables. In this case, you are instructing your shell to assign vi as your command line editor. However, once you log off and log back in you will return to the previously defined command line editor. What account is created when you install Linux? root Whenever you install Linux, only one user account is created. This is the superuser account also known as root. What command should you use to check the number of files and disk space used and each user's defined quotas? 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. In order to run fsck on the root partition, the root partition must be mounted as readonly You cannot run fsck on a partition that is mounted as read-write. In order to improve your system's security you decide to implement shadow passwords. What command should you use? pwconv The pwconv command creates the file /etc/shadow and changes all passwords to 'x' in the /etc/passwd file. 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? passwd boba The passwd command is used to change your password. If you do not specify a username, your password will be changed. 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 ___________? nice Both the top and nice utilities provide the capability to change the priority of a running process.

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

Basic shell scripting questionsBy admin | July 22, 2007 How do you find out whats your shell? - echo $SHELL Whats the command to find out todays date? - date Whats the command to find out users on the system? - who How do you find out the current directory youre in? - pwd How do you remove a file? - rm How do you remove a - rm -rf How do you find out your own username? - whoami How do you send a mail message to somebody? - mail [email protected] -s Your subject -c [email protected] 9. How do you count words, lines and characters in a file? - wc 10. How do you search for a string inside a given file? - grep string filename 11. How do you search for a string inside a directory? - grep string * 12. How do you search for a string in a directory with the subdirectories recursed? grep -r string * 13. What are PIDs? - They are process IDs given to processes. A PID can vary from 0 to 65535. 1. 2. 3. 4. 5. 6. 7. 8.

14. How do you list currently running process? - ps 15. How do you stop a process? - kill pid 16. How do you find out about all running processes? - ps -ag 17. How do you stop all the processes, except the shell window? - kill 0 18. How do you fire a process in the background? - ./process-name & 19. How do you refer to the arguments passed to a shell script? - $1, $2 and so on. $0 is your script name. 20. Whats the conditional statement in shell scripting? - if {condition} then fi 21. How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt, -ge 22. How do you test for file properties in shell scripts? - -s filename tells you if the file is not empty, -f filename tells you whether the argument is a file, and not a directory, d filename tests if the argument is a directory, and not a file, -w filename tests for writeability, -r filename tests for readability, -x filename tests for executability 23. How do you do Boolean logic operators in shell scripting? - ! tests for logical not, -a tests for logical and, and -o tests for logical or. 24. How do you find out the number of arguments passed to the shell script? - $# 25. Whats a way to do multilevel if-elses in shell scripting? - if {condition} then {statement} elif {condition} {statement} fi 26. How do you write a for loop in shell? - for {variable name} in {list} do {statement} done 27. How do you write a while loop in shell? - while {condition} do {statement} done 28. How does a case statement look in shell scripts? - case {variable} in {possible-value1}) {statement};; {possible-value-2}) {statement};; esac 29. How do you read keyboard input in shell scripts? - read {variable-name} 30. How do you define a function in a shell script? - function-name() { #some code here return } 31. How does getopts command work? - The parameters to your script can be passed as -n 15 -x 20. Inside the script, you can iterate through the getopts array as while getopts n:x option, and the variable $option contains the value of the entered option.

Linux Interview Questions And Answers Set - 2What file defines the levels of messages written to system log files? kernel.h To determine the various levels of messages that are defined on your system, examine the kernel.h file. What command is used to remove the password assigned to a group? 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. What command would you type to use the cpio to create a backup called backup.cpio of all the users' home directories? 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. What can you type at a command line to determine which shell you are using? 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. 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 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. 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. d When you use & > for redirection, it redirects both the standard output and standard error. The output would be saved to the file cat. 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 d The t switch will list the files contained in the tarfile. Using the v modifier will display the stored directory structure. 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. 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. You have a new application on a CD-ROM that you wish to install. What should your first step be? Choose one: a. Read the installation instructions on the CD-ROM. b. Use the mount command to mount your CD-ROM as read-write. c. Use the umount command to access your CD-ROM. d. Use the mount command to mount your CD-ROM as read-only. d Before you can read any of the files contained on the CD-ROM, you must first mount the CDROM.

When you create a new partition, you need to designate its size by defining the starting and ending _____________. cylinders When creating a new partition you must first specify its starting cylinder. You can then either specify its size or the ending cylinder.

Linux Interview Questions And Answers Set - 3What key combination can you press to suspend a running job and place it in the background? ctrl-z Using ctrl-z will suspend a job and put it in the background. The easiest, most basic form of backing up a file is to _____ it to another location. copy The easiest most basic form of backing up a file is to make a copy of that file to another location such as a floppy disk. What type of server is used to remotely assign IP addresses to machines during the installation process? A) SMB B) NFS C) DHCP D) FT E) HTTP C - 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. Which password package should you install to ensure that the central password file couldn't be stolen easily? A) PAM B) tcp_wrappers C) shadow D) securepass E) ssh C - 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. When using useradd to create a new user account, which of the following tasks is not done automatically. Choose one: a. Assign a UID. b. Assign a default shell. c. Create the user's home directory. d. Define the user's home directory. c The useradd command will use the system default for the user's home directory. The home directory is not created, however, unless you use the -m option. You want to enter a series of commands from the command-line. What would be the quickest way to do this? Choose One a. Press enter after entering each command and its arguments b. Put them in a script and execute the script c. Separate each command with a semi-colon (;) and press enter after the last command d. Separate each command with a / and press enter after the last command c 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. 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 asterisk. c The password field must not be blank before converting to shadow passwords. When you install a new application, documentation on that application is also usually installed. Where would you look for the documentation after installing an application called MyApp?

Choose one: a. /usr/MyApp b. /lib/doc/MyApp c. /usr/doc/MyApp d. In the same directory where the application is installed. c The default location for application documentation is in a directory named for the application in the /usr/doc directory. What file would you edit in your home directory to change which window manager you want to use? A) Xinit B) .xinitrc C) XF86Setup D) xstart E) xf86init 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. What command allows you to set a processor-intensive job to use less CPU time? A) ps B) nice C) chps D) less E) more Answer: B - 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. 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.

Linux Interview Questions And Answers Set - 4There 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. 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. 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 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. Which of the following tasks is not necessary when creating a new user by editing the /etc/passwd file? Choose one: a. Create a link from the user's home directory to the shell the user will use. b. Create the user's home directory c. Use the passwd command to assign a password to the account. d. Add the user to the specified group. Answer: a There is no need to link the user's home directory to the shell command. Rather, the specified shell must be present on your system. You issue the following command useradd -m bobm But the user cannot logon. What is the problem? Choose one: a. You need to assign a password to bobm's account using the passwd command. b. You need to create bobm's home directory and set the appropriate permissions. c. You need to edit the /etc/passwd file and assign a shell for bobm's account. d. The username must be at least five characters long. Answer: a The useradd command does not assign a password to newly created accounts. You will still need to use the passwd command to assign a password. 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.

Linux Interview Questions And Answers Set - 5Which 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