Вы находитесь на странице: 1из 18

1. History of Linux Operating System.

Explain how Linux was developed and how features


were added. Explain how its history led Linux to its current state.
2. Compare Linux to two other server operating systems. Try to discuss 4 Linux strengths
and weaknesses compared to the others? Pricing cannot be used in this answer.
3. Describe the architecture of Linux. If it is based on things like neural nodes, Process
spirals, or layers, explain at least 5 main parts and discuss what each part does for
Linux.
4. Explain how users can interface with the Linux OS and what interface styles are
available. Be sure to discuss why a user would choose to use a given interface method.
5. Explain at least 10 roles the Linux OS can play in a business computing center.
6. Pick 5 Linux commands and explain how they are used, why they are important, and give
an example of how to use each command.
7. Discuss the importance and usage of regular expressions. Give 5 example patterns and
an example block of text to be searched. Explain what each pattern does. Show how you
would use your pattern in a command like grep and show the output given your
example text block.
8. Explain shell scripting and what you would use is for. Find a short example of a shell
script and try to explain what is does. Identify what commands are used. You may not
use hello Linux for this.
9. Write, run, and provide the output of the Hello Linux shell script. Explain 2 options
you could use to redirect the output of your Hello Linux script to a file.
10. Explain what vi is used for? Discuss if there are modern alternatives to vi and why
vi is still important. Give 5 command examples that can be used within vi and
explain what they do.
















Question No-1:
History of Linux operating system:
Linux is a UNIX like computer operating system that uses the Linux Kernel. Linux started out
as a personal computer system used by individuals, and has since gained the support of several
large corporations such as Sun Microsystems, HP and IBM. It is now used mostly as server
operating system, with some large organizations using an enterprise version for desktops. Linux
is a prime example of open-source development, which means that the source code is available
freely for anyone to use.
Linux Torvalds, Who was then a student at the University of Helsinki in Finland, developed
Linux in 1991. He released it for free on the Internet. It was initially a terminal emulator, which
Torvalds used to access the large UNIX servers of the university. He wrote the program
specifically for hardware he was using and independent of an operating system because he
wanted to use the function of his new PC with an 80386 processor. Development was done on
MINIX using the GNU C compiler, which is still the main choice for compiling Linux today.
Torvalds first published the Linux kernel under its own license, which had a restriction
on commercial activity.



















Question NO-2:
Linux is a free Unix-type operating system originally created by Linus Torvalds with the
assistance of developers around the world. Developed under the GNU General Public License,
the source code for Linux is freely available to everyone. Linux is predominantly known for its
use in servers, although can be installed on a wide variety of computer hardware, ranging from
embedded devices, mobile phones and even some mainframes and supercomputers. Linux
distributions, installed on both desktop and laptop computers, have become increasingly
commonplace in recent years, partly owing to the popular UBANTU distribution and the
emergence of Net books.
Here I discuss some strengths and weakness of SUSE Linux Enterprise Server 11 compared with
Solaris 10 and Windows Server 2008.
Lets start with SUSE Linux and Solaris. SUSE Linux Enterprise Server has more than 2,500
certified applications including popular open source applications as well as proprietary
applications from leading software vendors such as SAP, Oracle and IBM. On the other hand,
Solaris 10 has recently surged in numbers of ISV applications, but the ISV enthusiasm is low
because it has less than one percent market share.
Another consideration Linux vs. Solaris is the impact of vibrant ecosystem. SUSE Linux has a
clear advantage over Solaris 10 with respect to the size and vitality of its ecosystem. Novell has
developed partnerships and support relationship with leading hardware vendors such as IBM,
HP, Dell, and Fujitsu computer systems and many others. In addition, Linux offers a much larger
open source community than does Open-Solaris, providing time-to-market advantages in new
feature development and bug fixes.
The breadth of hardware and processor architectures on which you can run SUSE Linux
Enterprise Server gives it a big advantage over Solaris 10 on x86. SUSE Linux Enterprise Server
is a powerful operating system that gives you the flexibility to take full advantage of your current
and future hardware. The Primary difference between Linux and Solaris10 on x86 when it comes
to virtualization is experience with customers. SUSE Linux Enterprise 11 with Xen hypersisor
fully supports:
Para-virtualization as a modified virtual machine operating system on top of Xen-enabled
SUSE Linux Enterprise Server 11.
Full virtualization as unmodified virtual machine operating systems using Intel VT or
AMD V chipsets: SUSE Linux Enterprise server 9, 10, 11 and Red Hat Enterprise Linux
4 and 5 including Windows Server 2003, 2008 and XP.
In 2006, Novell and Microsoft signed a Technical collaboration Agreement to work closely to
increase Linux and Windows interoperability on both the client and server sides. The two
companies have made great strides in federated directory and identity, virtualization, and systems
management.

