CIT 500: IT Fundamentals. Who am I? waldenj James Walden – Assistant Professor of Computer Science...

Post on 31-Dec-2015

219 views 0 download

Tags:

transcript

CIT 500: IT Fundamentals

Who am I? http://faculty.cs.nku.edu/~waldenj

James Walden– Assistant Professor of Computer Science– waldenj@nku.edu– Interests:• Secure Software Engineering• Security Metrics

Course Administration

Web Site http://faculty.cs.nku.edu/~waldenj/classes/2009/fall/cit500Notes, readings, and assignments on web site.

Assignment submissionUse submit program to submit assignments.

Contact InformationEmail: waldenj@nku.eduPhone: (859) 572-5571Office Hours: M 9:30-10:30, T 9:00-10:00

Class Goals

1. Administer a computer using a CLI.2. Explain filesystem organization, including inodes

and links.3. Explain package management, including how it

solves the dependency problem.4. Explain system processes and their relationships,

including booting and scheduling.5. Automate common system administration tasks

using shell scripts.

Topics

1. Operating Systems2. UNIX3. Logging In4. The Shell5. File Commands

What is an Operating System?

Program to help you use the hardware:– CPU– Memory– Disk– Other I/O: graphics, sound, printers, etc.

Properties provided by an Operating System– Ease of use.– Efficiency.– Fairness.– Reliability.– Security.

Layered View of a Computer System

Two Views of an OS

Top-down– E.g., The OS performs the task of dealing with

complicated hardware resources and gives you a comprehensive and simple machine, ready to use.

– In this way, the OS provides a virtual machine.

Bottom up– E.g., the OS decides how much space how much

RAM space is to be allocated to a program before it is loaded and executed.

– In this way, the OS is viewed as a resource manager.

Operating System Services

• Execution of a program• Input and output operations performed by

programs• Communication between processes• Error detection and reporting• Manipulation of all types of files• Management of users and security

CLI vs GUI

CLI– Input device is a keyboard.– Communicate by typing in a computer language.

Graphical User Interface– Input is taken from a point-and-click device.– Communicate by filling out forms.

Types of Operating SystemsSingle-user, single-process system– MS-DOS, MacOS 9, MS Windows 3.1.

Single-user, multiprocess system.– MS Windows 95, 98, ME.

Multiuser, multiprocess system– MS Windows NT, XP.– UNIX.– VMS.– Mac OS X.

Real time systems– QNX– RTLinux– VxWorks

UNIX Family Tree

What is Linux?

The Linux Kernel– OS kernel started by Linus Torvalds.– Developed by thousands across the world.– Coordinated via the Linux Kernel Mailing List.

Linux Distributions– OS kernel + libraries + tools.– Over 600 Linux distributions exist.– File /etc/lsb_release identifies distribution.– Family tree at

http://en.wikipedia.org/wiki/File:Gldt.svg

Kernel History

0.01 First version released by Linus (1991).1.0 First release (x86 only) in 1994.1.2 Supports other CPUs (Alpha, MIPS) in 1995.2.0 SMP support, more architectures (1996).2.2 Efficient SMP, more hardware support (1999).2.4 LVM, Plug-n-Play, USB, etc. (2001).2.6 Scalability (embedded, NUMA, PAE, sched),

kernel pre-emption, User-mode linux (2003).

Version Numbering: A.B.C.D

A: Major versionChanged twice: 1.0 (1994), 2.0 (1996)

B: Minor versionEven numbers are stable releasesOdd numbers are development releases

C: Minor revisionNot so minor in 2.6 as development continues.

D: Bug-fix / security patch releaseFirst occurred with NFS bug in 2.6.8.1Official policy as of 2.6.11

Kernel Versions

mm: Andrew Morton treeNew patches, almost ready for distribution.

ac: Alan Cox treeDistribution trees

RedHatMandrakeDebianGentoo, etc.

CSC 660: Advanced Operating Systems Slide #17

Obtaining the Kernel

Linux Supported Architectures ARM DEC Alpha Freescale 68k HP PA-RISC IBM Power, PowerPC IBM zSeries, System/390 Intel Itanium, Itanium II Intel x86, x86-64, including Xbox MIPS, including PS2, PSP OpenRISC Sun SPARC

DistributionsCommunity distributions:

– Debian– Gentoo

Commercially supported distributions:– Fedora– Red Hat Enterprise– Mandriva– OpenSUSE– Ubuntu

Live CD or USB distributions:– Knoppix– Puppy– Slax

Why so many distributions?

System types:– Desktop– Server– Specific embedded devices

Usage types:– Home user– Power user– Enterprise

User groups– Language– Music– Science

Where is UNIX used?Servers– 13% Linux, 49% UNIX, 38% Windows.

Network equipment– Firewall, IDS, managed switches, routers.

Cell Phones– About 8% of market.– SymbianOS has 47% market share.

Embedded devices– DVRs, TVs, MP3 players, VOIP phones, printers, cameras.

Desktops– MacOS X 10%, Linux 1-10%.

Logging On and Logging Off

General Categories– Local Area Network (LAN) Connection.– Internet Connection.– Stand-Alone Connection.

For the first lab, we will be logging ontokosh.nku.edu

Connecting via PuTTY on a MS Windows Box

Structure of a UNIX command#command [[ - ] option(s)] [option argument(s)] [command argument(s)]

Examples:

• $ ls• $ ls -la• $ ls -la m*• $ lpr -Pspr -n 3 proposal.ps

File Maintenance Commands

• What is File Maintenance?• File and Directory Structure– Home Directory– Current Working Directory

