Lecture

Week 30 Lesson Plan Addendum

Linux



Display a screenshot of Linux on overhead while giving this lecture.


History


In the early 70’s, a gentleman by the name of Ken Thompson got in trouble at his place of employment (Bell Labs) for playing games on a company computer. He survived and remained employed but was hooked on the game so he asked for and was granted access to an older machine that didn’t work too well. He did not have an operating system so he wrote his own OS and called it UNIX. It is written for large mainframe computers and usually does not have a GUI. It was a hardware independent OS and could run on any machine (that is called portability).


In 1991, in Helsinki, Leonard Torvald took the OS UNIX and pared it down to be able to use it on a PC.  Linus was his nickname and so he called his invention, Linux as a combination of Linus and UNIX. Mr. Torvald believed in Open Source software and made his source code available to anyone that wished to have it. The only requirement was that he insisted that anyone that modified or improved the OS would have to provide it free to others in keeping with the ideals of the Open Source idea.


Linux has some advantages and drawbacks


Advantages

Free

Looks and acts very similarly to a Windows Environment

No viruses – stable –well written

High Security

Open source

Very Fast operating and loading

Runs on older equipment very well

It is multi-user (several hundred users can be supported)

Multitasking is available When users log on they can run any application

Linux worth thousands on your paycheck and resume


Disadvantages

Not supported – no one to call

Not intuitive to use when getting into the guts of the engine

Limited applications have been written (changing as more and more are available)

Hardware support for new devices is limited – game of catch-up

When to use

Old computers with limited memory

Servers

Apache is most well known server

Almost all banks and government and real estate use for security robustness


Where to get

Online many, many different versions with new ones coming out all the time

Try www.linux.org for starters


Note: a Mac version is also available


Some companies have started with the basic core Linux Kernel (core) and written value added packages to use with the core. Some companies have bundled this with some documentation for which they charge – technically the software is still open source and hence free but you are paying for the documentation. One company that does that is Redhat and they made millions. Redhat and Novell have started offering their server version of Linux for a price again for the documentation.


An Aside: GNU means GNU not UNIX – called a recursive acronym

Linux File System


Linux uses what is called an extended file system called EXT2 (the 2 means version 2)

The file system is similar to the structure of Windows in that it is shaped like an upside down tree with directories and subdirectories and files all cascading under the main directory called root. Of course the directories are named different things but the structure is the same. Linux has directories such as:


/etc which contains the configuration files

/bin that contains the binary files

/mnt which contains the devices that are mounted

/dev which contains the device drivers and commands

/boot for the boot files

/home for the users home directories

/lib for the storage of library subroutines

/opt for optional software packages

/sbin for system commands

/tmp for temporary storage

/usr is a secondary hierarchy of the file system

/var for variable data



The best way to get a feel for Linux is to load it on a machine and play with it. Get to know the command and directory structure, etc. (just like you did for Windows when you first started)






Commands


who lists users

cat concatenate – view

cd change directory

chmod changes modes (permissions) on file attributes

clear clears the screen

cp copy

grep global reporting

ifconfig just like ipconfig in Windows

kill stop

ls list like dir

ls –al shows all

man manual (help files)

mkdir make directory

|more show one page at a time

mv move

ping packet internet groper

pwd present working directory – where you are in the directory tree

reboot reboots

eject spits out cd

rm erase files

rmdir removes directory

vi visual editor

bash enter the bash shell

alias create user friends aliases

head print first ten lines of a filename

tail print last ten lines of a file


vi Editor (note – vi is not capitalized)

Similar to notepad used to edit files in the Linux environment. Some commands useful in vi are


Alt – deletes the word to the right of curser

vi filename – edits or creates the file filename

All commands are case sensitive

W is move to home position

dw is delete the next word

Save the file using and exit – note must use the colon before the command

:exit


Note the line numbers


PICO is another recently invented line editor



Linux uses executables known as shells which are similar to Windows environment. A shell runs the internet browser, a shell runs the editor, etc. – top level shell is called bash – which stands for Bourne Again Shell (named for Robert Bourne part of the Unix build team – he also invented ctl-alt-del).


Unix and Linux uses redirection as very powerful way to manipulate data and files. Demonstrate on board redirection by writing the command:


cat /etc/shells > newfile <cr>


or


append /etc/shells > oldfile – this commands adds the contents of newfile to the end of the oldfile


or


print newfile > lpt0


Go into the permissions and using change mode to alter the permissions.


chmod 777 filename

cr

chmod 622 filename


Explain about decimal 7 is 111 in binary and the correspondence to the rwx displayed by the ls –al command.


GUI’s in Linux environments


GNOME – GNU Network Objects Model

KDE desktop


Use the command session to switch between desktops


startx commands initials the desktop (GNOME or KDE) if available


To start the GUI automatically – you have to edit the file

/etc/innitab run level 3 is the shell but run level 5 is the GUI

go to the line that says id: something, something and make sure it reads

id:5:initdefault


Superuser

After starting Linux you need to log in as a user and then give root a password

Then login as su root using the password you gave it

Or use sudo filename to execute to bypass password


Sharing is done by calling the process – exporting

To share your documents or folders, you edit the /etc/exports file. The format of the entries is

Filename:/path for example: maple:/pub