Shell Programs Unix Linux Answers example essay topic

3,631 words
UNIX AND LINUX Two Powerful Systems That Are Often Misunderstood By Paul Operating Systems Concepts October 9, 1999 Unix and Linux There have been many-recorded eras throughout man's history. There was the Ice Age (BURR), the Stone Age, the Bronze Age, and the Industrial Age (revolution) just to name a few. Each of these eras marks pivotal advances in humankind. Here are some examples of our advancements, during the Ice Age, one of nature's first demonstrations of her power in population control, man presents his first fashion show focusing on the elegant features of Fur clothing and accessories. The Industrial Revolution mans first experience with assembly line manufacturing. It was dark and dingy when you went to work, it was dark and dingy at work, and it was dark and dingy after work.

Hey is that the Sun! Thank goodness for the "EPA". Lucky for all, that's behind us now. Yes, man has moved on once again to a new era, the Information Age. Now instead of men (and women) working at the brewery to manually check and ensure that all the bottle caps have been placed correctly on our beer bottles, there are robot arms checking them and these advanced machines are run by computers.

This example may trivialize mans advancements but it also simplifies the big picture. We can all classify ourselves as players in, victims of, or even products of, the Information Age. Success in the Information Age is based on a corporation's, a small business's, or a students ability to gather information (useful information) quickly and accurately then being able to store that information efficiently to draw upon when necessary. The primary tool for most of this wonderful work is the computer and chances are you can see one in almost every office from here to Harrisburg but the part of the computer that is seen on all the desks in all these offices is merely the hardware. There is much more to a computer than just its physical components. There is a very important component that most end users take for granted until something goes wrong and their computer screen image has not changed for twenty minutes.

This other part of the computer, the mysterious and not as obvious component of the computer, is the called software. Software can be placed in two categories either Application Software or Operating Systems Software. Application Software are programs that are developed to perform specific functions for the end user. The Operating System is a group of programs that control or instruct the hardware on how and when to perform routine operations, example: Printing. There are many operating systems in use today, a few examples are Windows 95/98, Windows NT, MS-DOS, UNIX and one you may not have heard of, LINUX. The focuses of this report are the operating systems UNIX and LINUX, two very interesting and powerful systems.

The first is often labeled as too confusing and unfriendly, the later is relatively unknown to the novice user, but surprisingly they are very similar in design. A short history of the two operating systems may explain why they are so similar. UNIX is a creation out of Bell Labs in the 1960's, in a project headed by Stephen Bourne. The idea was to create an operating system whose kernel (core part) was as tiny as possible. The main driving force, the small UNIX kernel, was that the developers were doing their work on what were considered in that day to be tiny computers. The severe limitation on RAM resulted in a small kernel with all the utilities implemented as separate, stand-alone programs.

Each was itself tiny, and designed to accept input from the preceding program as well as provide output to succeeding programs. This process of using output from one program as input into another is referred to as piping and is central to UNIX operating systems today (UNIX & LINUX Answers! Certified Tech Support (c) 1998). LINUX is a creation of Linus Torvalds, in 1991 when he was a computer-science student in Finland. Since then, hundreds of independent programmers across the Internet have contributed to the development of the UNIX-like software. This is possible because the LINUX source code, the computer instructions in the original form, is freely available to anyone who cares to download or modify it.

LINUX is quickly growing in popularity among serious users because of its strong ties to UNIX and its powerful capabilities, in many publications referred to as "Little UNIX". LINUX is also growing in the corporate world with one of UNIX's largest vendors "SCO" providing support assistance on their web site. Some other well-known LINUX distributors are Red Hat and Caldera (Communications News: Aug 1999, vol. 36). It is easy to see from the brief histories given that these two operating systems are very similar at their core (kernel), to see if the similarities continue as you work away from the kernel, a look at the multitasking, memory management, multiprocessing, and multi-user capabilities is needed. Due to the fact that computer technology has not quite advanced enough to create machines with unlimited amounts of memory or number of processors, the kernel maps the demands of the application or user program to the resources available. Several programs may be executed at one time by scheduling each process to run for a fraction of a second; a round robin arrangement is used so that each process appears to be running continuously and the users see no indication that their program is spending most of its time in a state of suspension.

The kernel keeps track of how much time each process spends running, so that no processes are ignored; however, the more processes that are running concurrently, the less time each process spends being attended to by the CPU, and the systems appear to run more slowly (web Professional Services). Memory management is also the responsibility of the kernel. A computer capable of running a multi-tasking system may have to deal with widely varying demands for memory. At some point in time there may be no users logged on and the only tasks running are the kernel and a backup process. At other times there may be ten or more users logged on all trying to carryout complex operations that demand extensive amounts of memory. In this case both UNIX and LINUX systems provide what is called "virtual" memory.

With "virtual" memory each process "sees" a specific amount of memory available to it, in fact the kernel only gives out memory to a process as and when it requests it. When a process is not actually running, the kernel can swap or page the contents of its physical memory out to a swap space on disk, freeing it up temporarily for another process. The user's process refers to each unit of memory by its address (a number indicating where in the address space of the process, that is, its available memory, the unit lies), and the kernel maps from the requested address to the real memory address, which may be located somewhere else in the computer's memory or paged out to disk. Disk accesses are slow compared to memory accesses. Consequently, a process with high demands on memory may sacrifice large amounts of time waiting for pages of memory to be read in or written out to disk.

