Up: The Shell

Introduction

January 28th, 2012 Leave a comment Go to comments
slide 01 Hello, and welcome to the first episode of the Software Carpentry lecture on the Unix shell. In this episode, we’ll explain what a shell is, and why you might want to work as if the year was 1975.
slide 02 At a high level, computers really do four things.
slide 03 They run programs.
slide 04 They store data.
slide 05 They communicate with each other.
slide 06 And they interact with us.
slide 07 They can do the last of these in many different ways.
slide 08 For example, they can use telepathy, i.e., direct brain-computer links. This technology is still in its infancy, but I for one look forward to being assimilated as it matures.
slide 09 Another way to interact with computers is to talk to them. No, to talk to them, not dock the pen. Um, as you can tell, this technology is also still somewhat immature.
slide 10 What most of us use for interacting with computers is a WIMP interface: windows, icons, mice, and pointers. While these technologies didn’t become widespread until the 1980s, their roots go back to Doug Engelbart’s work in the 1960s, which you can see in what has been called “The Mother of All Demos“.
slide 11 Going back even further, the only way to interact with early computers was to rewire them.
slide 12 But in between, from the 1950s to the 1980s and into the present day, people have used a technology that’s based on the old-fashioned typewriter, and that technology is what we’re going to explore in this lecture.
slide 13 When I say “typewriter”, what I actually mean is…
slide 14 …a line printer connected to a keyboard, like the DECWriter LA-36 shown here.
slide 15 These devices only allowed input and output of the letters, numbers, and punctuation found on a standard keyboard, so programming languages and interfaces had to be designed around that constraint.
slide 16 Although if you were clever enough, you could find ways to do simple pictures using just those characters.
slide 17 This kind of interface is called a CLUI, or command-line user interface, to distinguish it from the GUIs, or graphical user interfaces, that most of us are now used to.
slide 18 Normally, a user starts a CLUI session by logging in with a user ID and password.
slide 19 The user then types a command.
slide 20 The computer executes the command and prints it output: in the case of older terminals, literally printing the output onto paper, a line at a time.
slide 21 The user then types another command…
slide 22 …which the computer executes, displaying output…
slide 23 …and so on until the user logs off and takes his or her roll of paper away to study.
slide 24 From this description, you’d think that the user was sending commands directly to the computer, and that the computer was sending output directly to the user.
slide 25 In fact, there’s a program in between called a command shell.
slide 26 What the user types goes into the shell, which figures out what commands to run and orders the computer to execute them. The computer then sends the output of those programs back to the shell, which takes care of displaying things to the user.
slide 27 A shell is just a program like any other; the only thing that’s different about it is that its job is to run other programs, rather than to do calculations itself.
slide 28 The most popular Unix shell is bash, the Bourne again shell. (It’s called that because it’s derived from a shell written by Stephen Bourne. This is what passes for wit among programmers.) Bash is the default shell on most modern implementations of Unix…
slide 29 …and also comes with Cygwin, the Unix-on-Windows toolkit that we’re using in this course.
slide 30 Using it, or any other shell, feels a lot more like programming that like using windows and mice.
slide 31 Commands are terse—often only a couple of characters long—and their names are often cryptic.
slide 32 So why should you use it? There are two good reasons.
slide 33 First, many tools only have command-line interfaces, or are easiest to use—particularly on remote machines—through the command line.
slide 34 Second, the shell allows you to combine existing tools in powerful ways to create new tools of your own with little or no programming. As we’ll see later in this lecture, this lets you do a lot of work with just a few keystrokes—once you have paid the up-front cost of learning how the shell works and what its basic commands are.
slide 34 In the next episode, we’ll take a look at how to find your way around files and directories using the shell.

  1. September 3rd, 2010 at 21:50 | #1

    Very nice.

  2. Sunil
    December 25th, 2011 at 18:40 | #2

    Why is my directory structure different than what is mentioned above: bin, dev, etc, home, lib, tmp, usr, var

  3. Sunil
    December 25th, 2011 at 18:42 | #3

    P.S. Sorry, this was meant to be against the lecture on Files and Directories.

  1. No trackbacks yet.