IT 244: Introduction to Linux/Unix
Class 2
New Material
Microphone
Readings
If you have the textbook you should read chapter 1,
Welcome to Linux and Mac OS X.
Homework 1
Remember, homework 1 is due this Sunday by 11:59 PM.
You will find it here.
Unix Account and Class Directory
Some you have not created a class directory and a
Unix account.
All work for this course MUST be created in to your class directory
A directory is what you probably call a "folder".
Without a class directory you cannot submit assignments.
If you do not have a Unix account go to
http://www.cs.umb.edu/~ghoffman/linux/cs_portal.html#creating_unix_account.
If you do have a Unix account you still need a class directory
for this course.
Go to
https://portal.cs.umb.edu/accounts/login/
,
log in, click the check box for my section of this course, and click
submit.
Help with Creating a Unix Account
If you have difficulty creating an account
must get help NOW!
You can see me after class or during office hours.
You can contact me on Zoom during office hours.
Or you can contact the
Class Assistant.
Whatever it takes, you MUST create a Unix account and
a class directory.
Class Assistant
The Class Assistant is Adam Rabbani, an
undergraduate IT student who can help you with your assignments.
You can reach him at Adam.Rabbani001@umb.edu.
You should contact the Class Assistant if you are having trouble submitting
your assignments.
I have asked him to schedule a Zoom sesion each weekend to help you with
any issues you might have.
You will find the details here.
Questions
Are there any questions before I begin?
New Material
- We will cover most of the chapters in the textbook
- We will skip chapters 6 & 7 - the
vi
and emacs
editors
- These programs are text editors that are run at the command line
- They are used to create and modify text files
- Text files have no formating like you would find in Microsoft Word
- Text files only contain characters
- Chapters 6 & 7 show you how to use
vi
and emacs
- But the best way to learn an editor is to use it
- Not read about it in a book
vi
and emacs
are full featured text editors
- You will need to use a text editor to complete your homework and Class Exercises
- But
vi
and emacs
take some time to learn
- I won't try to show you how to use these editors
- Instead, I'll show you
nano
, a simple text editor
nano
is good enough for our purposes
- You do not have to use
nano
- You can use any text editor that runs on Unix/Linux
- This rules out Notepad or Word
- I'll also skip chapter 9 which covers the TC shell
- This shell is not used much these days
- We will use the Bash shell in this course
- Bash has more features than the TC shell
- Bash is the default shell in most Linux installations
- We will not be installing Linux in this course
- Modern installers are very good - almost idiot proof
- Installing Linux is little more than running the installer and answering a few simple questions
- If you need it, you can get help installing Linux from the Boston Linux User Group
- This group holds periodic "Installfests" at MIT
- At these events, knowledgeable people will help you with the installation
- All work for the course will be done on our Linux machine, pe15.cs.umb.edu
- This machine runs Ubuntu Linux 20.04
Connecting to the Linux Machine from Home
Operating Systems
- The operating system
is the software that allows you to use a computer
- The textbook defines an operating system as
An operating system is the low-level software that schedules tasks,
allocates storage, and handles the interfaces to peripheral hardware,
such as printers, disk drives, the screen, keyboard, and mouse
- An operating system like a city government
- A city government provides resources - water, sewage, snow plowing
- It also provides protection - police and fire departments
- The operating system provides resources - memory, files and devices
- It also provides protection to keep one program from interfering with another
- And security to keep other people from messing with your files
- Every computer has an operating system of some sort
- Nowadays computers are found in most of the durable goods you buy
- Like cars and refrigerators
- You never see these computers
- But they are there making everything work properly
- These "invisible" computers are called embedded systems
- They too have operating systems
- But those operating systems are simpler than those on a desktop or laptop
Components of the Operating System
- There are three components of an operating system
- The kernel is code that allows programs to talk to the hardware
- No program can use any piece of hardware without going through the kernel
- It's like a traffic cop
- Hardware includes
- Memory
- Hard Disk
- Attached devices like printers
- The kernel is always running
- The shell is a program which allows the user to run programs
- The shell talks to the kernel
- Utilities are programs that allow you to use and manage computer resources
Unix
- I will use the terms Unix and Linux interchangeably in this course
- In truth, they have different histories
- Unix is an operating system developed as a research tool at Bell Labs
- Bell Labs was created as a research facility for the Bell telephone system
- Some of the most important advances of the 20th century came from Bell Labs
- Researchers there have won many
awards,
including some very important Nobel Prizes
- Unix has a number of powerful features
- It is often used in academic, engineering and research environments
- Unix was developed before Graphical User Interfaces (GUIs) become common
- The Unix philosophy is to create many small programs ...
- that do only one thing ...
- but do it very well
- Unix allows simple tools to be strung together to perform complex tasks
- This allows people to write commands that do complicated things on the fly
- When first created, Unix was given away free to universities
- Many Computer Science students learned to use it and grew to appreciate its power
Different Unix Releases
- Over the years a number of different Unix distribution have appeared
- All of these versions were based on source code from Bell Labs
- One popular Unix distribution is BSD which stands for Berkeley Software Distribution
- It was developed by the Computer Systems Research Group at the University of California at Berkeley
- Berkeley charges nothing for this Unix
- The BSD license is the least restricted open source license
- See
https://opensource.org/license/bsd-2-clause/ for more information
- The Macintosh runs a customized version of Unix that comes mainly from BSD
- Another popular Unix distribution is Unix System V
- It was released commercially by AT&T, the original corporate sponsor of Bell Labs
- There were four major releases of System V
- Release 4, abbreviated SVR4, enjoyed the greatest commercial success
- Some companies negotiated with Bell Labs to obtain copies of the Unix source code, such as
- IBM
- Hewlett-Packard
- Sun Microsystems
- These companies distributed their Unix version with computers they sold
- Or sold the software as a stand alone product
- Each distribution has its own modifications and additions
- The Unix used at UMB used to be Solaris
- Solaris was developed by Sun Microsystems as a commercial product
- Subsequently, Sun released most of the code base as an open source project called Open Solaris
- Sun was acquired by Oracle in January 2010
- We now use the Ubuntu Linux distribution at UMB
GNU and the Free Software Foundation
- Richard Stallman is a legendary figure in the Unix world
- He received a MacArthur "genius" grant
- He worked for many years at the MIT Artificial Intelligence Laboratory
- When Stallman started programming there was no software industry as we know it today
- Companies sold hardware and "gave away" the software
- The hardware was useless without the software
- So the cost of developing the software was folded into the cost of the machines
- Software was not thought of as a "product"
- So companies sometimes distributed the source code along with the machines
- Stallman and his associates liked this open environment
- When a bug was discovered, they could look in the source code to find the problem
- They could then make some changes and fix the problem directly
- As the computer industry matured, companies realized they could make money off software
- So they no longer provided the source code
- This this bothered Stallman
- He could no longer look at the source code to fix the bugs he found
- Instead, he had to report the bug to the company and then wait for a fix
- That could take a long time
- In 1983, Stallman announced plans for the GNU Operating System
- It would be distributed under the GNU License and would be compatible with Unix
- GNU is a recursive acronym that stands for "GNU is not Unix"
- In 1985 Stallman founded the Free Software Foundation
- It's mission was to develop GNU software and to advance the cause of free software
- By "free" Stallman meant that every user has the right to read and modify the source code
- It did not mean that an organization could not charge for the software
- The software was "Free as in speech, not beer"
- The Free Software Foundation charged a modest amount for its software
- Stallman's definition of free software is very strict
- He distinguishes it from open source software
- Stallman has written books on the subject of free software
which can be obtained from the
Free Software Foundation
- The GNU License is fairly elaborate
- You are free to change the source code for any software distributed under the GPL
- But you must distribute the improved source code under the same license
- You cannot charge for improvements to GPL software
- The GNU project first focused on developing tools to create the operating system
- Their most important contributions were
- The text editor,
emacs
- The compiler,
gcc
- Most of Unix is written in C
- So developing the GNU C compiler was an important first step
- The GNU project also created their own versions of standard Unix utilities such as
- These utilities were created without access to the Unix source code
- But they were written to work the same way the Unix equivalent did
- The most difficult part of the GNU project was writing the kernel
- So this was saved for last
- It would be the most difficult
- The GNU kernel was to be named Hurd
Linus Torvalds
- In the early 90's as Linus Torvalds was working on his Masters thesis
- In his free time he began a personal project that eventually became a Unix-like kernel
- In other words he wrote a program that worked the same way as the Unix kernel
- He released the source code for this kernel to the public
- Many programmers looked at this code and liked it
- They sent in improvements which Linus added to the code
- This improved kernel was widely distributed in open source circles
- The combination of this kernel and the GNU tools became Linux
- Today Linus Torvalds is the chief architect of the Linux kernel
Linux Distributions
- A Linux distribution consist of
- The kernel is always present in the computer's memory ...
- and deals directly with the hardware
- A program cannot talk directly to the hardware but must do so through the kernel
- The utilities help you use the machine's resources
- Applications are programs that are used to get work done
- A word processor or an email client are applications
- There are many Linux distributions
- Each released by a different group
- Each group looks at all the available Unix-like software
- They then chose different packages to combine into their own Linux distribution
- Most application depend on other software to function properly
- A package is all the software needed to make an application work
- Different distributions are created for different needs
- Most distributions are meant to be used on servers
- But some were created for embedded systems
- Distributions can differ in their directory structure as well
- That means that important directories have different names in different distributions
- And are located in different parts of the filesystem
- Many distributions use software called a
package manager
- A package manager is a set off software tools used to manage software packages
- A package manager can be used to install, update and delete a software package
- They will also download other software that the package needs to run
- These other packages are called
dependencies
- Package managers make it easier to install and maintain a Linux installation
- Different distributions use different package managers
- Some distributions are backed by companies such as
- These companies earn their money though support contracts
- Other distributions are maintained by a community of volunteers
- Examples are
Why is Linux So Popular?
- Today, most people use a version of Linux, not Unix
- Why?
- Except for BSD Unix, most Unix versions are owned by a company
- Each of these commercial versions did not have much market share
- So there was not enough money to pay for major improvements
- When programmers did make improvements there was no way to share it with other versions
- The software was proprietary
- It was owned by the company and the
source code
was not public
- All Linux software is open source
- This means anybody can look at the code and make improvements
- Or they can take ideas from one program and use them in another
Ubuntu
- The machine we'll be using in this class is pe15
- It is a virtual machine running Ubuntu 20.04 LTS
- Ubuntu is based on Debian Linux
- Development of Ubuntu is led by Canonical
- This company is based on the Isle of Man in Great Britain
- It is owned by South African entrepreneur Mark Shuttleworth
- Ubuntu is named after the Southern African philosophy of ubuntu
- Ubuntu is often translated as "humanity towards others"
- A new Ubuntu version is released every 6 months
- The Ubuntu version number is composed of the year and month of its release
- So version 20.04 was released in April of 2020
- LTS stands for "Long Term Support"
- An LTS version will be supported for 5 years after its release
- A new LTS version is released every 2 years
- Every Ubuntu release also has a name
- The name consists of two words:
- An adjective
- An animal whose name shares the same first letter
- The name for Ubuntu 20.04 LTS is "Focal Fossa"
- A fossa is the largest carnivorous mammal on the island of Madagascar
- One of the reasons for Ubuntu's success is its package manager
- If you type in a command that is not installed, Ubuntu will not give you an error message
- Instead it will suggest packages that will install the software you tried to run
Shells
- The shell
is the program that gives you the command line
- You use the command line to run programs
- To run a program the kernel creates a
process
- This process has space in memory and access to resources like files
- Only the kernel can create a process
- So you use a shell to talk to the kernel
- Modern shells provide a number of features that make them easier to use
- Down through the years there have been a number of different Unix shells
- Today, the two most common shells are the TC shell and Bash
- We will be using Bash in this course
Unix Commands
- To run a Unix program type the name on the command line
- Sometimes you want that command to work on something like a file or directory
- To do this you type the name of the file or directory after the command
- This is called an
argument
- Some commands have
options which appear right after the command
- Options change what the command does
- For example the
ls
command lists the contents of a directory
$ ls
foo.txt it244 work
- When
ls
is used with the -l
(for long) option, you get more information
$ ls -l
total 3
-rw-r--r-- 1 it244gh libuuid 16 2012-06-26 16:19 foo.txt
lrwxrwxrwx 1 it244gh libuuid 34 2012-02-07 09:46 it244 -> /courses/it244/s19/ghoffman/it244gh
drwxr-xr-x 2 it244gh libuuid 512 2012-06-27 11:08 work
- If
ls
is given the name of a directory as an argument
it will list the contents of that directory
$ ls html
it116_html it117_html it244_html
- Most Unix/Linux programs have very short names
- Like
ls
or cd
- This is to save time typing
- The names usually have mnemonic value
- For example,
ls
stands for "list"
- And
cd
stands for "change directory"
Today's Class Exercise
- To do the Class Exercise for today you need to use your laptop
- You will use it to connect to pe15
- See the Class Exercise for details
- If you have not completed the Apply process you will not be able to log in
- In today's Class Exercise, you will enter your first Unix commands
- Type the commands exactly as you see them on the page
Attendance
Class Exercise