Unformatted text preview:

What is UNIX?What is UNIXWhat does "multi-user" mean?What about multi-tasking?Why all the fuss about UNIX?Why did UNIX become popular?User interfaces: The UNIX advantageThe UNIX user interfaceUNIX, in a nutshellShellsWhat the shell looks likeSo you'd rather use a GUI?Composing commandsComposing Commands (2)UNIX Graphical User InterfacesLinux Desktop EnvironmentsCopyright 2006 Stewart WeissCopyright 2006 Stewart WeissWhat is UNIX?What is UNIX?A Little Bit about UNIX and User Interfaces2 CSci 132 Practical UNIX with PerlWhat is UNIX?It is a multi-user, multi-tasking operating system. An operating system is a program or collection of programs that manage the computer's hardware and software resources and provide an interface so that people can use the computer. Operating systems do things like managing memory, managing I/O devices, deciding which programs should run, and protecting users' data from each other.3 CSci 132 Practical UNIX with PerlWhat does "multi-user" mean? Multi-user: when two or more people can work on the same computer at the same time, using different terminals.A terminal is a device with a monitor and a keyboard. (The concept is more complex than this, but for now think of it this way. There are also special windows called pseudo-terminals.)4 CSci 132 Practical UNIX with PerlWhat about multi-tasking?Multi-tasking: when two or more programs can be running on the computer at the same time.This does not imply that there has to be more than one processor; they can “time-share” the processor in the same way that people time-share a vacation house.Even modern Windows and Macintosh operating systems support multi-tasking. (Take a look at the list of applications and processes in the Windows "Task Manager".)5 CSci 132 Practical UNIX with PerlWhy all the fuss about UNIX?UNIX is a professional operating system that lets you do sophisticated tasks easily.It lets you customize your work environment and create new commands.It is inherently very secure because of the way it was designed (but it is not immune to attacks).There are free versions of it that are easily obtained. Linux is one of the most popular versions of UNIX that can be obtained for free, but not the only one!6 CSci 132 Practical UNIX with PerlWhy did UNIX become popular?UNIX was unique in that it was:Portable: It was easily modified to work on new types of computers as they came into existence (because it was written in C, a novel idea back then.)Very Small: The original version of Unix was about 10,000 lines of C, and about 1,000 lines of assembler. (Windows Vista had about 50,000,000 lines of code.)Free: It was distributed to universities and research laboratories for free by AT&T.Innovative: It had many features that were not part of any other operating systems.7 CSci 132 Practical UNIX with PerlUser interfaces: The UNIX advantageEvery computer operating system provides one or more user interfaces. A user interface is the part of the operating system that allows the user to direct the operating system, i.e., to tell it what to do.The primary user interface of the Mac OS and Windows is a graphical user interface (GUI), in which you use a point-and-click device (e.g., mouse) and keyboard to direct the operating system.8 CSci 132 Practical UNIX with PerlThe UNIX user interfaceIn contrast, you tell UNIX what to do by typing commands in a command window, like the DOS cmd.exe window. There is no need for a mouse.This type of user interface is called a command-line interpreter or interface (CLI).Commands are essentially imperative verbs, always in lowercase letters, like "logout", "sort" or "date". You can sometimes figure out what they do by their names.9 CSci 132 Practical UNIX with PerlUNIX, in a nutshellThe main component of any operating system is the part that controls the hardware and software resources of the computer. In UNIX, it is called the kernel, because like the kernel of a nut, it is hidden away.The command-line interface is the visible part, but it hides the inner workings of the kernel. It is called a shell in UNIX.kernelshell10 CSci 132 Practical UNIX with PerlShellsThere are many different shells in UNIX, such as:the Bourne shell (sh), the C-shell (csh), the Korn shell (ksh), the T C-Shell (tcsh), the Z shell (zsh), andthe Bourne-Again Shell (bash) bash is a very popular shell among UNIX users.11 CSci 132 Practical UNIX with PerlWhat the shell looks likeAll shells work in the same way, displaying a prompt, waiting for you to type, and responding:(What you type is colored red ONLY IN THE SLIDES in order to distinguish between entered commands and UNIX's response.)$ ls my_directory analysis rawdata trials$ dateMon Jul 14 21:02:36 EDT 2014$ whoamisweiss12 CSci 132 Practical UNIX with PerlYou'd rather use a GUI?You may think that having to type on the keyboard is a minus, not a plus. It is not. For one, UNIX has hundreds of commands. They are much more powerful than those you find in a system such as Windows.Suppose files_to_copy is the name of a file that has the names of files that you want to back up. Try doing this in a GUI: cp `cat files_to_copy` backupdir which copies all files whose names are in files_to_copy into the directory backupdir.13 CSci 132 Practical UNIX with PerlComposing commands (1)UNIX also lets you compose commands and create your own commands by writing shell scripts, because the shells are also programming language interpreters!UNIX shells let you pipe the output of one command into another, as in this example:who | awk '{print $1}'| sort | uniqwhich prints a sorted list of names of users currently logged into the computer, and as incat f1 f2 f3 | sort -u which sorts files f1, f2, and f3 and removes duplicate lines.14 CSci 132 Practical UNIX with PerlShell ScriptsThe previous examples used a simple but powerful command composition operator called a pipe. Later you will learn more about pipes and other means of altering the flow of inputs and outputs in shell scripts.Scripts are lists of shell commands that are executed all at once, like batch files in DOS. Scripts can be extremely powerful, as you will discover.15 CSci 132 Practical UNIX with PerlUNIX Graphical User Interfaces Modern UNIX systems for desktop computers, such as Linux, also come bundled with one or more desktop environments with windows, menus, and a GUI.GNOME and KDE were the most prevalent desktops for Linux. There are many others now.Within the desktop,


View Full Document

CUNY CSCI 132 - UNIX Interfaces

Download UNIX Interfaces
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view UNIX Interfaces and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view UNIX Interfaces 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?