When the system runs low on memory, it may forcibly swap out processes that have been running for a while to make room for other processes. When memory demands exceed the memory available, it may begin to "thrash", meaning that the time it spends swapping processes in and out may exceed the amount of time it spends running them. The advantage of virtual memory is that, while it is not inexhaustible, it does not run out suddenly; the system does not abruptly refuse to start new processes because it is running low on memory. Thus, as the load on the system increases, its performance tends to degrade gradually (web Professional Services).

UNIX systems include multiprocessor capabilities and a software key mechanism that enforces licensing restrictions. With multiprocessor capabilities comes the ability to manage the processors and processes. The system includes a software key mechanism that limits the number of processors that can be used when running a specific UNIX system binary, and controls the number of concurrent users. To assist with processor control, UNIX uses the Processor Manager to switch processors on and off and to see the details of processors. The Processor Manager displays the processors on the current system. With all the discussion of multi-tasking, multiprocessing and swapping memory it becomes obvious that these systems are capable of handling multi-user's and platforms.

This means hundreds of people can use one computer at the same time, either over a network, the Internet, on laptops / computers or terminals connected to the serial ports of those computers (web Professional Services). When working with or just reading about UNIX or its cohort LINUX, there are continuous references to the systems shell. The shell is the command interpreter. It's a program that sits between the user and the underlying kernel of the operating system. Its purpose is to protect the user from the kernel, even more importantly, to protect the kernel from the user. In the MS-DOS world, this shell is called COMMAND.