SUSE Linux Enterprise Server 11 VS Windows Server 2008:
When we compare Linux operating system to Windows, we should consider factor such as cost
of ownership, security and virtualization. SUSE Linux Server offers greater customer value than
Windows Server along each of these dimensions.
Linux is considered more secure than Windows when it comes to servers. Cost and stability are
areas where Linux scores over Windows. SUSE Linux Enterprise Server provides Enterprise
security at no extra cost, through AppArmor application-level security technology. AppArmor
gives you network application security for programs, protecting against the exploitation of
software flaws and compromised system. SUSE Linux Server is certified to be compliant with
the Common Criteria (CC) Controlled Access Protection Profile (CCPP). AppArmor offers an
advanced toolset that largely automates the development of per-program application security so
that no new expertise is required. On the other hand, Windows operating systems have a long
history of security flaws, many built into Internet Explorer, IIS, Active X, and other components.
These flaws have resulted in billions of dollars in lost business due to downtime required for
patching, installing, security service packs and taking other measures.
Now, lets look at what Linux has to offer. Of course, since many Linux software are open
source and come free of cost, you can save a considerable amount of money that you would have
otherwise spent in acquiring software. Now, look at the technologies it supports. Linux supports
PHP, MySQL, Perl, and PostgreSQL database. On the other hand, Windows supports .NET and
ASP. Windows server hosting lets you use the web development tools by Microsoft such as
Visual Interdev and Microsoft FrontPage. It also offers support for Visual Basic, Microsoft
Access, and Microsoft SQL, and of course, you get to use all the Microsoft Office services as
well.












Question No-3:
Architecture of Linux: When we look on a large and complex operating system we can describe
its architecture from different perspective view. Specially, Linux is a really a complex and large
operating system that kernel is six million lines of code itself. Here I describe its fundamental
architectures from two different points of view, one is User Space and other is Kernel Space.









Figure-1: Fundamental Architecture of Linux.
From figure-1 we can see the top is the user, or application spaces. This is where the user
applications are executed. Below the user space is the kernel space. Here, the Linux kernel
exists. There is also the GNU C Library. This provides the system call interface that connects to
the kernel and provides the mechanism to transition between the user space application and the
kernel.
The Linux kernel can be further divided into three gross levels. At the top is the system call
interface, which implements the basic functions such as read and write. Than the kernel code
which can be more accurately defined as the architecture-independent kernel code. This code is
common to all of the processor architectures supported by Linux. Below this is the architecture-
dependent code, which forms what is more commonly, called as BSP (Board Support Package).
This code serves as the processor and platform specific code for the given architecture.
A Kernel is really nothing more than a resource manager. Whether the resource being managed
is a process, memory, or hardware device, the kernel manages and arbitrates access. Now I will
discuss about some elements of Linux kernel:
System Call Interface: The SCI (System Call Interface) is a thin layer that provides the means to
perform function calls from user space into the kernel. This interface can be architecture
dependent and an interesting function call multiplexing and de-multiplexing service.







Hardware Platform
User Applications

Architecture-Dependent kernel
System Call Interface
Kernel
GNU C Library
G
N
U
/
L
i
n
u
x

