Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Submitted By Nitesh Daga Reg 11103 !" Ro##$ K1R%"B3& Se'$ K1R%"
LPU
Q1. a) Is there a way to increase the priority of a program to make it run Explain in detail. Ans.
faster?
The priority or importance of a job is defined by it's nice number. A program with a high nice number is friendly to other programs, other users and the system; it is not an important job. The lower the nice number, the more important a job is and the more resources it will take without sharing them. Making a job nicer by increasing its nice number is only useful for processes that use a lot of C ! time "compilers, math applications and the like#. rocesses that always use a lot of $%& time are automatically rewarded by the system and gi'en a higher priority "a lower nice number#, for e(ample keyboard input always gets highest priority on a system. )efining the priority of a program is done with the nice command. Most systems also pro'ide the *+) renice command, which allows you to change the niceness of a running command, a way to increase the priority of a program to make it run faster. $t is ,&T a good idea to nice or renice an interacti'e program or a job running in the foreground. !se of these commands is usually a task for the system administrator.
renice
Changes the priority of an existing command. You may use the options -u to change the priorities of all processes for a particular user name and -g to change priorities for all processes of a particular group. The default is to change via the process id number.
Example:
renice +20 2222
This would change the priority of process 2222 to +20 (minimum priority .
LPU
) !ompare "#$%E and &'E. (rite key attri utes of an open source software. Ans.
!"# is the most outstanding$ offering a true consistent des%top$ flexible$ with an extremely elegant architecture$ using components (li%e &icrosoft's C(& and C(&+ $ intercommunication$ performance etc. )t is constantly evolving$ and is developed in C++. )ts applications have an familiar integrated loo%* and*feel$ is light and mature. +eople say that !"# , is shiny diamond$ ready to be used$ and is my first suggestion to you. -.(&# also brings the integrated des%top proposal$ but it is far from the maturity and ease*of*use of !"#. /rom the other side$ is very well supported by the comunity$ and good improvements are appearing.
!"# and -nome are complete des%top environments that consist of a large number of tightly integrated yet still separate pieces of software. -nome uses a window manager called metacity$ !"# uses %win. 0oth these des%tops can be used with any other window manager if you do not li%e the default choice. 1inux is li%e 1ego. You can build your own des%top environment. 0oth !"# and -nome are 2ust big pac%ages with software aimed to loo% and feel the same way$ wor% well together and generally give you a nice experience. )f you disli%e a component$ then replace it with something else. )t's that simple. 3pplication that are 4made for gnome4 or 4made for %de4 can be used with any des%top. This only means that that the program use a set of library functions found in their underlying gnome*libs or %delibs. You do not need to use the actual des%tops to use the applications$ software made for !"# and -nome can be used with any window manager 5 des%top as long as you got the proper libraries installed. There is no reason to use only applications made for the des%top you prefer$ the 4best software4 for one tas% is made for !"#$ the best for another tas% is made for -nome. 6se the best from both worlds. 0oth !"# and -nome can be customi7ed to behave exactly the way you want. 8hat des%top you prefer is your own choice and preference. 8hen in doubt$ try to learn both. (r experiment with other des%tops. 9emember$ :nix applications are not loc%ed to the des%top they are made for$ -nome applications can be used in !"# and vice versa. There is no 4best des%top4$ but there is a des%top that's best for you. )t's a matter of preference$ and hardware.
LPU
Reliability Stability Auditability ost !le"ibility and !reedom Support and Accountability
Introduction
(pen ;ource's proponents often claim that it offers significant benefits when compared to typical commercial products. Commercial products typically favour visible features (giving mar%eting advantage over harder*to measure <ualities such as stability$ security and similar less glamorous attributes. 3s a shorthand$ we shall describe this phenomenon as quality vs features. (pen ;ource ;oftware developers are evidently motivated by many factors but favouring features over <uality is not noticeable amongst them. /or many developers$ peer review and acclaim is important$ so it's li%ely that they will prefer to build software that is admired by their peers. =ighly pri7ed factors are clean design$ reliability and maintainability$ with adherence to standards and shared community values preeminent. 4The (pen ;ource community attracts very bright$ very motivated developers$ who although fre<uently unpaid$ are often very disciplined. )n addition$ these developers are not part of corporate cultures where the best route to large salaries is to move into management$ hence some (pen ;ource developers are amongst the most experienced in the industry. )n addition all users of (pen ;ource products have access to the source code and debugging tools$ and hence often suggest both bug fixes and enhancements as actual changes to the source code. Conse<uently the <uality of software produced by the (pen ;ource community sometimes exceeds that produced by purely commercial organisations.4 4... This psychological effect is really important in explaining why so many pro2ects are started out of the blue$ with seemingly no reward. 3lthough it may seem surprising at first view$ it is not that rare if we put it in context. /or instance$ most of the history of information science and programming$ in fact$ started this way in academic circles. 3nd still many non*applied sciences advance than%s to the wor% of scientists who feel more rewarded by research in itself than by money. 3lthough this effect of self* reward is perhaps not so common in the world of proprietary software development$ it is today a strong force in the open source community. 3nd what is even more important$ it seems clear that it has an extremely good impact on developer's productivity$ an interesting effect in a discipline where differences in productivity from person to person are often a matter of orders of magnitude.4 There is abundant anecdotal evidence for truth in those claims but reliable and comparable statistical measures are not available to our %nowledge. There are a number of principal reasons adduced for this>
Authors are moti#ated by pride and peer recognition rather than a de#elopment plan supplied by the marketing department$ %ost want to use the software themsel#es and they prefer robustnesss before adding features$
LPU
Authors are likely to consider it a &win' if they can reduce the comple"ity and impro#e the maintainability of software$ (his rarely comes high on the product plan for commercial software$ )here se#eral authors work in parallel* the best+of+crop solution can be chosen in place of the only solution ,as would be typical for a commercial product-$ )here source code is freely published and widely distributed* the users of the product will often disco#er and correct defects themsel#es$ .f no commercial entity benefits from that work* the moti#ation to do so for the common good is much higher$
&any of the <ualities that are claimed for (pen ;ource ;oftware are exactly those that are wanted by those who have to use or deploy software$ yet run almost directly counter to the commercial needs of typical software development businesses$ where a continuous revenue stream (usually through the mechanism of upgrades or high*priced support is needed. addresses some of the economic drivers in more depth and provides models which can reverse this apparent conflict of interests. )n the following paragraphs we loo% at the claims$ outline why they are considered benefits and describe the ways that the (pen ;ource process provides substance to the claims.
,elia ility
9eliability is a loose term. 0roadly$ we can ta%e it to mean the absence of defects which cause incorrect operation$ data loss or sudden failures$ perhaps what many people would mean when they use the term ?bug'. ;trictly$ a bug would also mean failure to meet the specification$ but since most (pen ;ource pro2ects dispense with the concept of anything easily recognisable as a formal specification$ it's hard to point to that as good way of defining what is a bug and what is a feature. "etermining what constitutes a bug is usually by agreement amongst the developers and users of the software (an overlapping community in many cases . (bvious failure to perform is easily recognised as a bug$ as is failure to conform to appropriate published standards. ;ecurity related failings (exploits or vulnerabilities are clearly bugs too. #ach of these %inds of bugs is usually addressed with speedy fixes wherever possible and (pen ;ource advocates will claim very rapid time*to*fix characteristics for software. ;evere defects tend to be fixed within hours of their being detected$ a process wich is undoubtedly assisted by the availability of the source code. 3ble developers who discover a bug will commonly also fix it and then report it to the maintainers as well as issuing an updated version of the software on their own authority. 6sers of the software can choose whether to use the unofficial fix or wait for an ?official' version. 0y ?official' we mean a release blessed by the pro2ect team itself or a trusted authority such as one of the main distributors of (pen ;ource pac%ages. This mechanism clearly wor%s very well in practice. The pattern with closed*source software is typically that a defect report needs to be filed and then there will be a delay before the vendor determines when or whether to issue an updated release. 6sers of the software are much more at the mercy of the vendor's internal processes than with the (pen ;ource arrangement and the personal experience of the authors is that it can be extremely frustrating to move from the (pen ;ource to the closed model. 4The mar%et greatly values robustness$ and the (pen ;ource model$ particularly as practiced by 1inux$ encourages a large mar%et of early adopters (compared to the si7e of the early mar%et for commercial products who actively help debug the software. Conse<uently much (pen ;ource software becomes
LPU
highly robust at a surprisingly early stage of its development$ and mature (pen ;ource products are setting new industry standards for bulletproofness.4
+ta ility
)n a business environment software is mostly a necessary evil$ a tool to do a 2ob. 6nless the 2ob changes or more efficient processes are discovered then there is rarely pressure or need to alter the software that is being used to assist the tas%. This is more or less directly counter to what motivates software vendors who are in the unenviable position of supplying a commodity that does not wear out or age much. The vendors need a stable revenue stream to be able to %eep their business going whilst their customers have not the slightest desire to change or upgrade any product that is wor%ing well enough to suit their needs. )f a software supplier can establish a virtual monopoly and then force upgrades onto its audience (as has been the history of the software industry since the mid @AB0s then the profits can be very high. ;oftware vendors can apply a number of tactics to persuade their customers to upgrade more or less willingly. Typical tactics include moving to allegedly new and improved file formats (which re<uire the new and improved software to read them or to withdraw support and bug fixes for older versions after a short period. The problem for users of the software is that they rarely have much control over that process and are left isolated if they choose to remain with older versions that they consider to be acceptable. This has cost and control implications for the business. (pen ;ource ;oftware is not a panacea in the world of ever*changing software$ but the worst effects of vendor*push can be mitigated. The way that (pen ;ource products tend to conform closely to standards efforts has an inertial effect$ since standards change but slowly and interchange formats are often particularly stable. 3s a result$ incompatible file formats can be less of an issue. )f they are standards* based then they typically aren't an issue at all$ and if they are formats uni<ue to the software product C proprietary formats in a sense * then they cannot be undocumented since the source code that uses them is itself published. )n practice the trac% record of (pen ;ource pro2ects is usually goodD when incompatible formats are used it is commonplace for a +erl or similar converter program to be shipped with them which will upgrade data to the new format. )n the real world$ no business is static and software changes to meet new re<uirements. 3 choice to use (pen ;ource software can provide a counter to the pressures to upgrade for the vendor's commercial purposes but cannot shelter every user from any change. =aving access to the source code can allow a business to choose to support itself on an old version where necessary and we belive that in general it gives more options and choice to the users. .onetheless$ some upgrading and maintenance effort will always be needed. +utting the choice in the hands of the users rather than the suppliers is hard to criticise.
Audita ility
3 rarely*understood benefit of (pen ;ource software (any software where the source code is published is its auditability. Closed*source software forces its users to trust the vendor when claims are made for <ualities such as security$ freedom from bac%doors$ adherence to standards and flexibility in the face of future changes. )f the source code is not available those claims remain simply claims. 0y publishing the source code$ authors ma%e it possible for users of the software to have confidence that there is a basis for those claims. 8hether this ta%es the form of an cursory and informal inspection or
LPU
more rigorous auditing$ what's clear is that without access to the source$ third party inspection is impossible. 3t present the industry does not insist on third party inspection or certification$ but it's possible that as open source models become more popular then expectations of audits will rise. 3n often*<uoted example of this in real life is the )nterbase product from 0orland ()nprise . This C#9T advisory notice carries the following summary> 4)nterbase is an open source database pac%age that had previously been distributed in a closed source fashion by 0orland5)nprise. 0oth the open and closed source versions of the )nterbase server contain a compiled*in bac% door account with a %nown password.4 The bac% door account was discovered when 0orland released the source code of the software for public use. (ne is left wondering how many other software pro2ects contain similar features C and it's not possible to %now if the source code remains closed. 48e can easily see that open source software has a distinct advantage over proprietary systems$ since it is possible to easily and <uic%ly identify potential security problems and correct them. Eolunteers have created mailing lists and auditing groups to chec% for security issues in several important networ%ing programs and operating system %ernels$ and now the security of open source software can be considered e<ual or better than that of des%top operating systems. )t has also already been shown that the traditional approach of security through obscurity leaves too many open holes. #ven now that the )nternet reaches 2ust a part of the world$ viruses and crac%er attac%s can pose a significant privacy and monetary threat. This threat is one of the causes of the adoption of open source software by many networ%*oriented software systems.4 (ne example of third*party auditing is the 1inux ;ecurity 3udit pro2ect which performs by*eye auditing of open source software pac%ages and maintains a database of results. 3t present company auditors are not %nown to be as%ing about the suitability and auditability of %ey software pac%ages which support crucial business processes. 3 plausible reason is that they simply don't %now that it can be done. That situation is not guaranteed to continue.
!ost
&ost current (pen ;ource pro2ects are also available free of royalties and fees$ leading to the confusion around the commonly used term ?free software'. 9egrettably the #nglish language does not have separate concepts for free*of*charge and free as in unconstrainedD other languages are better e<uipped to describe the difference between ?freedom' and ?free of charge' (libre vs. gratis . +roponents of free software licences tend to emphasise liberty over cost although in practice the main open source pro2ects are free in both senses of the word. /rom a business perspective the purchase cost of software is only one factorD total cost of ownership (TC( is what really matters. (ther things being e<ual$ the solution with lowest TC( is usually the most desirable one. 3rguments in favour of low TC( for open source software include>
Possibly /ero purchase price Potentially no need to account for copies in use* reducing administrati#e o#erhead
LPU
laimed reduced need for regular upgrades ,gi#ing lower0nil upgrade fees* lower management costslaimed longer uptimes and reduced need for e"pensi#e systems administrators 1ear+/ero #ulnerability to #iruses eliminating need for #irus checking* data loss and downtime laimed lower #ulnerability to security breaches and hack attacks reducing systems administration load laimed ability to prolong life of older hardware while retaining performance
;ome longer*term claims are more difficult to substantiate yet they need to be ta%en into account>
2etter adherence to standards permits competition in the market* reducing #endor lock+in and conse3uent monopoly pricing A#ailability of source code pro#ides greater continuity and security against
o o
!inancial collapse of #endors of key products 4endors choosing to withdraw support for unprofitable products
Protection against being re3uired to fit your .( strategy to the cash needs of your software supplier
6nfortunately in this area there are numerous claims and counter claims. 9eliable TC( information is practically unobtainable$ although the case studies which form part of this guide provide a large amount of circumstantial evidence in favour of the argument. &ost businesses will have to chose the argument on on its merits and choose to bac% the use of (pen ;ource software where it seems most li%ely to provide either a clear cost win$ or valuable leverage over entrenched suppliers.
LPU
competing functionality$ but also data conversion tools from a (typically undocumented or even protected format. (pen ;ource pro2ects have very little motivation to attempt this %ind of loc%*in strategy. ;ince there is no commercial benefit to be had$ adherence to de*2ure or de*facto standards (where they exist is typically high. 8here standards for interwor%ing do not exist$ the fact that the source code is published means that proprietary data formats can't be used to manipulate loc%*in. This at least partly explains the relative success of (pen ;ource software in infrastructure areas. &any vendors have tried to create web servers to compete with 3pache$ but because the networ% protocol used between browsers and the web server is well specified they have had to compete on <uality or features rather than through more insidious tactics. 3ny vendor that controlled the lions' share of the browser and the server mar%et would feel strongly tempted to exclude competitors by proprietary extensions to the HTTP protocol if they thought they could get away with it. .o single vendor has yet managed to control both ends of this e<uation to a great enough degree. 4(pen ;ource software tends to be free of dependency on related products. +urchasers often perceive that the product wor%s best with other products from the same manufacturer. (pen ;ource software offers its users greater freedom to purchase other products$ avoiding loc%*in to particular manufacturers.4 0usiness users are most li%ely to obtain long*term flexibility through the careful choice of standards for interwor%ing and data exchange$ followed by vigilance to ensure that freedom from proprietary loc%*in is maintained in critical areas. The drawbac% is that standards inevitably lag in terms of glamorous features$ ma%ing the feature*based ploy an easy one for proprietary vendors to use. (pen ;ource products are strong in this area$ not only from the point of view of adherence to standards but also by helping to mitigate against insidious loc%*in if they are chosen as core infrastructure components. 4)t is the use of proprietary standards and protocols that effectively mandates the purchase of further products from the same supplier. &andating the use of open internet standards (as in the e*-)/ rather than proprietary formats$ and developing F&1*based data definitions$ for intra*-overnment$ and -overnment*to*Citi7en interoperability$ is a practical approach to controlling the Gproprietary loc%*inH4. The choice is not easy. &any wea%er managements simply roll*over and buy from a single supplier$ but they pay a high price. (pen ;ource software provides further flexibility through freedom.
!reedom from a single #endor Software #endors can go out of business* and they can arbitrarily decide to cease de#elopment of a product$ 5ow would your business cope if it relied on such a product6 7pen+source software allows you to retain not 8ust the right to use the software you already ha#e* but the ability to continue to use it as your needs change$ !reedom to modify your software 9ou aren:t limited to what one company belie#es you need$ Proprietary software #endors must cater for many different companies* predominantly their own$ 7pen+source software can be tailored for the way you do business$ .t is usually within the resources of all but the smallest companies to modify 7pen Source software to suit their own needs ,and potentially then to LPU
make those enhancements a#ailable as a public good-$ .f in+house de#elopment skills don:t e"ist* a short email to the pro8ect:s mailing list will usually find a suitable consultant$
LPU
conventional$ real*time$ embedded$ and distributed systems applications. The -.3T technology has always been based on free software$ and more specifically on the -.6 toolset. The -.3T compiler is integrated with the -CC (the -.6 C compiler bac%*end. The -.3T debugger is based on -"0 (the -.6 debugger that has been adapted for 3da AN. -1)"#$ the -.3T integrated development environment$ is based on #macs$ which has been adapted and complemented to create a friendlier and complete environment. The -T!3da -6) technology leverages on the -T! graphical tool%it and provides an advanced -6) builder. These are a few but significant examples of the technological offering of 3CT. 3ll the products being distributed by 3CT are free software$ usually under a -+1 or 1-+1*li%e licence. ;ince its foundation$ 3CT has established strategic partnerships with hardware and software manufacturers providing 3da AN capabilities. )n the former category is 3CT's relationship with ;ilicon -raphics$ )nc.$ whose new ;-) 3da AN product is based on -.3T. 3s of @AAA$ ;-) sold over a billion dollars of 3da related software and e<uipment. 3CT has relationships with several other hardware manufacturers such Compa< and =ewlett +ac%ard. Commercial customers of 3CT #urope include 3erospatiale$ 3lenia$ 0.+$ 0oeing$ 0ritish 3erospace$ Canal+$ C3;3$ "asa$ #ricsson$ =ughes$ 1oc%heed$ T98$ etc.4 To add some context to that <uote above$ 3da is a language designed specifically for military$ industrial and aerospace mission*critical and safety*critical systems where human life is routinely ris%ed if software systems do not function correctly. ;ome software vendors produce free software$ and obtain large parts of their revenue from service and support (e.g. Rope . )n other situations$ open*source consultants will provide training and5or support for software they recommend. =owever$ the fundamental advantage of open*source software when it comes to support is that it's always possible to retain a company to provide support. 0ecause the source code is freely available$ organisations are not limited to obtaining support from the authors. There is no restriction on other suppliers learning enough about the software to provide ade<uate support whenever demand exists. ;pea%ing from a personal perspective$ the authors feel obliged to point out that when software is as reliable as 3pache$ &y;S1 and similar pro2ects$ support dwindles as an issue. 8hen software wor%s reliably$ support for it ceases to be a frontline concern.
contains commands that may be used by both the system administrator and by users$ but which are re<uired when no other filesystems are mounted (e.g. in single user mode . )t may also contain commands which are used indirectly by scripts. G@H
/bin
LPU
,e3uirements
There must be no subdirectories in /bin. The following commands$ or symbolic lin%s to commands$ are re<uired in /bin.
Co""an # %at %'(r& %'"o# %'o)n %& #ate ## #f #"es( e%'o false $es%ri&tion Utility to concatenate files to standard output Utility to change file group ownership Utility to change file access permissions Utility to change file owner and group Utility to copy files and directories Utility to print or set the system data and time Utility to con#ert and copy a file Utility to report filesystem disk space usage Utility to print or control the kernel message buffer Utility to display a line of te"t Utility to do nothing* unsuccessfully
'ostna" Utility to show or set the system:s host name e *ill ln lo(in ls "*#ir "*no# "ore "o+nt "v &s LPU Utility to send signals to processes Utility to make links between files Utility to begin a session on the system Utility to list directory contents Utility to make directories Utility to make block or character special files Utility to page through te"t Utility to mount a filesystem Utility to mo#e0rename files Utility to report process status
Co""an #
$es%ri&tion
Utility to print name of current working directory Utility to remo#e files or directories Utility to remo#e empty directories (he ;sed: stream editor (he 2ourne command shell Utility to change and print terminal line settings Utility to change user .< Utility to flush filesystem buffers Utility to do nothing* successfully
+"o+nt Utility to unmount file systems +na"e Utility to print system information
)f /bin/sh is not a true 0ourne shell$ it must be a hard or symbolic lin% to the real shell command. The [ and test commands must be placed together in either /bin or /usr/bin.
Rationale
/or example bash behaves differently when called as sh or bash. The use of a symbolic lin% also allows users to easily see that /bin/sh is not a true 0ourne shell. The re<uirement for the [ and test commands to be included as binaries (even if implemented internally by the shell is shared with the +(;)F.2 standard.
+pecific $ptions
The following programs$ or symbolic lin%s to programs$ must be in /bin if the corresponding subsystem is installed>
Co""an # %s' e# (he $es%ri&tion shell ,optional-
LPU
$es%ri&tion (he tar archi#ing utility ,optional(he cpio archi#ing utility ,optional(he =1U compression utility ,optional(he =1U uncompression utility ,optional(he =1U uncompression utility ,optional(he network statistics utility ,optional(he . %P network test utility ,optional-
)f the gunzip and zcat programs exist$ they must be symbolic or hard lin%s to g7ip. /bin/csh may be a symbolic lin% to /bin/tcsh or /usr/bin/tcsh.
Rationale
The tar$ g7ip and cpio commands have been added to ma%e restoration of a system possible (provided that / is intact . Conversely$ if no restoration from the root partition is ever expected$ then these binaries might be omitted (e.g.$ a 9(& chip root$ mounting /usr through ./; . )f restoration of a system is planned through the networ%$ then ftp or tftp (along with everything necessary to get an ftp connection must be available on the root partition.
)f it is possible that devices in /dev will need to be manually created$ /dev must contain a command named MAKEDEV$ which can create devices as needed. )t may also contain a MAKEDEV.local for any local devices.
LPU
)f re<uired$ MAKEDEV must have provisions for creating any device that may be found on the system$ not 2ust those that a particular implementation installs.
The /etc hierarchy contains configuration files. 3 4configuration file4 is a local file used to control the operation of a programD it must be static and cannot be an executable binary. GPH
,e3uirements
.o binaries may be located under /etc. GNH The following directories$ or symbolic lin%s to directories are re<uired in /etc>
$ire%tor y opt >11 sgml "ml $es%ri&tion onfiguration for 0opt onfiguration for the > )indow system ,optionalonfiguration for S=%L ,optionalonfiguration for >%L ,optional-
+pecific $ptions
The following directories$ or symbolic lin%s to directories must be in /etc$ if the corresponding subsystem is installed>
$ire%tor y opt $es%ri&tion onfiguration for 0opt
The following files$ or symbolic lin%s to files$ must be in /etc if the corresponding subsystem is installed> GBH
-ile
csh.login
LPU
-ile
e !orts "stab "t!users gate#a$s gett$de"s grou! host.con" hosts
$es%ri&tion 1!S filesystem access control list ,optionalStatic information about filesystems ,optional!(P daemon user access control list ,optional!ile which lists gateways for routed ,optionalSpeed and terminal settings used by getty ,optionalUser group file ,optionalResol#er configuration file ,optionalStatic information about host names ,optional-
hosts.allo# 5ost access file for ( P wrappers ,optionalhosts.den$ 5ost access file for ( P wrappers ,optionalhosts.e%uiv List of trusted hosts for rlogin* rsh* rcp ,optionalhosts.l!d inetd.con" inittab issue ld.so.con" &otd &tab &tools.con" net#or's !ass#d !rintca! !ro"ile !rotocols
List of trusted hosts for lpd ,optionalonfiguration file for inetd ,optionalonfiguration file for init ,optionalPre+login message and identification file ,optionalList of e"tra directories to search for shared libraries ,optionalPost+login message of the day file ,optional<ynamic information about filesystems ,optionalonfiguration file for mtools ,optionalStatic information about network names ,optional(he password file ,optional(he lpd printer capability database ,optionalSystemwide initiali/ation file for sh shell logins ,optional.P protocol listing ,optional-
RP
LPU
-ile
securett$ services shells s$slog.con"
$es%ri&tion ((9 access control for root login ,optionalPort names for network ser#ices ,optionalPathnames of #alid login shells ,optionalonfiguration file for syslogd ,optional-
&tab
does not fit the static nature of /etc> it is excepted for historical reasons.
The /lib directory contains those shared library images needed to boot the system and run the commands in the root filesystem$ ie. by binaries in /bin and /sbin. G@2H
,e3uirements
3t least one of each of the following filename patterns are re<uired (they may be files$ or symbolic lin%s >
-ile
libc.so.(
ld(
)f a C preprocessor is installed$ /lib/cpp must be a reference to it$ for historical reasons. G@,H
+pecific $ptions
The following directories$ or symbolic lin%s to directories$ must be in /lib$ if the corresponding subsystem is installed>
$ire%tor y
&odules
LPU
Q6. A) (hat is the difference in use of 7? and 78 when used with shell and with grep command?
> would match either the left hand side or the right hand side . (abc + def would match abc or def. > 8ill match the preceding symbol 0 or at most @ time. so ab)c would match 'ac' and 'abc' only.
Option. (ption flag for a command or filter. Certain commands and builtins use the + to enable certain options and the * to disable them. )n parameter substitution$ the + prefixes an alternate value that a variable expands to.
6
test operator. 8ithin certain expressions$ the J indicates a test for a condition. )n a double*parentheses construct$ the J can serve as an element of a C*style trinary operator. G2H
condition?result*i"*true:result*i"*"alse
)n a parameter substitution expression$ the J tests whether a variable has been set.
LPU
LPU
LPU
)f youKre coming from 8indows$ the 1inux file system structure can seem particularly alien. The C>T drive and drive letters are gone$ replaced by a 5 and cryptic*sounding directories$ most of which have three letter names. The /ilesystem =ierarchy ;tandard (/=; defines the structure of file systems on 1inux and other 6.)F*li%e operating systems. =owever$ 1inux file systems also contain some directories that arenKt yet defined by the standard.
. < :he ,oot 'irectory
#verything on your 1inux system is located under the 5 directory$ %nown as the root directory. You can thin% of the 5 directory as being similar to the C>T directory on 8indows L but this isnKt strictly true$ as 1inux doesnKt have drive letters. 8hile another partition would be located at ">T on 8indows$ this other partition would appear in another folder under 5 on 1inux.
LPU
The 5bin directory contains the essential user binaries (programs that must be present when the system is mounted in single*user mode. 3pplications such as /irefox are stored in 5usr5bin$ while important system programs and utilities such as the bash shell are located in 5bin. The 5usr directory may be stored on another partition L placing these files in the 5bin directory ensures the system will have these important utilities even if no other file systems are mounted. The 5sbin directory is similar L it contains essential system administration binaries.
LPU
The 5boot directory contains the files needed to boot the system L for example$ the -960 boot loaderKs files and your 1inux %ernels are stored here. The boot loaderKs configuration files arenKt located here$ though L theyKre in 5etc with the other configuration files.
LPU
The 5cdrom directory isnKt part of the /=; standard$ but youKll still find it on 6buntu and other operating systems. )tKs a temporary location for C"*9(&s inserted in the system. =owever$ the standard location for temporary media is inside the 5media directory.
.de0 < 'e0ice -iles
1inux exposes devices as files$ and the 5dev directory contains a number of special files that represent devices. These are not actual files as we %now them$ but they appear as files L for example$ 5dev5sda represents the first ;3T3 drive in the system. )f you wanted to partition it$ you could start a partition editor and tell it to edit 5dev5sda. This directory also contains pseudo*devices$ which are virtual devices that donKt actually correspond to hardware. /or example$ 5dev5random produces random numbers. 5dev5null is a special device that produces no output and automatically discards all input L when you pipe the output of a command to 5dev5null$ you discard it.
LPU
The 5etc directory contains configuration files$ which can generally be edited by hand in a text editor. .ote that the 5etc5 directory contains system*wide configuration files L user*specific configuration files are located in each userKs home directory.
.home < 4ome -olders
The 5home directory contains a home folder for each user. /or example$ if your user name is bob$ you have a home folder located at 5home5bob. This home folder contains the userKs data files and user* specific configuration files. #ach user only has write access to their own home folder and must obtain elevated permissions (become the root user to modify other files on the system.
LPU
The 5lib directory contains libraries needed by the essential binaries in the 5bin and 5sbin folder. 1ibraries needed by the binaries in the 5usr5bin folder are located in 5usr5lib.
.lost8found < ,eco0ered -iles
#ach 1inux file system has a lost+found directory. )f the file system crashes$ a file system chec% will be performed at next boot. 3ny corrupted files found will be placed in the lost+found directory$ so you can attempt to recover as much data as possible.
LPU
The 5media directory contains subdirectories where removable media devices inserted into the computer are mounted. /or example$ when you insert a C" into your 1inux system$ a directory will automatically be created inside the 5media directory. You can access the contents of the C" inside this directory.
.mnt < :emporary %ount 2oints
=istorically spea%ing$ the 5mnt directory is where system administrators mounted temporary file systems while using them. /or example$ if youKre mounting a 8indows partition to perform some file recovery operations$ you might mount it at 5mnt5windows. =owever$ you can mount other file systems anywhere on the system.
.opt < $ptional 2ackages
The 5opt directory contains subdirectories for optional software pac%ages. )tKs commonly used by proprietary software that doesnKt obey the standard file system hierarchy L for example$ a proprietary program might dump its files in 5opt5application when you install it.
.proc < &ernel = 2rocess -iles
The 5proc directory similar to the 5dev directory because it doesnKt contain standard files. )t contains special files that represent system and process information.
LPU
The 5root directory is the home directory of the root user. )nstead of being located at 5home5root$ itKs located at 5root. This is distinct from 5$ which is the system root directory.
.run < Application +tate -iles
The 5run directory is fairly new$ and gives applications a standard place to store transient files they re<uire li%e soc%ets and process )"s. These files canKt be stored in 5tmp because files in 5tmp may be deleted.
.s in < +ystem Administration )inaries
The 5sbin directory is similar to the 5bin directory. )t contains essential binaries that are generally intended to be run by the root user for system administration.
LPU
)f your 1inux distribution uses ;#1inux for security (/edora and 9ed =at$ for example $ the 5selinux directory contains special files used by ;#1inux. )tKs similar to 5proc. 6buntu doesnKt use ;#1inux$ so the presence of this folder on 6buntu appears to be a bug.
.sr0 < +er0ice 'ata
The 5srv directory contains Udata for services provided by the system.V )f you were using the 3pache =TT+ server to serve a website$ youKd li%ely store your websiteKs files in a directory inside the 5srv directory.
LPU
3pplications store temporary files in the 5tmp directory. These files are generally deleted whenever your system is restarted and may be deleted at any time by utilities such as tmpwatch.
.usr < *ser )inaries = ,ead5$nly 'ata
The 5usr directory contains applications and files used by users$ as opposed to applications and files used by the system. /or example$ non*essential applications are located inside the 5usr5bin directory instead of the 5bin directory and non*essential system administration binaries are located in the 5usr5sbin directory instead of the 5sbin directory. 1ibraries for each are located inside the 5usr5lib directory. The 5usr directory also contains other directories L for example$ architecture*independent files li%e graphics are located in 5usr5share. The 5usr5local directory is where locally compiled applications install to by default L this prevents them from muc%ing up the rest of the system.
LPU
The 5var directory is the writable counterpart to the 5usr directory$ which must be read*only in normal operation. 1og files and everything else that would normally be written to 5usr during normal operation are written to the 5var directory. /or example$ youKll find log files in 5var5log.
c) I want to do a wildcard search on files with ? or ? in the names. 4ow do I do that? Ans
The UJU or U:V is a special character$ you cannot search with normal grep we have to use escape character (T in order to negate it. ;o use ITJI or IT:K to search for UJU or U:V. This is applicable for all the special characters
LPU
Q@. a) (hat is the difference etween 9inux and *#IA? Ans. That's a very broad <uestion and could be answered any number of ways. +robably the simplest
answer is that from a technical point of view there are no ma2or differences. &ost people aren't satisfied with believing that 1inux and 6.)F are very similar$ though. =ere's a list of the most obvious remaining differences. Origin: 6.)F originated in the laboratories of universities and large corporations$ as an initiative within the context of those organisations. 1inux was begun by a university student (1inus Torvalds without any initial support from any large organisation. 1inux also began as in mimic%ry of other well*%nown 6.)F* li%e implementations$ whereas the initial 6.)F implementations were original research. &ost commercial 6.)F versions are also derived from that early research. Service Model: &ost 6.)F versions operate on the basis that you can buy help (support and service contracts . 3lthough such things are increasingly available to 1inux technologists$ traditional arrangements consist of providing your own help$ with the assistance of a community of li%e*minded people. 1inux is big$ and access to communities is more important than$ say$ it is for )0& mainframes. Equip ent: 3lthough 1inux runs on many %inds of e<uipment$ it is best %nown for its support of commodity )0&*)ntel +C*based hardware. &ost of the more popular 6.)F flavours focus on high* performance hardware$ usually of a proprietory nature$ or using high*end standard computing architectures$ li%e ;+39C. 8ith ever*increasing gains in +C hardware$ li%e ;erial*3T3$ this distinction is not as large as it used to be$ especially for low performance uses$ li%e des%tops. !icensing: 1inux follows the /ree ;oftware /oundation's radical licensing model$ which provides a great deal of liberty to those that interact with 1inux technology. 6.)F versions provided by other vendors have profit strategies embedded in them. +eople who offer 1inux services might have a profit strategy$ but 1inux itself doesn't. This means that vendor loc%*in is less of an issue with 1inux than it is with other 6.)F offerings. )t also means that organisations big enough to have a center of computing competancy always have the choice of 4doing it themselves.4 "onest#: 1inux and related software is extremely visible. You can find out about flaws before you commit to the technology rather than afterwards. 0ecause of this$ a version number in 1inux is a more relable indicator of the <uality of the software than in 6.)F. /or example$ most 1inux software spends a long time being version 0 (7ero before it ever <ualifies for the label 4version @.4 )n terms of <uality$ performance and feature set$ there's little to separate 1inux from the other 6.)Fes. 1inux has yet to provide genuine real*time scheduling$ which some other 6.)F versions do well.
LPU
) (hat will e the output of the following commands? 1i) B ls 5 l C sort ; file1.txt <
(he 7utput of the command @ls Al @ )ill be sorted as the pipe Symbol is used and then the output will be redirected to the file @file1$t"tB$
LPU
QD. a)Illustrate the steps to write/ compile and execute a ! program in 9inux en0ironment using a program to find largest of @ num ers.
LPU
+tep D $
LPU
) (hat are 7sym olicF and hard links/ and how can I identify them? And how do I create links 1sym olic or hard)?
Ans $ .ar# lin* .t can only be used on files,not directories- and is basically a way of gi#ing multiple names to the same physical file$ hard links that point to that single physical file must be on the same partition as the orginal target file$ (he files are hard links if they ha#e the same inode number$
LPU
8here$
sy"/oli% lin* when you try to open a symbolic link which points to a file or change to one that points to a directory*the command you run acts on the file or directory that is the target of that link$the target has its own permissions and ownership that you cannot see from the symbolic link$ (he symbolic link can e"ist on a different disk partition than the target$
LPU
cd ln ln ln
)n case you use the provided rpm pac%ages$ you'll only need this if you want more than P parallel running F servers5F sessions$ as the rpm creates P symbolic lin%s to the F server binary. $inding Soft !in% lr**r**r** **W if it starts with l (then it means soft lin% To create soft lin% Code>
ln *s abc.t t e"g.t t
$inding hard lin% =ard lin% shares the same inode. Code>
7 ln abc.t t e"g.t t
do ls &li and chec% the first column value. both abc.txt and efg.txt have the same value
LPU
QE. a) (hat is the role of a oot loader? (hich one is etter/ installing windows o0er 9inux or installing 9inux o0er windows? -ind out the possi le errors for oth the scenarios.
,ole of a )ootloader
8hen power is first applied to a processor board$ many elements of hardware must be initiali7ed before even the simplest program can run. #ach architecture and processor has a set of predefined actions and configurations upon release of reset$ which includes fetching initiali7ation code from an onboard storage device (usually /lash memory . This early initiali7ation code is part of the bootloader and is responsible for breathing life into the processor and related hardware components. &ost processors have a default address from which the first bytes of code are fetched upon application of power and release of reset. =ardware designers use this information to arrange the layout of /lash memory on the board and to select which address range(s the /lash memory responds to. This way$ when power is first applied$ code is fetched from a well*%nown and predictable address$ and software control can be established. The bootloader provides this early initiali7ation code and is responsible for initiali7ing the board so that other programs can run. This early initiali7ation code is almost always written in the processorKs native assembly language. This fact alone presents many challenges$ some of which we examine here. (f course$ after the bootloader has performed this basic processor and platform initiali7ation$ its primary role is fetching and booting a full*blown operating system. )t is responsible for locating$ loading$ and passing control to the primary operating system. )n addition$ the bootloader might have advanced features$ such as the capability to validate an (; image$ upgrade itself or an (; image$ or choose from among several (; images based on a developer*defined policy. 6nli%e the traditional +C*0)(; model$ when the (; ta%es control$ the bootloader is overwritten and ceases to exist
LPU
You can loo% at this from both sides of the fence. ;ome say giving the public access to the code opens the operating system (and the software that runs on top of it to malicious developers who will ta%e advantage of any wea%ness they find. (thers say that having full access to the code helps bring about faster improvements and bug fixes to %eep those malicious developers from being able to bring the system down. ) have$ on occasion$ dipped into the code of one 1inux application or another$ and when all was said and done$ was happy with the results. Could ) have done that with a closed*source 8indows applicationJ .o.
LPU
owner of a 8inmodem. ;o ) had to go out and purchase a 6; 9obotics external modem because that was the one modem ) knew would wor%. This is not so much the case now. You can grab a +C (or laptop and most li%ely get one or more 1inux distributions to install and wor% nearly @00 percent. 0ut there are still some exceptions. /or instance$ hibernate5suspend remains a problem with many laptops$ although it has come a long way. 8ith 8indows$ you %now that most every piece of hardware will wor% with the operating system. (f course$ there are times (and ) have experienced this over and over when you will wind up spending much of the day searching for the correct drivers for that piece of hardware you no longer have the install dis% for. 0ut you can go out and buy that @0*cent #thernet card and %now itKll wor% on your machine (so long as you have$ or can find$ the drivers . You also can rest assured that when you purchase that insanely powerful graphics card$ you will probably be able to ta%e full advantage of its power.
LPU
Ta%e$ for instance$ the des%top. 6nless you are willing to pay for and install a third*party application that can alter the des%top appearance$ with 8indows you are stuc% with what &icrosoft has declared is the ideal des%top for you. 8ith 1inux$ you can pretty much ma%e your des%top loo% and feel exactly how you want5need. You can have as much or as little on your des%top as you want. /rom simple flat /luxbox to a full*blown ," Compi7 experience$ the 1inux des%top is as flexible an environment as there is on a computer.
LPU
8ith 8indows$ youKre luc%y to get to a command line via safe mode C and then you may or may not have the tools you need to fix the problem. )n 1inux$ even in run level ,$ you can still get and install a tool to help you out (hello apt*get install 3++1)C3T)(. via the command line . =aving different run levels is helpful in another way. ;ay the machine in <uestion is a 8eb or mail server. You want to give it all the memory you have$ so you donKt want the machine to boot into run level N. =owever$ there are times when you do want the -6) for administrative purposes (even though you can fully administer a 1inux server from the command line . 0ecause you can run the startx command from the command line at run level ,$ you can still start up F 8indows and have your -6) as well. 8ith 8indows$ you are stuc% at the -raphical run level unless you hit a serious problem.
Nour callO
Those are @0 fundamental differences between 1inux and 8indows. You can decide for yourself whether you thin% those differences give the advantage to one operating system or the other. &eJ 8ell ) thin% my reputation (and opinion precedes me$ so ) probably donKt need to say ) feel strongly that the advantage leans toward 1inux.
) 4ow do I add or change personal information in an account and how do I add groups? Explain how can i add.delete users in a group?
6sers are members of a default group. 9ed =at 1inux (also /edora Core$ Cent(;$ etc. will add new users to a group of the same group name as the user name. The default group for a user is specified in the file /etc/!ass#d
!ormatD
user*na&e1 1user*nu&ber1grou!*nu&ber1co&&ent section1/ho&e*director$1de"ault*shell
C"ampleD
user11 1?001?001@reg1/ho&e/user11/bin/bash
A new user may be created and assigned a group with the useradd commandD
Add a new user and assign them to be members of the group EaccountingED
useradd *& *g accounting user2
Add a new user and assign them to be members of the initial group EaccountingE and supplementary group EfloppyED
useradd *& *g accounting *@ "lo!!$ user-
LPU
+m +% +g += +s +e +f +u
reate a home directory in /ho&e/ 1o home directory created$ Specify the initial group for the user$ Specify the initial group for the user by using the group number$ Specify the default shell for the user$ .f not specified set to /bin/bash Specify the e"piration date$ !ormat 999+%%+<< 1umber of days after a password e"pires that an account is disabled$ 2y default this feature is disabled ,+1Specify the user id number to be used$
<efaults specified in /etc/login.de"s 4iew group membership for a user with the command Egrou!sE$ C"ampleD grou!s user2
The user id has a user system number associated with it (uid and this is defined in /etc/!ass#d. The group has a group system number (gid associated with it and this is defined in /etc/grou!
!ormatD
grou!*na&e1 1grou!*nu&ber1user-Auser2
C"ampleD
user-1 1?001 user21 1?0-1 "lo!!$1 1-/1useraccounting1 1=001user2 a!ache1 1B01
User Euser1E is a member of default group Euser1E and also a member of group EfloppyB
-roup Commands>
g!ass#dD administer the 0etc0group file grou!addD reate a new group !ormatD grou!add 5*g gid 5*o88 5*"8 5*K KEC,VADEE8 grou! C"ampleD grou!add accounting grou!&odD %odify a group !ormatD grou!&od 5*g gid 5*o 88 5*n ne#Fgrou!Fna&e8 grou! C"ample + hange name of a groupD grou!&od *n accounting nerd$gu$s
LPU
grou!delD <elete a group C"ampleD grou!del accounting vigrD Cdit the group file /etc/grou! with #i$ 1o arguments specified$
LPU
QI. a) (hat are En0ironment >aria les? 4ow a ! program can gain access to en0ironment 0aria les? "i0e examples.
Ans. En0ironment 0aria les
;ometimes it is useful to communicate with a program in a semi*permanent way$ so that you do not need to specify a command*line option every time you type the command to execute the program. (ne way to do this is to generate a configuration file$ in which you can store data that will be used by the program every time it is run. This approach is typically useful if you have a large amount of data that you want to pass to a program every time it runs$ or if you want the program itself to be able to change the data. =owever$ environment variables provide a more lightweight approach. #nvironment variables$ sometimes called shell variables$ are usually set with the e !ort command in the shell. (This section assumes you are using the -.6 0ash shell. ;tandard environment variables are used for information about your home directory$ terminal type$ and so onD you can define additional variables for other purposes. The set of all environment variables that have values is collectively %nown as the environment. .ames of environment variables are case*sensitive$ and it is good form to use all upper*case letters when defining a new variableD certainly this is the case for all system*defined environment variables. The value of an environment variable can be any string that does not contain a null character (since the null character is used to terminate the string value . #nvironment variables are stored in a special array that can be read by your &ain function. =ere is the s%eleton for a &ain function that can read environment variablesD notice we have added a third parameter to &ain$ called env!$ which comes after argc and argv.
3include .stdio.h: /( To shorten e a&!leA not using arg! (/ int &ain +int argcA char (argv58A char (env!582 G I return 0H
.otice that env! is an array of strings$ 2ust as argv is. )t consists of a list of the environment variables of your shell$ in the following format>
NAME,value
Must as you can manually process command*line options from argv$ so can you manually process environment variables from env!. =owever$ the simplest way to access the value of an environment variable is with the getenv function$ defined in the system header stdlib.h. )t ta%es a single argument$ a string containing the name of the variable whose value you wish to discover. )t returns that value$ or a null pointer if the variable is not defined.
LPU
3include .stdio.h: 3include .stdlib.h: /( To shorten e a&!leA not using arg! (/ int &ain +int argcA char (argv58A char (env!582 G char (ho&eA (hostH ho&e , getenv+6HJME62H host , getenv+6HJKTLAME62H !rint" +6Cour ho&e director$ is Ms on Ms.Nn6A ho&eA host2H return 0H I
8hen you run this code$ it will print out a line li%e the following one.
Cour ho&e director$ is /ho&e/r#he on linnaeus.
) !an you summariJe the differences etween sym olic and hard links and differentiate etween using links and simply duplicating a file?
Ans $
4ard links.
The ln command is used to create multiple lin%s for one file. /or example$ let's say that you have a file called "oo in a directory. 6sing ls *i$ you can loo% at the inode number for this file.
=ere$ "oo has an inode number of 22@A2 in the file system. You can create another lin% to "oo$ named bar$ as follows> 8ith ls *i$ you see that the two files have the same inode.
.ow$ specifying either "oo or bar will access the same file. )f you ma%e changes to "oo$ those changes appear in bar as well. /or all purposes$ "oo and bar are the same file.
LPU
These lin%s are %nown as hard lin%s because they create a direct lin% to an inode. .ote that you can hard*lin% files only when they're on the same file systemD symbolic lin%s (see below don't have this restriction. 8hen you delete a file with r&$ you are actually only deleting one lin% to a file. )f you use the command then only the lin% named "oo is deleted$ bar will still exist. 3 file is only truly deleted on the system when it has no lin%s to it. 6sually$ files have only one lin%$ so using the r& command deletes the file. =owever$ if a file has multiple lin%s to it$ using r& will delete only a single lin%D in order to delete the file$ you must delete all lin%s to the file. The command ls *l displays the number of lin%s to a file (among other information .
The second column in the listing$ ??2''$ specifies the number of lin%s to the file. 3s it turns out$ a directory is actually 2ust a file containing information about lin%*to*inode associations. 3lso$ every directory contains at least two hard lin%s> ??.'' (a lin% pointing to itself $ and ??..'' (a lin% pointing to the parent directory . The root directory (/ ??..'' lin% 2ust points bac% to /. ()n other words$ the parent of the root directory is the root directory itself.
=owever$ using ls *l$ we see that the file bar is a symlin% pointing to "oo.
The file permissions on a symbolic lin% are not used (they always appear as r# r# r# . )nstead$ the permissions on the symbolic lin% are determined by the permissions on the target of the symbolic lin% (in our example$ the file "oo . /unctionally$ hard lin%s and symbolic lin%s are similar$ but there are differences. /or one thing$ you can create a symbolic lin% to a file that doesn't existD the same is not true for hard lin%s. ;ymbolic lin%s are processed by the %ernel differently than are hard lin%s$ which is 2ust a technical difference but sometimes
LPU
an important one. ;ymbolic lin%s are helpful because they identify the file they point toD with hard lin%s$ there is no easy way to determine which files are lin%ed to the same inode.
LPU
Code>
*bash*O.003 c! orig."ile co!ied."ile *bash*O.003 cat co!ied."ile test hard test *bash*O.003 echo co!$ test :: co!ied."ile *bash*O.003 cat co!ied."ile test hard test co!$ test *bash*O.003 cat orig."ile test hard test *bash*O.003 cat hardlin'."ile test hard test
change to copied file doesn't show same with original file but hardlin% and orig file show same content.
LPU