COM, which is, in turn, often surrounded by other shells such as DODD HELL or the ultimate DOS shell, Microsoft Windows (UNIX & LINUX Answers! In UNIX you have a choice of shells. The oldest of the shells currently in use is "sh" and is called the Bourne shell. The Bourne shell is available on all UNIX systems.

For the interactive user, it lacks some critical features, like job control, but it provides a good base for writing most shell programs (UNIX & LINUX Answers! Until recently, the most popular shell for the interactive user was "cash", the C shell. Originally developed at the University of California at Berkeley as part of their UNIX implementation, it has features for the interactive user, including the ail it to recall commands previously used, as well as the ability to move jobs from the foreground to the background and back again (job control). As the name implies, it has a syntax and command structure modeled after the C programming language, making it particularly popular with programmers. Most versions of UNIX will have the C shell available (UNIX & LINUX Answers! The most popular shell at the moment is the "kwh", the Korn shell.

Named for its creator, David Korn, this shell is fully compatible with the Bourne shell but adds most of the features that made the C shell so popular, plus some other additions. One of the most important of these is the ability to not merely recall an old command, but to be able to edit it as well. One other UNIX shell on the rise in popularity is called the Posix shell. The Posix shell is a close relative and performs very similarly to the Korn shell. LINUX, being a UNIX clone naturally is required to use shells similar to the previously discussed UNIX shells.

The difference with LINUX is they seem to learn quickly from other peoples mistakes and manage to create something a little better than everyone else. The name of the default shell for LINUX operating system is the Bourne Again shell, referred to as the "bash."bash" is freely available for every version of UNIX and even Windows 95 (web How to). "bash" understands all Bourne shell syntax, in fact, it will completely mimic the standard Bourne shell when using the correct shell script / bin / sh. "bash" also understands most Korn shell syntax and borrows a lot of features from nearly every popular shell. This includes filename completion, history recall, command line editing and lots more. Now that it is understood that the shell is the translator between the user and the kernel, it is time to move on to discuss the UNIX file systems and Directory structures (web How to). The directory structure used by UNIX is the same as directory structures used by most operating systems, the hierarchical directory.

This is also referred to as a tree structure. There is a "root" directory and under it a series of subdirectories. Each subdirectory can in turn have multiple subdirectories under it and so on. The depth or amount of subdirectories differs from each type of UNIX.

In reality the directory is just a large file that holds the names of the files and subdirectories that lie within it, along with the in ode number for each file or directory (UNIX & LINUX Answers! There are two special directories, the dot directory (.) and the dot-dot directory (... ). The dot directory is your current directory, while the dot-dot directory is the one above where you are. This set up gives the user a great advantage.

If you are working on a project with a group of people, and you have your documentation files stored in one directory, your source code file in another, and header files in a third, it can be difficult to move to the document directory using an absolute path name, (example cd / us /project / show tell / doc ) every time you want to update the documentation on the change you made to the header file, which has a path name just as long. This system allows the user to change to the documentation directory from the Header directory, by just typing cd... /doc (UNIX & LINUX Answers! Earlier there was a brief mention of something called an in ode. An in ode is the data structure that UNIX uses to keep track of where each file is in the system, as well as other important information such as its permission and ownership. It, in some ways, resembles the File Allocation Table on a DOS disk (web Professional Services). The UNIX concept of file system is different from what a typical DOS user has come to expect.

There's a "root" file system that every UNIX machine must have, which resembles the "C:" drive on a DOS machine, but that is the end of the similarities. Rather than assigning additional drive letters for each additional hard disk you add, the hard disks each get their own file system, which then "mounts" on the "root" file system. Therefore, on a large system with many users and a substantial number of commercial programs, you might well have, for example, the root file system and a "/u" file system that contains the home directories for all the users, and another "/us" file system that contains the most of the commercial programs. It is also very possible that if you are working in a distributed workstation environment that the "/u" file system is actually the same regardless of which machine you happen to log in on. On one of the machines, it's physically in that box, but on all the rest, it is remotely mounted. This sort of setup allows you to use any available workstations without worrying about which one it happens to be.

Your home directory is exactly the same. Now that there is an understanding of the directory and file systems this would be a good point to list some examples of frequently used UNIX commands (web Professional Services)... There are hundreds of UNIX commands floating around in fact in some cases the same command may be written differently from one UNIX package to another. The following are just a few of the more commonly commands and options: Alias-assigns a shorthand name to substitute for cmd. If = 'cmd' is omitted, it prints the alias for name. Korn shell only.

Options and Variables-t creates a tracked alias for a UNIX command. The shell will remember the full path name of the command, making it easier to find -x Exports the alias so it can be used in shell scripts. bg-Put current job or specified job IDs in the background. Korn shell only. Cal-Displays a calendar on the standard output. Options and Variables Month Use a number between 1 and 12 or enough letters to represent a unique month. Year any number between 1 and 9999.

You have to include all four digits. cd- changes the current working directory. Options and Variables Directory name The name of the directory you want to make current. Chmod-Changes the mode of files. A file's mode controls the permission for access associated with that file. Only the owner of a file (or the superuser) can change its mode. Options and Variables Who Opcode Permission u User + Add permission r Read g Group - Remove permission w Write Others = Set permission to be x Execute a All (default) to be only what's's Set user (or group) ID specified.

Hopefully the above examples will, if nothing else, familiarize you with some of the UNIX commands (UNIX & LINUX Answers! You never know, one day you may come across a computer that is not running on a Microsoft product and you may have to read or write something! This concludes the comparison and analysis of the UNIX and LINUX systems but hopefully not our advances in the Information Age. The purpose of this report was to show that, besides being closely related, the two systems are very stable and user friendly. In many ways they offer more attractive features than other operating systems.

The powerful abilities of the kernel and shell system used to control multi-tasking, multiprocessing, memory management, multi-users and platforms with only the worry of a possible system slow down (gradual) when reaching max capacity rather than coming to a complete stop as with other systems says a lot for these two systems. There is one final topic that deserves an honorable mention before ending. This is for all the GUI fans out there. Both operating systems are available with GUI to allow you to your process of point and click. UNIX and LINUX: Multiple Choice Questions 1. Which of the following is FALSE about LINUX? a.

LINUX has Multi-users capability. b. LINUX has an open source code available over the Internet. c. LINUX is a new word processing application developed for UNIX systems. d. Memory management is controlled by the systems kernel. 2. The UNIX operating system is capable of all of the following EXCEPT. a. swapping physical memory out on to disk space.

UNIX is capable of multiprocessor management. c. In multi-task situations, the kernel uses a round robin schedule to give the appearance that each task is running continuously. d. The UNIX kernel is large requires extensive amounts of memory to run efficiently. 3. Which of the following statements is false? a. Memory management is controlled by the kernel. b".

Virtual" memory is a concept only seen in Star Trek movies. c. Disk accesses are slow compared to memory access. d. The kernel may swap a non running process out on disk to free up memory for running programs. 4. When memory demands exceed the memory available, it may begin to (fill in the blank) a.

Thrash b. Crumble c. Crash. Freeze 5. The Processor Manager is responsible for: a. The entire Systems Department and he / she assigns work assignments to staff. b.

Switches the processor on and off. c. Displays the processors on the current system. d. Both b and c are correct. 6.

The LINUX which is highly praised for its efficiency is: a. MS-Dos. Korn shell c. DODDHELLd". bash"7. The purpose of the shell is to act as a (n) (fill in the blank) a. command interpreter b. tool bar. Icon featured.

A parallel port to a Laser Printer 8. The most popular UNIX shell is the (fill in the blank). a". sh" or Bourne she llb". kwh" or Korn shell c". bash" or Bourne Again she lld". cash" or the C shell 9. All of the following are true about UNIX Directories EXCEPT: a. Uses a Hierarchical Directory similar to most other operating systems. b. Contains a "root" directory with series subdirectories under it. c. The dot-dot directory (... ) is similar to a file allocation table. d.

The dot directory (.) is your current directory. 10. All of the following are true EXCEPT: a. LINUX can be used over the Internet. b. UNIX and LINUX are similar in design. c. The in ode is similar to the File allocation Table. d.

The UNIX file system is identical to that of a typical DOS system. Answer Key: 1. c 2. d 3. b 4. a 5. d 6. d 7. a 8. b 9. c 10. d.