User Space
Kernel Space
Process Management: Process management is focused on the execution of processes. In the
kernel, these are called threads and represent an individual virtualization of the processor.
Memory Management: Another important resource thats managed by the kernel is memory. For
efficiency, given the way that the hardware manages virtual memory, memory is managed in
what are called pages. Linux includes the means to manage the available memory, as well as the
hardware mechanisms for physical and virtual mappings.
Virtual File Systems: The virtual file system (VFS) is an interesting aspect of the Linux kernel
because it provides a common interface abstraction for file systems. The VFS provides a
switching layer between the SCI and the file systems supported by the kernel. At the top of the
VFS is a common API abstraction of functions such as open, close, read, and writes. Below the
file system layer is the buffer cache, which provides a common set of functions to the file system
layer. This caching layer optimizes access to the physical devices by keeping data around for a
short time. Below the buffer cache are the device drivers, which implement the interface for the
particular physical device.
Network Stack: The network stack, by design, follows a layered architecture modeled after the
protocols themselves. Internet Protocol (IP) is the core network layer protocol that sits below the
transport protocol (most commonly the Transmission Control Protocol, or TCP). Above TCP is
the sockets layer, which is invoked through the SCI. The sockets layer is the standard API to the
networking subsystem and provides a user interface to a variety of networking protocols.
Device Driver: The vast majority of the source code in the Linux kernel exists in device drivers
that make a particular hardware device usable. The Linux source tree provides a drivers
subdirectory that is further divided by the various devices that are supported, such as Bluetooth,
I2C, serial, and so on.
Linux is also a dynamic kernel, supporting the addition and removal of software components on
the fly. These are called dynamically loadable kernel modules, and they can be inserted at boot
when they're needed or at any time by the user.
A recent advancement of Linux is its use as an operating system for other operating systems
(called a hypervisor). Recently, a modification to the kernel was made called the Kernel-based
Virtual Machine (KVM). This modification enabled a new interface to user space that allows
other operating systems to run above the KVM-enabled kernel.




Question No: 5
Business owners find that Linux, for what was once a niche operating system, provides
the necessary components and services on which many rely. Linux continues its entry into the
worlds largest data centers, onto hundreds of thousands of individual desktops, and it represents
a near 100 percent domination of the cloud services industry. Take the time to discover Linux
and use it in your business. Here are ten reasons to give Linux at least a second look:
Security: No operating system is 100% secure and Linux is no exception. But, Linux
offers excellent security for its users. From regular kernel updates to an almost daily list of
security patches, Linux code maintainers keep Linux systems very secure. Business owners who
rely on commercially supported Linux systems will have access to every available security fix.
With Linux, you have a word-wide community providing security fixes, not a single company
with closed source code.
Support Options: Linux has the support of a worldwide community of developers who
contribute to the source code, security fixes and system enhancements. This active community
also provides businesses with free support through forums and community sites. This distributed
community gives peace of mind to Linux users, because there is no single point of failure and no
single source for Linux support or development.
In the past, businesses used the lack of commercial support as the main reason for staying with
Windows. Red Hat, Novell, and Canonical, The big three commercial Linux providers, have
put this fear to rest. Each of these companies offers 24*7*365 support for you mission critical
applications and business services.
Quality: Which is more likely to be better: a software package created by a handful of
developers, or a software package created by thousands of developers? Just as there are countless
developers and users working to improve the security and quality of open source software, so are
there just as many innovating new features and enhancements to those products. In general, open
source software gets closest to what users want because those users can have a hand in making it
so. Its not a matter of the vendor giving users what it things they want users and developers
make what they want, and they make it well. At least one recent study has shown, in fact, that
technical superiority is typically the primary reason enterprises choose open source software.
Customizability: Along similar lines, business users can take a piece of open source
software and tweak it to suit their needs. Since the code is open, its simply a matter of
modifying it to add the functionality they want. Dont try that with proprietary software!
Freedom: When businesses turn to pen source software, they free themselves from the
severe vendor lock in that can afflict users of proprietary packages. Customers of such vendors
are at the mercy of the vendors vision, requirements, dictates, prices, priorities and timetable,
and that limits what they can do with the products theyre paying for. With Free and Open
Source Software (FOSS), on the other hand, users are in control to make their own decisions and
to do what they want with the software. They also have a worldwide community of developers
and users at their disposal for help with that.
Flexibility: When your business uses proprietary software such as Microsoft Windows
and Office, you are on a treadmill that requires you to keep upgrading both software and
hardware ad infinitum. Open source software, on the other hand, is typically much less resource-
intensive, meaning that you can run it well even on older hardware. It's up to you not some
vendor to decide when it's time to upgrade.
Interoperability: Open source software is much better at adhering to open standards than
proprietary software is. If you value interoperability with other businesses, computers and users,
and don't want to be limited by proprietary data formats, open source software is definitely the
way to go.
Audit ability: With closed source software, you have nothing but the vendor's claims
telling you that they're keeping the software secure and adhering to standards, for example. It's
basically a leap of faith. The visibility of the code behind open source software, however, means
you can see for yourself and be confident.
Cost: Between the purchase price of the software itself, the exorbitant cost of mandatory
virus protection, support charges, ongoing upgrade expenses and the costs associated with being
locked in, proprietary software takes more out of your business than you probably even realize.
You can get better quality at a fraction of the price.
Try Before You Buy: If you're considering using open source software, it will typically
cost you nothing to try it. This is partly due to the software's free price, and partly due to the
existence of Live CDs and Live USBs for many Linux distributions. No commitment required
until you're sure.








