linux un*x overview peter norton’s guide to unix running linux (o’reilly)

16
Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly) www.ssc.com/linux/ligs/node1.html http://www.linuxresources.com/

Upload: cori-watts

Post on 29-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Linux

Un*x Overview

Peter Norton’s Guide to Unix

Running Linux (O’Reilly)

www.ssc.com/linux/ligs/node1.html

http://www.linuxresources.com/

Page 2: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Unix

• from AT&T early 70’s– Multitasking

– Mini & mainframes

– “The One True OS”

• Many Un*x clones– System V, BSD, SCO

• Linus Torvalds– Oct 5, 1991 Linux V0.02

– complete clone (X Windows, TCP/IP, Emacs, UUCP, mail, etc)

• 70-80% WWW servers are Apache => Linux?

Page 3: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Linux

• multitasking, multiuser• mostly compatible with Un*x• File systems: ex2, msdos, nfs• tcp/ip networking, slip, ppp, ftp, etc.• Software: every utility of standard

UNIX• Editors: vi, elvis, GNU Emacs• Up & running - easy• Complete understanding - ?

Page 4: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Basic Concepts

• get a distribution of Linux• install the system

– boot, CD-Rom Hard disk

• Create an Account• Login• Virtual Consoles

– Alt-F1, Alt-F2, etc

• home directory– ~ (tcsh, bash)

Page 5: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Basic Commands

• cd, ls cp, mv, rm• mkdir, rmdir• man• more, cat• grep

• job control– somejob > /dev/null &– jobs– kill 124 or kill %1– Ctrl-C, Ctrl-Z, Ctrl-D– fg %2 bg %1

Page 6: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Shells

• program which reads and executes commands from the user

• Similar to DOS command.com• More powerful * complex• Scripts = shell programming

language• Initialization files (autoexec.bat)

– .bashrc, .cshrc– .emacs, .login

Page 7: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Command Processors

• Bourne shell ($)– sh– I/O redirection, job control

• C-Shell (#)– csh– history, job control , aliasing

• Restricted bourne shell– limited capabilities– Restricted user environment– rsh

• bash, tcsh, Korn

Page 8: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

X-Windows

• standard un*x graphics interface

• developed at MIT (X11R6)

• window managers

• X apps:– xterm (a terminal emulator)

– xdm (X Session Manager)

– xclock (a simple clock display)

– xman (displays man pages)

• hardware and memory req.

• Drivers

Page 9: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Files

• More general use than DOS

• Multiple users => protection

• inode # - real file id

• DOS files - ordinary UNIX files

• DOS device - UNIX special file

• One large directory structure

• links allow single file multiple names– hard links directly link to an inode– symbolic links different inode #

Page 10: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Access control

• Type of file

• Owner– rwx (4 2 1)

• Group– rwx

• Other– rwx

• Examplesdrwxr-xr-x (755)

-rw-r--r-- (644)

Page 11: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Mounting Directories

• mount -t type device mnt-point

• mount -t msdos /dev/fd0 /flpy-a

• Automatic mounting– /etc/fstab– device dir type options– /dev/sda1 /sam msdos default– /dev/sdc1 /laura msdos default– /dev/hda1 none swap sw– /dev/cdrom /sys_cd iso9660 ro

Page 12: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Example Directory structure

• /bin - executables

• /dev - device files

• /etc - shell scripts, data files

• /lib - standard program files

• /lost+found

• /tmp - storage

• /usr– home– src– spool

Page 13: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Pipes

• stdin, stdout

• ls -l

• Lots small solutions together

• ls - l | page (one page of files)• cat old new extra | grep Austin | sort | more• cat old new extra | grep Austin | sort | tee A.list | more

Page 14: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Customizing your Environment

• Shell scripts– Ex script file called make6337:

• #!/bin/sh• cat hw1.cpp hw2.cpp hw3.cpp > 6337.txt

• wc -l 6337,txt• lp 6337.txt

– chmod u+x make6337

• Login vs other scripts

• bash scripts:– /etc/profile (sysadm at login)

– $HOME/.bash_profile (user at login)

– $HOME/.bashrc (non-login)

Page 15: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Users & Groups

• /etc/passwd– username - unique user name

– user ID - unique user number

– group ID

– password

– full name

– home directory

– login shell • username:encryptedpassword:UID:GID

:full name:home directory:login shell

• drj2:Xv8Q981g71oKK:102:100:John Durrett:/home/drj2:/bin/bash

Page 16: Linux Un*x Overview Peter Norton’s Guide to Unix Running Linux (O’Reilly)

Archiving and Compressing Files

• tar cvf bkup.tar /etc• tar xvf bkup.tar• gzip -9 bkup.tar

• gzip -d or gunzip bkup.tar.gz• tar cvf - /etc gzip -9c > bkup.tar.gz

• tar cvfz backup.tar.gz /etc