37138977 linux interview questions and answers2

Upload: rishikesh-sharma

Post on 04-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    1/46

    Linux Interview Questions and Answers

    We saw the mention on the Linux BIOS website about one milliondevices 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 [x86system-on-chip] STPC chip, I am told; also, there evidently is a Turkish-builtdigital TV that runs Linux BIOS. I have also heard that there are routers andmany other embedded devices running Linux BIOS. I think at this point that1 million is a low number. I am in contact with other set-top box vendorsthat are talking about numbers in the 10s of millions for their products.These numbers actually make the OLPC numbers seem small, which is in itamazing.

    Whats your goal for your talk at FOSDEM?Id like to communicate the basic ideas that Linux is a good BIOS, andwhy; why Linux BIOS is built the way it is; where we are going; and howpeople can help. Most importantly, why it all matters and it really mattersa lot. Were on the verge of losing control of the systems we buy, and weneed to make a conscious effort, as a community, to ensure this loss ofcontrol does not happen. That effort will not be without some sacrifice, but ifwe are to maintain our ability to use and program our machines, and havefun with them, we have to act now. Because, if the computing businessstops 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 theearlier warning from them, and maybe you too, in the next weeks ormonths. 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 withLinux, while broadening its copyright net to include manufacturers ofembedded systems. . . .Invoices will be dispatched in the next weeks or months a companyspokesperson confirmed.

    Those being billed will include 1,500 end-users who were earlier this yearinformed by SCO in writing they should seek legal advice as running Linuxviolated the companys copyright. Customers running Linux who were not onSCOs original mailing list will also be targeted.Chris Sontag says you end user pirates better not wait for the legal case tobe 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

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    2/46

    rights. Sontag warned that SCO had no qualms about enforcing its claimedrights anywhere in the world - including the UK.And if that doesnt work, then theyll huff and theyll puff and theyll blowyour 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 twoOSes work together on your systems$ Are you planning on using Linux onlyon low-end machines, while Monterey runs on IA-64, or will Linux be astopgap OS to run on your systems until Monterey is finished$Once again, we find yet another way any identical code could have come tobe in both SCOs code and Linux. We just reported yesterday that Compaqworked with Chinas Red Flag Linux with the goal of scaling to 64-bit. Nowwe find Old SCO was working hard to do the same thing. You think itspossible to write a kernel monitoring utility for Linux without touching orlooking 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 thatfacilitated it, when Old SCO itself was working to make Linux scale inprecisely some of the high-end ways they now list in their complaint as anoffense, is truly a mystery to me, what with all the possible suspects. Andsomething 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 paranoidor anything. But, you think$What does your future roadmap for SCO Unix look like$ - Are you going theSGI path and gradually phasing out your own Unix in favor of Linux, or areyou pursuing a parallel development path of both OSs$ What features

    currently in SCO that are not in Linux do you feel is necessary for widercorporate 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, youwill see that UnixWare 7 and SCO Open Server 5 will continue movingahead. Look forward to new developments as well.Enterprises building their businesses on a server platform are interested inreliability and availability. Although we believe in a high degree of reliabilitythat comes from the level of code inspection provided by the Open SourceCommunity, 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 thingsthat make is easier to never bring the system down, or to recover thesystem more quickly.Will SCO be contributing/open-sourcing any technology and/or patents thatit holds as part of its Linux adoption effort$ Also, did your market researchpan out - is Linux really being used in large businesses or is it still primarilyused by small startup companies strapped for cash$

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    3/46

    McCrabb: SCO is accelerating its participation in, and contributions to, theOpen Source Community. In some cases, we will be taking currenttechnology that we think is needed in the Linux market and driving itforward as the project maintainers. Right now, we are focusing on bringingsome of our high-performance Intel development tools to Linux. In other

    cases, we will make some sources available as reference documents, withouta specific intention of driving them forward as projects.

    How do you see your role fitting into the NCLB goals? With districtgoals? With building goals? With departmental goals?

    As Instructional Media and Technology Coordinator, my role is to help othersrealize the promise of technology to impact teaching, learning andleadership. Effectively integrating technology, using digital content toenhance learning to foster inquiry, analysis, collaboration, and creativity iswhat NCLB Title 2, Part D is about. Aligning federal, state, district andbuilding goals can only be done by facilitating ever-deepening conversationsabout what it means to use digital content and technology to change teacherand leadership practices. My role specifically has to focus on helpingteachers and administrators SEE what teaching and learning can be like,then supporting them as they grow to discover their own technology-enhanced teaching style. In fact, in my previous position, 3 initiatives werecelebrated as success stories in the new Educational Technology Plan.Aside from serving as a leader, Im also committed to handling the day-to-day aspects of dealing with technology equipment, software and supplypurchases. While I am a guide on the side in the use of technology in theclassroom, I can take a role that is more active when ensure district

    compliance with appropriate laws and administrative procedures. Technologycan bridge the chasm between classrooms, public perception, andadministrative procedure. Increasing transparency of what we are doing isfrightening. However, being unafraid in front of your class, your peers, tothe 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 theadvent of web-based tools for data aggregation/disaggregation, online

    publishing, communication and mass collaboration, people we neverimagined will be joining the dialogue. Ive experienced this first-hand withmy foray into blogging and podcasting, and the ability to collaborate withothers 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 almostbegan 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

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    4/46

    teenagers who spent many a night having conversations with people aroundmy home town. Now, those conversations are happening with people aroundthe globe. My role in this position will be to facilitate and model theappropriate use of the Read/Write Web. In a world where everyone cancontribute, the need for information literacy and problem-solving is critical.

    My experiences in guiding educators through Big6 information problem-solving approach has not only familiarized me with these approaches, butalso helped me guide others. Merging information-problem-solvingapproaches with the Levels of Technology Implementation (LOTI) frameworkcan help teachers move a lesson activity from a lower level of the revisedBlooms Taxonomy, such as synthesis to creation.Mass collaboration and peer production will pull the rug out from traditionaleducational technology efforts. In 10 years, if not less, educationaltechnology will become THE deciding factor in whether schools are judgedsuccessful or not, but will do so from a completely different direction thanwe imagined. In the past, ed-tech was about individual productivity.Increasingly in the future, it will be about mass communication, masscollaboration, working in virtual environments like Second Life mean thateducational technology will become an anachronism.

    What are MySQL transactions?A set of instructions/queries that should be executed or rolled back as asingle atomic unit.Explain multi-version concurrency control in MySQL.Each row has two additional columns associated with it - creation time anddeletion 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 locksallow locking of certain portions of the tables (those portions are referred toas tables), row-level locks are the most granular and allow locking of specificrows.Explain MySQL architecture.The front layer takes care of network connections and securityauthentications, the middle layer does the SQL query parsing, and then thequery is handled off to the storage engine. A storage engine could be either

    a default one supplied with MySQL (MyISAM) or a commercial one suppliedby a third-party vendor (ScaleDB, InnoDB, etc.)

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    5/46

    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 asshadow 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 Counterand general purpose registers.

    What is flag?

    Flag is a flip-flop used to store the information about the status of aprocessor 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 machinecode at a time. It doesnt require special instruction to store in a memory, itstores automatically. The Execution time is less compared to Interpreter.

    Differentiate between RAM and ROM?RAM: Read / Write memory, High Speed, Volatile Memory. ROM: Read onlymemory, Low Speed, Non Voliate Memory.

    Which transistor is used in each cell of EPROM?Floating .gate Avalanche Injection MOS (FAMOS) transistor is used in eachcell 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 temporarystorage of data & information between the main memory and the CPU(center processing unit). The cache memory is only in RAM.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    6/46

    What is interrupt?Interrupt is a signal send by external device to the processor so as torequest 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 onememory cell, Information stored as voltage level in a flip flop. Dynamic RAM:Refreshed periodically, 3 to 4 transistors are required to form one memorycell, 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 volatilememory. In secondary storage device the storage capacity is larger. It is anonvolatile memory. Primary devices are: RAM / ROM. Secondary devicesare: Floppy disc / Hard disk.

    Why does microprocessor contain ROM chips?Microprocessor contain ROM chip because it contain instructions to executedata.

    What is meant by LATCH?Latch is a D- type flip-flop used as a temporary storage device controlled bya timing signal, which can store 0 or 1. The primary function of a Latch isdata storage. It is used in output devices such as LED, to hold the data fordisplay.

    What is the difference between microprocessor and microcontroller?In Microprocessor more op-codes, few bit handling instructions. But inMicrocontroller: fewer op-codes, more bit handling Instructions, and also it isdefined as a device that includes micro processor, memory, & input / outputsignal lines on a single chip.

    What is the disadvantage of microprocessor?It has limitations on the size of data. Most Microprocessor does not supportfloating-point operations.

    Is the data bus is Bi-directional?The data bus is Bi-directional because the same bus is used for transfer ofdata between Micro Processor and memory or input / output devices in boththe direction.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    7/46

    Is the address bus unidirectional?The address bus is unidirectional because the address information is alwaysgiven 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 effecttransistor.

    What is 1st / 2nd / 3rd / 4th generation processor?The processor made of PMOS / NMOS / HMOS / HCMOS technology is called1st / 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). Similarly8086 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 instructionsfrom memory, decodes and executes the instructions. Most Micro Processor

    is single- chip devices.

    What command would you use to create an empty file withoutopening it to edit it?

    You use the touch command to create an empty file without needing to openit. Answers a and e point to invalid commands, though either of these mightactually be aliased to point to a real command. Answers b and c utilizeeditors, 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 aLinux machine?The commands used to restart a Linux box are shutdown -r, reboot, and init6. Answers c and e are incorrect. Both of these are used to shut down aLinux box, not restart it.init 6 command is used to restart the Linux machine .

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    8/46

    What do you type to stop a hung process that resists the standardattempts to shut it down?The kill command by itself tries to allow a process to exit cleanly. You typekill -9 PID, on the other hand, to abruptly stop a process that will not quit byany 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 notwork 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 toinvalid commands. Answer b is a valid command, but does not set thecurrent run level. The run level command displays the current run level, andthe 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 adirectory, it will only delete files. Answers d and e point to a non-existentcommand.

    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. Theanswers for a and d both point to an invalid command. The answer for bpoints to a valid command. Typing this answer in with a valid file name willeven give you some output. However, the last command tells you who islogged 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 thebeginning of a file, not the end.last choice will be correct answer because only tail command is used to seethe 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 mailservice runs through the super daemon, not on its own. Answers c and epoint to nonexistent, or at least nonstandard daemons. Answer d points tothe Usenet news

    daemon.

    Who owns the data dictionary?The SYS user owns the data dictionary. The SYS and SYSTEM users arecreated when the database is created. The SYS user owns the datadictionary. The SYS and SYSTEM users are created when the database iscreated.how we can configure sata hard derive during redhat 9 installation.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    9/46

    Have the data driver on a floppy drive. At the start of installation, when uboot from the CD/DVD, on the prompt, write dd. It will ask for the driverfloppy later on and will load the sata driver. Then you can configure/partitionthe 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 timerepeatedly ,at command is used to schedule the task only once i.e. to runonly one time.

    What is difference between user right and user permission?user rights:user rights is that user is authorized to used password. if hispassword/file/dir is expired he is not able to loginuser permission:permission is user is permitted to use file/directory. that isauthenticationif 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/wkeeps track of IP addresses rather than requiring an administrator tomanage the task. That means new computer can be added to the networkwithout any risk of manually assigning unique IP address.Describe the boot process of your favorite Linux in as much detail as youcan.Boot process takes place in 4 scenes with 4 main characters.

    Scene 1when the computeris switched on, it automatically invokes BIOS[a ROM chip embedded in themotherboard].The BIOS will start the processor and perform a POST[poweron self test] to check whether the connected device are ready to use and areworking properly.Once the POST is completes BIOS will jump to a specified location in theRAM and check for the booting device. The boot sector is always the firstsector 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 GRUBis the boot loaders commonly available. It will help the user to select variousboot options. Depending on the boot option selected the kernel is loaded.scene 3After kernel is loaded the kernel will take the control of the booting processand it will initialize all the hardwares including I/O processors etc.kernel thencreates a root device and mounts the partitions.Scene 4

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    10/46

    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 -zxvfthen for first compile it using make and make install

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

    You are debugging a new application that is crashing. You want towatch the messages as they are being written to the log. Whatcommand should you use?The tail command allows you to keep a log open and see each new messageas it is written to the log.

    Which of the following tasks cannot be accomplished with the touchcommand?

    The touch command is usually used to modify either a files access ormodification 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 optionretains the original permissions.

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

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

    You attempt to delete a file called sales.mem using the rm commandbut the command fails. What could be the problem?In order to delete a file, you must have write rights to the directorycontaining 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 toany one character so sale$ would not find sale.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    11/46

    You have a file named kickoff and would like to find every linebeginning with a number. Which of the following commands willaccomplish this?The command grep ^[0-9] kickoff will cause grep to search the file kickofffor 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 oflines containing the specified pattern rather than displaying the linescontaining the pattern.

    You want to verify which lines in the file kickoff contain Bob. Whichof the following commands will accomplish this?

    The -n option when used with sed prints only the lines containing thepattern. In this case, the pattern is Bob and the file to be searched iskickoff.

    You have a file called docs.Z but do not know what it is. What is theeasiest way to look at the contents of the file?The .Z extension indicates that this is a file that has been compressed usingthe compress utility. The zcat utility provides the ability to display thecontents 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 tomount your CD-ROM, then your users will be able to mount it.What is contained in the directoryThe /proc directory is a virtual file system that contains system information.

    After copying a file to a floppy disk, what should you do beforeremoving the disk?If you do not unmount the floppy before removing it, the files on the floppymay become corrupted.

    You have set quotas for all your users but half of your users areusing more space than they have been allotted. Which of thefollowing could be the problem?Quotas are set on a partition by partition basis. If your users have homedirectories on different partitions, you will need to configure quotas for eachpartition.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    12/46

    What command should you use to check the number of files and diskspace used and each users defined quotas?The repquota command is used to get a report on the status of the quotasyou have set including the amount of allocated space and amount of usedspace.

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

    By creating a link to the file in each users home directory, each user is ableto easily open and edit the spreadsheet. Also, any changes that are madeare seen by all the users with access.

    You have a file called sales data and create symbolic links to it inbobs home directory. Bob calls you and says that his link no longerworks. How can you fix the link?

    Because the link in bobs directory is a symbolic link, if the file sales data inthe /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 userscreated in his home directory but you do not know which one. Howcould you use the find command to locate this file?

    When using the find command to locate a file by name you must specify thestarting place in the directoryhierarchy 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 thefile?The chown command can be used by root to give ownership of a file to anyuser.

    What is meant by sticky bit?When the sticky bit is set on a world writable directory, only the owner candelete 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.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    13/46

    Which of the following commands will replace all occurrences of theword rate with the word speed in the file racing?When using sed to do a search and replace, its default action is to onlyreplace the first occurrence in each line. Adding the g makes sed replace alloccurrences 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 changeeach tab to four spaces. What command can you use to accomplishthis?

    By default, expand converts tabs to eight spaces. Use the -t option tochange 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 thespecified file are displayed. The asterick tells head to display the content ofeach 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-byteoctal numbers.

    What would be the result of the command paste -s dog cat ?The paste text filter usually joins two files separating the corresponding lineswith 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 ofthe following commands will accomplish this?

    The default page length when using pr is 66 lines. The -l option is used tospecify 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 lineand 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 lastfifteen lines of each specified file.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    14/46

    You have the file phonenos that contains telephone numbers andnames separated by a comma. You want to change each comma to asemicolon. Which of the following will accomplish this?The tr utility is used to replace one string by another. Here the input for tr isprovided 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 yourdisplay?

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

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

    The /etc portion of the file system contains a number of system and daemonconfiguration files. Answers a, c, d, and e are valid first-level directories, butare incorrect. The /var directory contains items that change on a regularbasis, such as log files and print and mail spool directories. The /bindirectory contains system binaries, whereas the /sbin directory containsbinaries that run with SUID privileges or as a specific user. The /lib directorycontains system libraries, both shared and non-shared.

    What command allows you to set a processor-intensive job to useless CPU time?The nice command is used to change a jobs priority level, so that it runsslower 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 informationabout a package?

    The man command pulls up man pages, the info command pulls up texinfopages which have replaced the man pages for some packages, and theapropos command helps you to find related commands. Answers b and e arenot methods of getting information about a packageWhere is a good place to store shell scripts that are for use by the authorIt 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 puttingtogether this mail servers list of components$ [Choose all correct answers]A mail server benefits from a large amount of RAM, a fast CPU, and largeamounts of fast-access hard drive space. The reason it benefits from havinga lot of memory is that it can then handle groups of mail messages all atonce. A fast CPU helps it move through processes more quickly, especially

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    15/46

    when it comes to generating postings to large mailing lists. Having a lot ofhard 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 mailservice. A Linux box serving such a purpose would only be slowed down witha 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-sidescript?

    JavaScript is the only client-side script listed. Java and C++ are completeprogramming languages. Active Server Pages are parsed on the server with the results being sent tothe client in HTML.

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

    You can use a DHCP server to assign IP addresses to individual machinesduring the installation process. Answers a, b, d, and e list legitimate Linuxservers, 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 filestorage server that allows people to browse and retrieve information bylogging in to it, and HTTP is for the Web

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

    installation?You can use an NFS server to provide the distribution installation materialsto 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 thesuperdaemon which controls all intermittently used network services. TheFSSTND is the Linux File System Standard. DNS provides domain nameresolution, and NNTP is the transfer protocol for usenet news.

    Which password package should you install to ensure that thecentral password file couldnt be stolen easily?

    The shadow password package moves the central password file to a moresecure location. Answers a, b, and e all point to valid packages, but none ofthese places the password file in a more secure location. Answer d points toan invalid package.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    16/46

    Which command works in almost all distributions to create a bootdisk ?The mkbootdisk command creates a boot disk. Answers b and c areincorrect. 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 analias for the shutdown routine that ensures this happens. Settings foripchains are lost during a reboot or shutdown and there is no setting toensure they are automatically saved. Answers a, b, and c are completelyincorrect. Answer e is incorrect, but you can save them by hand if youchoose to.

    Which package provides secure remote login sessions, such assecure telnet logins?

    The ssh package allows you to configure secure telnet sessions and otherremote logins. Answer a points to an invalid package. Answer c points to avalid package, but shadow handles passwords, not data encryption. Answersd and e point to firewalling packages, which regulate what passes in and outof a LAN, but do not handle data encryption.

    Which package can you use to regulate which network traffic isallowed to enter a specific machine, but not on any other machines?The tcp_wrappers package is used to regulate the TCP/IP network trafficcoming 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 justone machine. Answer d points to the commun-ications protocol used totransmit data over the Internet. Answer e points to an invalid package.

    What type of server is used to remotely assign IP addresses tomachines during the installation process?you can use a DHCP server to assign IP addresses to individual machinesduring the installation process. Answers a, b, d, and e list legitimate Linuxservers, 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 isfor file sharing across Linux net-works. FTP is a file storage server thatallows people to browse and retrieve information by logging in to it, andHTTP is for the Web

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    17/46

    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. DiskDruid is made by Red Hat and used in its distribution along with some

    derivatives. Partition Magic and System Commander are tools made bythird-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 systemThe /etc portion of the file system contains a number of system and daemonconfiguration files. Answers a, c, d, and e are valid first-level directories, butare incorrect. The /var directory contains items that change on a regularbasis, such as log files and print and mail spool directories. The /bindirectory contains system binaries, whereas the /sbin directory containsbinaries that run with SUID privileges or as a specific user. The /lib directorycontains 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 ontothe file system. Answers b and c refer to valid items, but they are not usedto manage the file system. The file /etc/services maps networking servicesto the ports they utilize, and /etc/smb.conf is the configuration file for theSamba service. Answers d and e point to files that do not exist.

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

    The /etc portion of the file system contains a number of system and daemonconfiguration files. Answers a, c, d, and e are valid first-level directories, butare incorrect. The /var directory contains items that change on a regularbasis, such as log files and print and mail spool directories. The /bindirectory contains system binaries, whereas the /sbin directory containsbinaries that run with SUID privileges or as a specific user. The /lib directorycontains 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 usedto manage the file system. The file /etc/services maps networking servicesto the ports they utilize, and /etc/smb.conf is the configuration file for theSamba service. Answers d and e point to files that do not exist.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    18/46

    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 bothpoint to the same shell, the bash shell. However, assigning this shell to aPOP3 only user gives him or her login access, which is what you are trying toavoid. Answers d and e are both invalid options in a standard setup.

    What command would you use to create an empty file withoutopening it to edit it?You use the touch command to create an empty file without needing to openit. Answers a and e point to invalid commands, though either of these mightactually be aliased to point to a real command. Answers b and c utilizeeditors, 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 toinvalid commands. Answer b is a valid command, but does not set thecurrent run level. The run level command displays the current run level, andthe 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 mailservice runs through the superdaemon, not on its own. Answers c and epoint to nonexistent, or at least nonstandard daemons. Answer d points tothe Usenet news daemon.

    Who owns the data dictionary ?The SYS user owns the data dictionary. The SYS and SYSTEM users arecreated when the database is created.The SYS user owns the data dictionary. The SYS and SYSTEM users arecreated 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 ubootfrom 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 thedrive using disk druid or fdisk.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    19/46

    What is difference between AT and CRON?cron can be set only for a particular time but at is used to schedule andexecuteContact Author Contact Author Cron command is used to schedule the taskdaily 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 hispassword/file/dir is expired he is not able to loginuser permission:permission is user is permitted to use file/directory. that isauthenticationif 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 networkeddevices (clients) to obtain the IP address.Contact Author Contact Author Dynamic addressing simplifies networkadministration because the s/w keeps track of IP addresses rather thanrequiring an administrator to manage the task. That means new computercan be added to the network without any risk of manually assigning uniqueIP address.Describe the boot process of your favorite Linux in as much detail as youcan.Booting process : first BIOS loads the boot loaders, then boot loaders loads

    the kernel ,then kernel mount the file systems and drivers installation willtakes 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 -zxvfthen for first compile it using make and make installFor proper installation of the driver read the INSTALL / README file given inthe tarball.

    What is difference between user right and user permission?

    user rights:user rights is that user is authorized to used password. if hispassword/file/dir is expired he is not able to login userpermission:permission is user is permitted to use file/directory. that isauthentication if he is authentication for particular file or not.it might be true as per my suggestion.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    20/46

    What is the real mean of DHCP?Dynamic addressing simplifies network administration because the s/wkeeps track of IP addressesrather than requiring an administrator to manage the task. That means new

    computer can be added tothe network without any risk of manually assigning unique IP address.

    Describe the boot process of your favorite Linux in as much detail asyou can?

    Boot process takes place in 4 scenes with 4 main characters.Scene 1when the computer is switched on, it automatically invokes BIOS[a ROM chipembedded in the motherboard].The BIOS will start the processor andperform a POST[power on self test] to check whether the connected deviceare ready to use and are working properly. Once the POST is completesBIOS will jump to a specified location in the RAM and check for the bootingdevice. The boot sector is always the first sector of the hard disk and BIOSwill load the MBR into the memory.Scene 2Here the boot loader takes the control of the booting process.LILO or GRUBis the boot loaders commonly available. It will help the user to select variousboot options. Depending on the boot option selected the kernel is loaded.scene 3After kernel is loaded the kernel will take the control of the booting processand it will initialize all the hardwares including I/O processors etc.kernel then

    creates a root device and mounts the partitions.Scene 4INIT 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 minimumpartitions to installthe Linux.

    2. dmesg or /var/log/messagesWhat command you execute to display the last five commands you haveentered$ Which partitions might you creates on mail server HDDs other thanthe root, swap and boot partitions$ Which partitioning tool is available in alldistributions$ Which two commands can you use to delete directories$Which file defines all users on your system$1. history|tail -52. /var

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    21/46

    3. fdisk, parted4. rm, rmdir5. /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 -zxvfthen for first compile it using make and make installFor proper installation of the driver read the INSTALL / README file given inthe tarball.

    What does Security-enhanced Linux give me that standard Linuxcant?

    The Security-enhanced Linux kernel enforces mandatory access controlpolicies that confine user programs and system servers to the minimumamount 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 whencompromised (via buffer overflows or misconfigurations, for example) isreduced or eliminated. This confinement mechanism operates independentlyof the traditional Linux access control mechanisms. It has no concept of aroot super-user, and does not share the well-known shortcomings of thetraditional Linux security mechanisms (such as a dependence onsetuid/setgid binaries).The security of an unmodified Linux system dependson the correctness of the kernel, all the privileged applications, and each oftheir configurations. A problem in any one of these areas may allow thecompromise of the entire system. In contrast, the security of a modified

    system based on the Security-enhanced Linux kernel depends primarily onthe correctness of the kernel and its security policy configuration. Whileproblems with the correctness or configuration of applications may allow thelimited compromise of individual user programs and system daemons, theydo not pose a threat to the security of other user programs and systemdaemons or to the security of the system as a whole.

    What is SELinux?SELinuxSecurity-enhanced Linux is a research prototype of the Linux kernel and a

    number of utilities with enhanced security functionality designed simply todemonstrate the value of mandatory access controls to the Linux communityand how such controls could be added to Linux. The Security-enhancedLinux kernel contains new architectural components originally developed toimprove the security of the Flask operating system. These architecturalcomponents provide general support for the enforcement of many kinds ofmandatory access control policies, including those based on the concepts ofType Enforcement, Role-based Access Control, and Multi-level Security.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    22/46

    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 thendo 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 accessedwithin the last 10 daysfind / -type f -atime -10 > December.filesThis command will find all the files under root, which is /, with file type isfile. -atime -30 will give all the files accessed less than 10 days ago. Andthe output will put into a file call Monthname.files.

    What is the main advantage of creating links to a file instead ofcopies of the file?The main advantage is not really that it saves disk space (though it doesthat too) but, rather, that a change of permissions on the file is applied to allthe link access points. The link will show permissions of lrwxrwxrwx but thatis 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, youonly have to do it on the original. With copies you have to find all of thecopies 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 revisioncontrol system which extends the notion of revision control from a collectionof files in a single directory to a hierarchical collection of directoriesconsisting of revision controlled files. These directories and files can becombined together to form a software release.There are some useful commands that are being used very often. They arecvs checkout

    cvs updatecvs addcvs removecvs commit

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    23/46

    What is NFS? What is its job?NFS stands for Network File System. NFS enables filesystems physicallyresiding on one computer system to be used by other computers in thenetwork, 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 othermachines on the network.

    What are the techniques that you use to handle the collisions in hashtables?We can use two major techniques to handle the collisions. They are openaddressing and separate chaining. In open addressing, data items that hashto a full array cell are placed in another cell in the array. In separatechaining, each array element consists of a linked list. All data items hashingto 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 functionis to take a range of key values and transform them into index values insuch a way that the key values are distributed randomly across all theindices of a hash table.

    What is Write Command ?The write command enables you to write an actual message on the otherterminal online. You have to issue the write command with the login ID of

    the user with whom you want to communicate. The write command informsthe user at the other end that there is a message from another user. writepastes that message onto the other users terminal if their terminals writepermissions are set. Even if they are in the middle of an edit session, writeoverwrites whatever is on the screen. The edit session contents are notcorrupted; 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 actualconversation 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, youbecome the system. The root login is also sometimes called the super userlogin. With one simple command, issued either on purpose or by accident,you can destroy your entire Linux installation. For this reason, use the rootlogin only when necessary. Avoid experimenting with commands when youdo log in as root.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    24/46

    How big should the swap-space partition be?Swap space is used as an extension of physical RAM, the more RAM youhave, the less swap space is required. You can add the amount of swapspace and the amount of RAM together to get the amount of RAM Linux willuse. For example, if you have 8MB of RAM on your machines motherboard,

    and a 16MB swap-space partition, Linux will behave as though you had24MB of total RAM.

    Which field is used to define the users default shell?

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

    When you create a new partition, you need to designate its size bydefining the starting and ending?

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

    What can you type at a command line to determine which shell youare using?echo $SHELL-The name and path to the shell you are using is saved to theSHELL environment variable. You can then use the echo command to printout 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 usingthe fc command, you would type?

    fc -5-The fc command can be used to edit or rerun commands you havepreviously 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 onyour 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 onyour 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 isthe super user account also known as root.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    25/46

    What daemon is responsible for tracking events on your system?Syslogd-The syslogd daemon is responsible for tracking system informationand saving it to specified log files.

    Where standard output is usually directed?

    To the screen or display-By default, your shell directs standard output toyour screen or display.

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

    Top-The top utility shows a listing of all running processes that isdynamically updated

    Who owns the data dictionary?

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

    Compare Linux credit based algorithm with other schedulingalgorithms?For the conventional time shared processes, Linux uses a prioritized, credit-based algorithm. Each process possesses a certain number of schedulingcredits; when a new task must be chosen to run, the process with mostcredits is selected. Every time that a timer interrupt occurs, the currentlyrunning process loses one credit; when its credits reaches zero, it issuspended and another process is chosen. If no runnable processes haveany 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 + priorityThe above scheduling class is used for time-shared process and the in Linuxfor 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 inaddition to its scheduling class. In time-sharing scheduling, however,processes of different priorities can still compete with one another to someextent; in real-time scheduling, the scheduler always runs the process with

    the highest priority. Among processes ofequal priority, it runs the process that has been waiting longest. The onlydifference between FCFS and RR scheduling is that FCFS processes continueto run until they either exit or block, whereas a round-robin process will bepreempted after a while and will be moved to the end of the schedulingqueue, so round-robin processes of equal priority will automatically timeshare among themselves.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    26/46

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

    time processes.

    SQL interview questions and answers

    1. 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 afterretrieving 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 basicform 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 ofWHERE 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 ofindexes) 2] properly locate different DB objects across different tablespaces, files and soon.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 withhaving indexes? - 1. Faster selects, slower updates. 2.

    Extra storage space to store indexes. Updates are slower because in addition to updatingthe table you have to update the index.

    7. What is a "join"? - join used to connect two or more tables logically with or withoutcommon field.

    8. What is "normalization"? "Denormalization"?Why do you sometimes want todenormalize? - Normalizing data means eliminating redundant information from a tableand organizing the data so that future changes to the table are easier. Denormalizationmeans allowing redundancy in a table. The main benefit of denormalization is improvedperformance 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 supportedby 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 notprovide one. FOREIGN KEY - validates that every value in a column exists in a columnof another table. CHECK - checks that every value stored in a column is in somespecified list. Each type of constraint performs a specific type of action. Default is not a

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    27/46

    constraint. NOT NULL is one more constraint which does not allow values in the specificcolumn 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 searchvalues in tables. The three most commonly used index-types are: - B-Tree: builds a treeof 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 possiblevalue of the column. Each bit string has one bit for each row. Needs only few space andis 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 torepresent a text string such as a composite of keys or partial keys, and compresses theunderlying 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 somethingwhich comes mainly fromdatabase theory. From its behavior is almost the same as an UNIQUE INDEX, i.e. theremay only be one of each value in this column. If you call such an INDEX PRIMARYinstead of UNIQUE, you say something about

    your table design, which I am not able to explain in few words. Primary Key is a type ofa constraint enforcing uniqueness and data integrity for each row of a table. All columnsparticipating 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 thatsp1 has functional dependency on sp2.

    13.What is a "trigger"? - Triggers are stored procedures created in order to enforceintegrity rules in a database. A trigger is executed every time a data-modificationoperation occurs (i.e., insert, update or delete). Triggers are executed automatically onoccurance of one of the data-modification operations. A trigger is a database objectdirectly associated with a particular table. It fires whenever a specific statement/type ofstatement is issued against that table. The types of statements are insert,update,delete andquery statements. Basically, trigger is a set of SQL statements A trigger is a solution tothe restrictions of a constraint. For instance: 1.A database column cannot carry PSEUDOcolumns as criteria where a trigger can. 2. A database constraint cannot refer old and newvalues 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 processthe 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 foundonly 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 toselect data from one or more tables. A view is like a table but it doesnt physically takeany space. View is a good way to present data in a particular format if you use that queryquite often. View can also be used to restrict users from accessing the tables directly.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    28/46

    Linux command line Q&A

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

    tail -15 dog cat horseThe tail utility displays the end of a file. The -15 tells tail to display the last fifteen linesof each specified file.

    2. Who owns the data dictionary?The SYS user owns the data dictionary. The SYS and SYSTEM users are created whenthe database is created.

    3. You routinely compress old log files. You now need to examine a log from twomonths 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 sameway that cat displays a file.

    4. You suspect that you have two commands with the same name as the command isnot producing the expected results. What command can you use to determine the

    location of the command being run?whichThe which command searches your path until it finds a command that matches thecommand 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. Whatcommand can you use to determine its purpose.

    whatisThe whatis command displays a summary line from the man page for the specifiedcommand.

    6. You wish to create a link to the /data directory in bobs home directory so you issuethe 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 optionIn 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 displayrepresents the files ___________.

    typeThe first character of the permission block designates the type of file that is beingdisplayed.

    8. What utility can you use to show a dynamic listing of running processes?__________topThe top utility shows a listing of all running processes that is dynamically updated.

    9. Where is standard output usually directed?to the screen or displayBy default, your shell directs standard output to your screen or display.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    29/46

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

    tar xf MyBackup.tar memo.benThis command uses the x switch to extract a file. Here the file memo.ben will be restoredfrom the tarfile MyBackup.tar.

    11.Y

    ou need to view th

    e contents of th

    e tarfile called MyBackup.tar.Wh

    at commandwould you use?tar tf MyBackup.tarThe t switch tells tar to display the contents and the f modifier specifies which file toexamine.

    12.You want to create a compressed backup of the users home directories. Whatutility should you use?

    tarYou can use the z modifier with tar to compress your archive at the same time as creatingit.

    13.What daemon is responsible for tracking events on your system?syslogdThe syslogd daemon is responsible for tracking system information and saving it tospecified log files.

    14.You have a file called phonenos that is almost 4,000 lines long. What text filter canyou use to split it into four pieces each 1,000 lines long?splitThe split text filter will divide files into equally sized pieces. The default length of eachpiece is 1,000 lines.

    15.You would like to temporarily change your command line editor to be vi. Whatcommand should you type to change it?

    set -o viThe set command is used to assign environment variables. In this case, you areinstructing your shell to assign vi as your command line editor. However, once you logoff and log back in you will return to the previously defined command line editor.

    16.What account is created when you install Linux?rootWhenever you install Linux, only one user account is created. This is the superuseraccount also known as root.

    17.What command should you use to check the number of files and disk space used andeach users defined quotas?

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

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    30/46

    Linux application programming questions

    1. Explain the difference between a static library and a dynamic library? - Staticlibrary 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, youcan do it by running ar command. Generally a static library has a .a extension, and youcan 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 thedirectories which should be searches for libraries before the standard directories aresearched.

    5. How do you create a shared library? - Create the object file with -fPIC for position-independent code, then run gcc with -shared option.

    6.

    How do you install a sh

    ared library? - Run ldconfig in the standard directory that itsinstalled 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 questions

    1. How do you find out whats your shell? - echo $SHELL2. Whats the command to find out todays date? - date3. Wh

    ats th

    e command to find out users on th

    e system? - who4. How do you find out the current directory youre in? - pwd5. How do you remove a file? - rm6. How do you remove a - rm -rf7. How do you find out your own username? - whoami8. 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? - wc10.How do you search for a string inside a given file? - grep string filename11.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 to65535.

    14.How do you list currently running process? - ps15.How do you stop a process? - kill pid16.How do you find out about all running processes? - ps -ag17.How do you stop all the processes, except the shell window? - kill 018.How do you fire a process in the background? - ./process-name &

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    31/46

    19.How do you refer to the arguments passed to a shell script? - $1, $2 and so on. $0 isyour script name.

    20.Whats the conditional statement in shell scripting? - if {condition} then fi21.How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt, -ge22.How do you test for file properties in shell scripts? - -s filename tells you if the file is

    not empty, -f filename tells you wh

    eth

    er th

    e 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, -atests 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} done28.

    How does a case statement look in s

    hell scripts? - case {variable} in {possible-value-1}) {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.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    32/46

    Linux Interview Questions And Answers Set - 1

    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 eachspecified file.

    Who owns the data dictionary?The SYS user owns the data dictionary. The SYS and SYSTEM users are created when thedatabase 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 thatcat 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

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    33/46

    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 fromthe 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

    sh

    ould 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 logfiles.

    Y

    ouh

    ave a file called ph

    onenos th

    at is almost 4,000 lines long.Wh

    at text filter can you useto 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 is1,000 lines.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    34/46

    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 youwill 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 alsoknown 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 includingthe 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 sh

    adow 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, yourpassword 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.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    35/46

    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 questions

    By admin | July 22, 2007

    1. How do you find out whats your shell? - echo $SHELL2. Whats the command to find out todays date? - date3. Whats the command to find out users on the system? - who4. How do you find out the current directory youre in? - pwd5. How do you remove a file? - rm6. How do you remove a - rm -rf7. How do you find out your own username? - whoami8. How do you send a mail message to somebody? - mail

    [email protected] -s Your subject -c [email protected]. How do you count words, lines and characters in a file? - wc10.How do you search for a string inside a given file? - grep string filename11.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 to65535.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    36/46

    14.How do you list currently running process? - ps15.How do you stop a process? - kill pid16.How do you find out about all running processes? - ps -ag17.How do you stop all the processes, except the shell window? - kill 018.How do you fire a process in the background? - ./process-name &19.

    How do you refer to t

    he arguments passed to a s

    hell script? - $1, $2 and so on. $0 isyour script name.

    20.Whats the conditional statement in shell scripting? - if {condition} then fi21.How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt, -ge22.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, -atests 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 s

    hell scripting? - if {condition} t

    hen{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} done28.How does a case statement look in shell scripts? - case {variable} in {possible-value-

    1}) {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.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    37/46

    Linux Interview Questions And Answers Set - 2

    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 thekernel.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 toremove 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 listis then piped to the cpio utility as a list of files to include and the output is saved to a file calledbackup.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. Youcan 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) NFSE - You can use an NFS server to provide the distribution installation materials to the machineon 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 networkservices. The FSSTND is the Linux File System Standard. DNS provides domain nameresolution, 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.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    38/46

    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 storeddirectory 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 thenecessary 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 CD-ROM.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    39/46

    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 - 3

    What 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 locationsuch 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 theinstallation process. Answers a, b, d, and e list legitimate Linux servers, but these servers do notprovide IP addresses. The SMB, or Samba, tool is used for file and print sharing across multi-OSnetworks. An NFS server is for file sharing across Linux net-works. FTP is a file storage serverthat allows people to browse and retrieve information by logging in to it, and HTTP is for theWeb.

    Which password package should you install to ensure that the central password file

    couldn't be stolen easily?

    A) PAMB) tcp_wrappers

    C) shadow

    D) securepass

    E) ssh

    C - The shadow password package moves the central password file to a more secure location.

  • 7/29/2019 37138977 Linux Interview Questions and Answers2

    40/46

    Answers a, b, and e all point to valid packages, but none of these places the password file in amore 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.

    Ch

    oose 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 homedirectory is not created, however, unless you use the -m option.

    You want to enter a series of commands from t

    he command-line.

    What would be t

    hequickest 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 shouldbe executed serially. If these were commands that you would frequently want to run, then a scriptmight be more efficient. However, to run these commands only once, enter the commandsdirectly 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