Question No: 10
vi is the first real screen-based editor for Unix systems. It is also simple, small, and sleek.
Vi is based on the same principles as many other Unix applications: that each program provides a
small, specific function and is able to interact with other programs. For example, vi doesnt
include its own spell checker or paragraph filler, but those features are provided by other
programs that are easy to fire off from within vi. Therefore, vi itself is a bit limited, but is able to
interact with other applications to provide virtually any functionality we might want.
The number of vi clones are now available that are much more comfortable to use than the
original vi. The most popular of which is vim (vi improved), Emacs, and XEmacs. At first, vi
may appear to be somewhat complex and unwieldy. However, its single-letter commands are fast
and powerful than any other text editor.
Five vi command example:
1. Starting vi:
To start using vi, at the Unix prompt type vi followed by a file name. To edit an existing file,
type in its name; if we are creating a new file, type in the name we wish to give to the new file.
%vi filename
Then hit Return. We will see a screen similar to the one below which shows blank lines with
tildes and the name and status of the file.
~
~
"myfile" [New file]
2. Inserting Text:
To insert new text in a line, first position the cursor to the right of where we wish the inserted
text to appear. Type i to get into insert mode and then type in the desired text. Press ESC to
return to command mode.
3. Appending Text:
We can use append command to add text at any place in our file. Append (a) works very much
like Insert (i) except that it insert text after the cursor rather than before it. Append is probably
used most often for adding text to the end of a line. Simply placing the cursor where we wish to
append text and press a. Once we've finished appending, press ESC to go back to command
mode.
4. Joining Lines:
Since vi does not use automatic word wrap, it is not unusual in editing lines to end up with lines
that are too short and that might be improved if joined together. To do this, place the cursor on
the first line to be joined and type J. As with other commands, we can precede J with a number to
join multiple lines (4J joins 4 lines).
5. Quitting and Saving a File
When we edit a file in vi, we are actually editing a copy of the file rather than the original. The
following sections describe methods we might use when closing a file, quitting vi, or both.
The command ZZ (uppercase) will allow us to quit vi and save the edits made to a file. We will
then return to a Unix prompt. We can also use the following commands:
:w to save file but not quit vi (this is good to do periodically incase of machine crash!).
:q to quit if we haven't made any edits.
:wq to quit and save edits (basically the same as ZZ).














