linux un*x overview peter norton’s guide to unix running linux (o’reilly)
TRANSCRIPT
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/
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?
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 - ?
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)
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
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
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
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
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 #
Access control
• Type of file
• Owner– rwx (4 2 1)
• Group– rwx
• Other– rwx
• Examplesdrwxr-xr-x (755)
-rw-r--r-- (644)
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
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
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
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)
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
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