Week 1 - Introduction to Linux

Week 1

Course Overview, Introduction to Linux, Shell Basics
  • History of UNIX and Linux
  • The Open Source movement
  • The Linux kernel and the GNU utilities
  • Linux distributions
  • Basic shell commands
  • Finding help

Introduction to Linux

History of UNIX and Linux

  • 1965: Bell Labs (AT&T), MIT, and GE develop Multiplexed Information and Computing Service (MULTICS).
    Features multi-user, multi-processor, hierarchical file system. MULTICS never really succeeded as a product.
  • 1969:
    AT&T drops out of MULTICS project. Ken Thompson and Dennis Ritchie
    decide to port Space Travel game to unused PDP-7 minicomputer, and in
    doing so realize it could host a MULTICS-like operating system.
    Thompson and Ritchie (along with Doug McIlroy and JF Ossanna) write the
    Uniplexed Information and Computing Service (UNICS). UNICS is quickly
    renamed UNIX.
  • 1971: UNIX now running on a Digital Equipment Corporation
    PDP-11 with 16KB of RAM (8KB for applications) and a whopping 512KB of
    disk.
  • 1972: Dennis Ritchie and Brian Kernighan modify the BCPL language into B and then C.
    By late 1972, UNIX is largely rewritten in C, allowing it to be ported to other computer architectures much more readily.
  • 1974: AT&T licences UNIX to universities who can clearly see the educational potential.
  • 1977: 500 UNIX installations worldwide.
  • 1980: Berkeley's enhancements released as Berkeley Software Distribution (BSD) 4.1.
  • 1983: BSD 4.2 released, AT&T releases System V, and Sun (also a Berkeley spinoff) releases SunOS.
  • 1984: 100,000 UNIX installations worldwide.
  • 1988: AT&T and Sun join forces to produce System V Release 4, later rebranded as UnixWare and Solaris 2.
  • 1991:
    Linus Torvalds of Helsinki, Finland, decides the free but limited Minix
    operating system is too confining and creates the Linux kernel version
    0.01 for the 386. First version of Linux is so limited, it requires
    Minix to compile the kernel.
  • October 5, 1991: Linus releases the first official Linux kernel, version 0.02.
    The bash shell and gcc compiler could run on this kernel, but not much else.
    Fortunately, a number of interested hackers from across the Internet took up the challenge to build on Linus's work.
  • March 1994: Linux version 1.0 released.
  • 1996:
    3 Million UNIX systems shipped world-wide. Many different brands of
    UNIX: Linux, HP-UX (Hewlett Packard), AIX (IBM), Solaris (Sun),
    FreeBSD, etc.
  • January 2002: There are a guestimated 18 Million users of Linux.

Open Source