Question no: 7
One of the most powerful tools available to programmers is regular expression. It is available to
UNIX environment such as vi editor, grep command, Perl and PHP programming language, and
Microsoft environment such as Microsoft.Net. I will explain here why it is so important-
Regular expressions are as language within a language. Each time we use regular expression we
are invoking a powerful search engine. If our search string is simple, regular expression syntax is
very simple. Here is some example of that simplicity-
To find all lines that contain the word Apple we just need to type :
Apple
To find all lines that start with the word Apple we just need to type:
^Apple
Even we can match upper and lower case:
To find all lines contain either Apple or apple we need to type:
[Aa]pple
So, Regular Expression can be used to scan just about any file for data with an identifiable
pattern. This is especially true of programming languages such as Perl where the implementation
of Regular Expressions has been extended to extraordinary levels of high.

grep searches the input files for lines containing a match to a given pattern list. When it finds a
match in a line, it copies the line to standard output by default, or whatever other sort of output
we have requested with options. Here is some example using wildcards-
here I use . For a single character match.
karim ~> grep \c.\> /usr/share/dict/words
If we want to get a list of all five-character English dictionary words starting with c and
ending in h:
Karim ~> grep \<ch\>/user/share/dict/words
For matching multiple characters, use the asterisk. The next example selects all words starting
with c and ending in h form the systems dictionary:
Karim ~> grep \<c.*h\> /user/share/dict/words

Question No-9:
To create a shell script:
1. we can use a text editor such as vi.
2. Save and close the file (exit from vi).
3. Make the script executable.
4. Than we can test the script.
Fro example:
On gedit type : #!/bin/bash
Than type: echo hello world
Than, I save it as hello and change the properties to executable and run it on terminal mode. In
order to run it on terminal I typed: /hello
Here is actual output from that I coped and saved from Linux:
#!/bin/bash
echo hello world


shahed@ubuntu:~$ ls
Desktop examples.desktop Music Templates Videos
Documents Firefox_wallpaper.png Pictures test
Downloads hello Public Ubuntu One
shahed@ubuntu:~$ ./'hello'
hello world
shahed@ubuntu:~$ ^C
shahed@ubuntu:~$








Qusestion No: 8
Shell Scripting: A shell script is a script written for the shell, or command line interpreter, for an
operating system. It is often considered a simple domain-specific programming language.
Typical operations performed by shell scripts include file manipulation, program execution, and
printing text.
Shell scripts often serve as an initial stage in software development. Often, writing a shell script is
much quicker than writing the equivalent code in other programming languages. The many advantages
include easy program or file selection, quick start, and interactive debugging. A shell script can be used to
provide sequencing and decision-making linkage around existing programs, and for moderately-sized
scripts the absence of a compilation step is an advantage. Interpretive running makes it easy to write
debugging code into a script and rerun it to detect and fix bugs. Non-expert users can use scripting to
tailor the behavior of programs, and shell scripting provides some limited scope for multiprocessing.
Here I attached an example that will print current user information with current date and time:
#!/bin/bash
$ vi ginfo
#
# Script to print user information who currently login , current date &
time
#
clear
echo "Hello $USER"
echo "Today is \c ";date
echo "Number of user login : \c" ; who | wc -l
echo "Calendar"
cal
exit 0

OutPut:

shahed@ubuntu:~$ ./'test shell'
./test shell: line 2: $: command not found

Hello shahed
Today is \c
Fri Nov 5 03:37:02 PDT 2010
Number of user login : \c
2
Calendar
November 2010
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

shahed@ubuntu:~$
Question No: 6
Five Linux Command and description how they work including with example:
No:01
Command: cd
I can use it for change directory. In administration level we can use
it for various purpose like-
1. cd : For change to home directory.

2. cd .. : For change directory level one level avobe.
For example, [liveuser@localhost ~]$ cd ..
[liveuser@localhost home]$
3. cd new : For move to "new" directory from current
directory
For example, [liveuser@localhost ~]$ cd
new
[liveuser@localhost new]$
4. cd new/another : For change to subdirectory
for example, [liveuser@localhost ~]$ cd new/another
[liveuser@localhost another]$
No:02
Command: mkdir
I can use it for make a new directory. In administration level
we can use it for create new directory and subdirectory. For example
1. mkdir new : it create new directory named "new".