CIT 140: Introduction to IT Slide #28

File Maintenance CommandsViewing the Contents of Files– cat, more, less

# cat > myfile

This is an example of how to use the cat command to add plain text to a file

<Ctrl-D>

# more myfile

This is an example of how to use the cat command to add plain text to a file

CIT 140: Introduction to IT Slide #29

File Maintenance CommandsCreating, Deleting and Managing Files– cp, mv, rm, ls# cp myfile myfile2# mv myfile2 renamed_file# mv “latest revisions october.txt” laterevs.txt

# rm renamed_file# lsDesktopMailmyfile myfile2# ls –al

File Maintenance CommandsCreating, Deleting and Managing Directories–mkdir, cd, pwd, rmdir# mkdir first

# cd first

# pwd

/home7/smithj/first

# cd

# pwd

/home7/smithj

# cp myfile myfile2

# ls my*

myfile myfile2

# rmdir first

rmdir: first: Directory not empty

Obtaining Help with man

Obtaining Help with man

man [options][-s section] command-list

# man lsUser Commands ls(1)

NAME

ls - list contents of directory

SYNOPSIS

/usr/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file...]

/usr/xpg4/bin/ls [-aAbcCdfFghilLmnopqrRstux1@] [file...]

DESCRIPTION

For each file that is a directory, ls lists the contents of

the directory. For each file that is an ordinary file, ls

repeats its name and any other information requested. The

output is sorted alphabetically by default. When no argument

is given, the current directory is listed. …

whatis# whatis login setenvlogin login (1) - sign on to the systemsetenv set (1) - shell built-in functions to

determine the characteristics for environmental variables of the current shell and its descendents

apropos# apropos webneon neon (3) - HTTP and WebDAV client libinstaller installer (1m) - Solaris Web Start installersmcwebserver smcwebserver (1m) - start the Sun consolewbem wbem (5) - Web-Based Enterprise Mgmt

Other Forms of Help

Utility CommandsExamining System Setups– whereis, whoami, uname# whoamismithj# whereis mkdirmkdir: /usr/bin/mkdir# uname –aLinux kosh.nku.edu 2.6.16.29-xen #5 SMP Sun Oct 15 13:23:34 BST 2006 i686 GNU/Linux

SunOS zappa 5.9 Generic_112233-07 sun4u sparc SUNW,Ultra-250

Communication Commands– write username

Command Aliases • The alias command creates new names for commands.• Syntax for the alias command is:

alias name=string

Identifying the Running Kernel

> unameLinux> uname -r2.6.16.29> cat /proc/versionLinux version 2.6.16.29-xen (shand@endor) (gcc version 3.4.4 20050314 (prerelease) (Debian 3.4.3-13)) #5 SMP Sun Oct 15 13:23:34 BST 2006

Investigating the Running Kernel: /proc

###: directory for each running processcpuinfo: processor informationdevices: supported hardwarediskstats: disk performance statisticsmeminfo: memory usage informationmodules: linux kernel modulesnet: directory of network informationpartitions: linux disk partitionsswaps: swap files/partitions in use by kernelself: link to ### directory for current process

CSC 660: Advanced Operating Systems Slide #38

Process information> ls -alF /proc/selfdr-xr-xr-x 2 jw jw 0 2005-12-29 13:46 attr/-r-------- 1 jw jw 0 2005-12-29 13:46 auxv-r--r--r-- 1 jw jw 0 2005-12-29 13:46 cmdlinelrwxrwxrwx 1 jw jw 0 2005-12-29 13:46 cwd -> /proc/20041/-r-------- 1 jw jw 0 2005-12-29 13:46 environlrwxrwxrwx 1 jw jw 0 2005-12-29 13:46 exe -> /bin/bash*dr-x------ 2 jw jw 0 2005-12-29 13:46 fd/-r--r--r-- 1 jw jw 0 2005-12-29 13:46 maps-rw------- 1 jw jw 0 2005-12-29 13:46 mem-r--r--r-- 1 jw jw 0 2005-12-29 13:46 mountslrwxrwxrwx 1 jw jw 0 2005-12-29 13:46 root -> //-r--r--r-- 1 jw jw 0 2005-12-29 13:46 stat-r--r--r-- 1 jw jw 0 2005-12-29 13:46 statm-r--r--r-- 1 jw jw 0 2005-12-29 13:46 statusdr-xr-xr-x 3 jw jw 0 2005-12-29 13:46 task/-r--r--r-- 1 jw jw 0 2005-12-29 13:46 wchan

Process information> cd /proc/self> cat cmdline ; echo-bash> cat environ | tr '\0' '\n' | head -8ENV_SET=1MANPATH=/usr/local/man:/usr/man:/usr/share/manPATH=/usr/ucb:/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/binTERM=xtermSHELL=/bin/bashEDITOR=vimVISUAL=vimPAGER=less> ls -l fdtotal 4lrwx------ 1 jw jw 64 2005-12-29 13:50 0 -> /dev/pts/3lrwx------ 1 jw jw 64 2005-12-29 13:50 1 -> /dev/pts/3lrwx------ 1 jw jw 64 2005-12-29 13:50 2 -> /dev/pts/3

Logging OffExit

# exit

Logout

Connection to zappa.nku.edu closed.

Ctrl-d will do the same thing.

References

1. Syed Mansoor Sarwar, Robert Koretsky, Syed Ageel Sarwar, UNIX: The Textbook, 2nd edition, Addison-Wesley, 2004.

2. Nicholas Wells, The Complete Guide to Linux System Administration, Thomson Course Technology, 2005.