pos/420 philip robbins – march 19, 2013 (week 2) university of phoenix mililani campus...

56
POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Upload: juliana-flavell

Post on 29-Mar-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

POS/420

Philip Robbins – March 19, 2013 (Week 2)University of Phoenix Mililani Campus

Introduction to Unix

Page 2: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Agenda: Week 2

• Quiz #1 Due (Review & Grade)• Week 2

- File Structure- Basic Terminal Commands- Permissions

• In Class Lab (Assignment) #1 Due Today• Take Quiz #2

Page 3: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Review Week 1 List of Commands

man – manual pages

ls – list directory contents

pwd – print working directory

passwd – change password

sudo – execute command as superuser

su – login as superuser

shutdown – shutdown

Page 4: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Linux File System Structure

Page 5: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Linux File System Structure

Page 6: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

root (/)

Page 7: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

File Structure: Binaries

• What’s the difference between:- /bin- /sbin- /usr/bin- /usr/sbin

Page 8: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

File Structure: Binaries

• What’s the difference between: /bin & /usr/bin

When UNIX was first written, /bin and /usr/bin physically resided on two different disks: /bin being on a smaller faster (more expensive) disk, and /usr/bin on a bigger slower disk.

Page 9: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/bin

• Essential User Command Binaries- Contain commands used by both system administrators

and users.- There must be no subdirectories in /bin.

Page 10: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/boot

• Static files of the boot loader- Contains everything for the boot process (at boot time).- Does not include boot configuration files not needed at

boot time.- Stores data that is used before the kernel begins

executing.- OS Kernel is stored in either / or /boot.

Page 11: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/dev

• Device Files- Location of special or devices files.

Page 12: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/etc

• Host-specific system configuration- Contains configuration files.- Must be Static and cannot be an executable binary.- Required in /etc: opt, X11, sgml, xml

Page 13: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/etc

Page 14: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/srv

• Data for services provided by this system.

- Contains site-specific data which is served by this system.

- Naming methodology not specified.- e.g. /srv/ftp, /srv/pos420/www- Data that is of interest to a specific user should go into that

users home directory.

Page 15: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/tmp

• Temporary Files- Must be made available for programs that require the use

of temporary files.- Recommend that /tmp files be deleted upon system reboot.

Page 16: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/usr

• User Hierarchy- Second major section of the file system.- Used for shareable, read-only data.- Required directories:

bin - essential command binaries

sbin - essential system binaries

include - header files used by C programs

lib - object files, binaries, libraries

local - put apps you build yourself here

share - shared (Static)

Page 17: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/usr

• What’s the difference between: /usr & /usr/local

Page 18: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/usr/share/man

• Directory for System Manual Pagesman1: User programs Manual pages that describe publicly accessible commands are contained in this chapter. Most program documentation that a user will need to use is located here.

man2: System calls. This section describes all of the system calls (requests for the kernel to perform operations).

man3: Library functions and subroutines. Section 3 describes program library routines that are not direct calls to kernel services. This and section 2 are only really of interest to programmers.

man4: Special files. Section 4 describes the special files, related driver functions, and networking support available in the system. Typically, this includes the device files found in /dev and the kernel interface to networking protocol support.

Page 19: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/usr/share/man

• Directory for System Manual Pagesman5: File formats. The formats for many data files are documented in the section 5. This includes various include files, program output files, and system files.

man6: Games. This chapter documents games, demos, and generally trivial programs. Different people have various notions about how essential this is.

man7: Miscellaneous. Manual pages that are difficult to classify are designated as being section 7. The troff and other text processing macro packages are found here.

man8: System administration. Programs used by system administrators for system operation and maintenance are documented here. Some of these programs are also occasionally useful for normal users.

Page 20: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/usr/share/man

• Manual Section Summary

Page 21: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man apropos

Page 22: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

apropos

Page 23: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

apropos

man6: Games. This chapter documents games, demos, and generally trivial programs. Different people have various notions about how essential this is.

Page 24: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/var

• Variable Hierarchy- Contains variable data files.- Spool files & directories, logging data, temporary files (for

system reboots).- Not Shareable.- e.g. /var/log, /var/mail, /var/cache, /var/crash (dump files)- Can be placed in /usr/var. (If separate partition for /var is

not possible).

Page 25: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/var

• Use the “more” command to view files.- man more for more information- view syslog- view kern.log• Also use the “head” and “tail” command to view files.- man head & tail for more information- know how to head & tail –n lines of a file

Page 26: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

/proc

• Kernel and process information virtual file system- Used for handling process and system information- Kernel and memory information

Page 27: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man ps

Page 28: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

top

Page 29: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

FHS Compliant System

• Rationale:- Not all files can be shared- Static and Variable files should be segregated- Static files can be stored on read-only media- Different backup schedules

Page 30: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man fdisk

Page 31: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

sudo fdisk -l

• Use fdisk to list all partitions (as root)

Page 32: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

fdisk

Page 33: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Typical Partitions

Page 34: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Virtual Terminals (TTY)

• Six tty (1 – 6)- Hold Ctrl + Alt, press F1 (for tty1)- F2 (for tty2) … F6 (for tty6)- Hold Ctrl + Alt, press F7 (to return to GUI)- Press and hold Ctrl + Alt to switch between VM and GUI

Page 35: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

who

Page 36: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

who

Page 37: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

User ($) vs. Root (#)

Page 38: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Shells

• What is an OS shell?• Types

- ksh, tcsh, csh, sh, bash

• What shell are you running?- echo $SHELL

Page 39: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Shells

• csh

Page 40: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man usermod

Page 41: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man ssh

Page 42: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

ssh

Page 43: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Directory Notation

• /- Represents a directory

• /.- Represents current directory

• /..- Represents the parent directory

• /~- Represents a user’s home directory

Page 44: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

File Permissions

Page 45: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

File Permissions

• Octal (numerical) Representation

Page 46: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man chmod

Page 47: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man chown

Page 48: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

man chgrp

Page 49: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

File Permissions Command Summary

Page 50: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Run Levels

• runlevel- Previous runlevel, current runlevel

• init- Change between run levels (process id 1)

• telinit- Change system run level (user process)

Page 51: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

runlevel

Page 52: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

vi (text editor)

Page 53: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Review essential user commands (/bin)

Page 54: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Break

• Let’s take a break… RETURN @ 800PM

Page 55: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Assignment #1

• 30 Questions• Use PrintScreen (PrtSc)• Work in groups (optional)• Submit individual assignments!• Post to OLS. -- use pdf format.• Due before you leave class tonight.

Page 56: POS/420 Philip Robbins – March 19, 2013 (Week 2) University of Phoenix Mililani Campus Introduction to Unix

Quiz: Week 2

• 10-15 minutes