2. mkdir new folder: it create two new directory named "new"
"folder"
[liveuser@localhost ~]$ mkdir new folder
[liveuser@localhost ~]$ ls
Desktop Downloads Music Pictures
Templates
Documents folder new Public Videos



No:03
Command: ls
I can use it for see all directory in alphabetical order. In
administration level we can use it for see directory and subdirectory
directory for editing and modification purpose.
For example
1. ls : it shows all the directory in alphabetical order for
current user.
[liveuser@localhost ~]$ ls
Desktop Documents Downloads Music new Pictures
Public Templates Videos

2. ls new : It shows all the subdirectoy inside the "new"
directory.
[liveuser@localhost ~]$ ls new
another
[liveuser@localhost ~]$
3. ls -al : it shows formatted listing with hidden files.

no:04
Command: rm

I can use it for remove files and directory. In administration level
we can use it for remove files, directory and subdirectory for editing and
modification purpose. For Example-

1. rm file : For delete file
2. rm -r new : For delete directory named "new".

[liveuser@localhost ~]$ rm -r new
[liveuser@localhost ~]$ ls
Desktop Documents Downloads Music Pictures Public
Templates Videos
[liveuser@localhost ~]$
3. rm -f file : For force remove/delete file
4. rm -rf folder : For force remove/delete directory.
1. rm -rf folder: it removes the directory named
"folder".
[liveuser@localhost new]$ mkdir folder
[liveuser@localhost new]$ ls
file folder
[liveuser@localhost new]$ rm -rf folder
[liveuser@localhost new]$ ls
file
[liveuser@localhost new]$


no:05
command: cat

I can use it for create short files inside any directory. In
administration level we can use it for create, view and concatenate file
for editing and modification purpose. For Example-
1. cat>file : For create short file named "file" inside the "new"
directory
[liveuser@localhost ~]$ cd new
[liveuser@localhost new]$ cat> file
1st: I/Me
2nd: He/Him
3rd: You
[liveuser@localhost new]$ ls
file

2. cat file : For checking contents nemed "file".
[liveuser@localhost new]$ cat file
1st: I/Me
2nd: He/Him
3rd: You
[liveuser@localhost new]$
3. cat >>file : For adding text to an existing file.
[liveuser@localhost new]$ cat >>file
4th: The World
[liveuser@localhost new]$ cat file
1st: I/Me
2nd: He/Him
3rd: You
4th: The World
[liveuser@localhost new]$






















Question No: 13
Command: ls
I can use it for see all directory in alphabetical order. In
administration level we can use it for see directory and subdirectory
directory for editing and modification purpose.
For example
1. ls : it shows all the directory in alphabetical order for
current user.
[liveuser@localhost ~]$ ls
Desktop Documents Downloads Music new Pictures
Public Templates Videos

Question No: 19
Command: mkdir
I can use it for make a new directory. In administration level
we can use it for create new directory and subdirectory. For example
1. mkdir new : it create new directory named "new".

2. mkdir new folder: it create two new directory named "new"
"folder"
[liveuser@localhost ~]$ mkdir new folder
[liveuser@localhost ~]$ ls
Desktop Downloads Music Pictures
Templates
Documents folder new Public Videos

Question No: 16
Grep: I can use this command to search for information in a file or files. For example, suppose
that I have a file named test whose contents are
red eagle
green redbull
blue texas
Then I can look up items in my file like this:
>grep red dict
red eagle
Question No: 14
Chmod
This command is used to change the permissions fo a file or directory. For example to make a
file test readable by everyone, we can do this:
>chmod a+r test
To check the permission of a file, we can use : ls -1
Question No 17:
mv :
we can use this command to change the name of fiel and directories.
>mv test testrun
The file that named test is now named testrun
Question No 18:
cp
We can use this command to copy files or directories.
> cp test test.2
This makes a copy of the file test
Question No 11:
#! We use it for going to vi mode from gedit mode.
Question No 20:
|
We use it for conceiting tow output in one command

Вам также может понравиться