GNU and the GPL

  • 1983: Richard M Stallman (RMS) at MIT founds the Free Software Foundation (www.fsf.org).
  • RMS believes all software should be freely available, including source code, without restrictions.
  • Money to be made from service and customization rather than software sales.
  • To
    prove the point, RMS and others start the GNU (GNU's Not Unix) Project
    to duplicate all of the UNIX system utilities and programs and release
    them under a new license.
  • The GNU General Public License (GPL) requires source code
    to be distributed alongside binaries, and that all programs that arise
    from modifications to the source, or that are built on top of this
    source, are also licensed under the GPL.
  • GPL-licensed software can be sold for profit.
  • "copyleft" describes this form of licensing: credit for work, rather than control of the work.
  • copyleft is not public domain: author(s) of the work are still clearly defined.
  • Many
    other Open Source licenses: GNU Library/Lesser General Public License
    (LGPL) does not require products build on top of LGPL-licensed code to
    be released under the LGPL or GPL, Apache, Mozilla, Python, IBM Public
    License, BSD, Intel Open Source License, etc.
  • Linux originally released under restrictions that it cannot be sold, but later released under GPL.

How can Open Source Exist?

  • Volunteers write code for many reasons: necessity (like Linus), to make a name for oneself, and because it's fun.
  • To make money, consider analogy of giving away VCRs but then selling the tapes.
  • IBM
    is a big Linux booster, in part because they make their big money
    through service contracts to support and maintain systems like Linux.

Why Open Source?

  • For popular projects like Linux, so many eyeballs go over the code that very few bugs or security holes last for long.
  • Less popular projects may be very buggy.
  • Easy to create new or custom software based on existing source.
  • Usually free, or at least cheap.
  • Good for the soul. How much more money does Bill Gates need anyway?

What is Linux?

The Kernel

  • "Linux" is just the operating system kernel.
  • The kernel is the intermediary between application programs and the computer hardware.
    The kernel manages: process scheduling, device I/O, virtual memory, file management (at a lower level than the filesystem)
  • The
    kernel protects users and processes from eachother. If a program
    crashes, it should not affect any of the user's other programs, nor any
    of the other users.
  • Linux kernel very stable. Crashes are rare.
  • Windows NT/2K kernel hard to see, except when it crashes: Blue Screen of Death. Usually a device driver is the culprit.

The Operating System

  • Technically, the operating system should be called "GNU/Linux" because only the kernel can really be called Linux.
  • All of the rest of the OS, shell, utilities, networking, etc. is part of the GNU Project.
  • Nevertheless, "Linux" is widely used to describe the whole of the OS.

Why Linux?

  • It's Open Source: free as in speech, free as in beer.
  • Also enjoys the stability and security of a popular Open Source project.
  • 35 years of UNIX knowledge has been built up and almost all of it applies to Linux.
  • Minimal hardware requirements compared with similar Windows or Macintosh systems.
  • Highly configurable. A hacker's delight!
  • Runs on a host of different processors: x86, Alpha, SPARC, PowerPC, ARM, 680x0, and many more.
  • Very popular. Jump on the bandwagon!

Why Not Linux?

  • Not as mature as the other UNIXes, especially on big iron hardware (although IBM is changing this).
  • Not as well supported as the large UNIX products.
  • Still not user-friendly for the desktop. Linux mostly runs on the server.

Linux Distributions

Kernel Versioning

  • 2 kernel versions at all times: stable and development.
  • Stable version is the one to use.
  • Development (or Beta) version is strictly for kernel-hackers.
  • Version numbering is: major.minor.patchlevel
  • If minor number is even, then it is a stable version.
  • If minor number is odd, then it is a development version.
  • Linux kernels obey these rules, but most other software versioning doesn't.
  • As of today, current stable kernel version is 2.4.17, and current development version is 2.5.1.

Distributions

  • You could download the kernel and all of the GNU Project
    utilities, create an install, configure everything manually, and you'd
    have a working Linux machine.
  • Or, you could save yourself a year or so of effort and buy or download a Linux Distribution.
  • Linux
    distributions contain: the kernel, GNU Project utilities, system admin
    tools, documentation, installation tools, hardware device drivers,
    technical support, GUIs (X and window managers), productivity apps
    (word processors, spreadsheets, graphics stuff), and so forth.
  • Companies bundle up all of these files and programs into a Distribution which they then sell, or give away.
  • Version
    number of distributions has nothing to do with version number of
    kernel, or with version numbers of the other distributions for that
    matter.
  • Popular distributions include: Red Hat, Debian, Mandrake, SuSE, Slackware, and others (see Resources section)
  • Red Hat: most popular distribution.
  • Debian: created by GNU folk. Not for the Linux beginner. Tends not to include utilities until they are thoroughly tested.
  • Mandrake: appeals to the first time Linux user. Very smooth installation process.
  • SuSE: favoured by developers.
  • Slackware: one of the first, but takes a very DIY approach to installation and configuration.
  • Most distributions also have different packaging: basic, workstation, server, enterprise, etc.

Distribution Versions

  • Red Hat 6.0 (Hedwig) = 2.2.5 kernel
  • Red Hat 6.1 (Cartman) = 2.2.12 kernel
  • Red Hat 7.0 (Guinness) = 2.2.16 kernel
  • Red Hat 7.1 (Seawolf) = 2.4.2 kernel
  • Red Hat 7.2 (Enigma) = 2.4.7 kernel, with most recent patches = 2.4.9-13 kernel
  • Debian 2.2r4 (Potato) = 2.2.19 kernel
  • Mandrake 8.1 = 2.4.8 kernel
  • SuSE 7.3 = 2.4.10 kernel
  • Slackware 8.0 = 2.4.5 kernel

Shell Basics

What is the Shell?

  • The shell is the interface between the user and the
    operating system. The command prompt and the GUI are built on top of
    the shell.
  • In class, "shell" and "command prompt" will be used interchangably.
  • There
    are a number of different shells available: Bourne (the first), C (uses
    a C-like syntax), Korn (combines best of Bourne and C), the Bourne
    Again Shell (bash, also a combo of the others), and more.
  • The Bourne Again Shell, bash, is the default for Linux and the one we'll use. It is part of the GNU Project.
  • bash
    is responsible for: command line editing, job control, stream
    manipulation (piping & redirection), wildcard expansion, aliases,
    file completion, command history, variables, control structures, sub
    shells, etc.

Linux vs. Windows

  • In Linux, letter case matters: FOO.txt is different from Foo.txt is different from foo.txt.
  • Linux (and the Internet) uses forward slashes (/) when specifying a directory path, Windows uses backslashes (\).
  • Linux commands usually use hyphen (-) for command switches, Windows uses a combination of hyphens and slashes (/).

Logging In

  • There are two types of Linux users: root, and everybody else
  • The root user has complete control over the system, for that reason do not log in as root unless you need to perform a system administration task.
    All other times, log in as a regular user ("student") so that a mistake can't wipe out the system.
  • Linux will display a login prompt. Enter your user name and hit return, and then enter your password and hit return.
  • If
    you log in to a GUI console, you can start the command prompt by
    selecting the shell icon on the bottom of the GNOME (foot in front of a
    monitor) or KDE (seashell in front of a monitor) screen.
  • If you log in to a text console, you're already in the command prompt.

Virtual Consoles

  • You may run multiple independent login sessions through Linux's virtual console feature. Typically 6 of these are available.
  • To access the different consoles, press Alt and one of the function keys F1 through F6 together.
  • Depending on the configuration you may not need to log in when you switch to a new console.
  • The
    virtual consoles are completely independent, you cannot share items
    (like the clipboard, for example) between them. They can share files
    though.

Logging Out

  • If you're in a GUI window command prompt, use "exit" to
    close the window. Then select Logout from the GNOME or KDE main menu
    (bottom left of screen).
  • If you're logged in through text mode, use "logout" to log out of the system.
  • "exit" can also be used to logout of a text mode session.

No comments:

Post a Comment