1 / 21
Lecture 01: welcome and intro what LSD and Unix have in common - - PowerPoint PPT Presentation
Lecture 01: welcome and intro what LSD and Unix have in common - - PowerPoint PPT Presentation
Lecture 01: welcome and intro what LSD and Unix have in common Hands-On Unix System Administration DeCal 2012-08-27 1 / 21 The connection Two of the most The connection Introduction famous products of Diving into the shell
The connection
❖ The connection Introduction Diving into the shell Text editing 2 / 21
“Two of the most famous products of Berkeley are LSD and
- Unix. I don’t think that
this is a coincidence.”
(from The Unix-Haters Handbook)
Introduction
❖ The connection Introduction ❖ What is this? ❖ Who are we? ❖ What is Unix? ❖ What is sysadmining? ❖ Logistics Diving into the shell Text editing 3 / 21
What is this?
❖ The connection Introduction ❖ What is this? ❖ Who are we? ❖ What is Unix? ❖ What is sysadmining? ❖ Logistics Diving into the shell Text editing 4 / 21
- CS 98/198-8, the Hands-on Unix
system administration DeCal
- decal.ocf.berkeley.edu
- Don’t be shy. Ask questions in class or
- n Piazza.
Who are we?
❖ The connection Introduction ❖ What is this? ❖ Who are we? ❖ What is Unix? ❖ What is sysadmining? ❖ Logistics Diving into the shell Text editing 5 / 21
- Dara Adib: 3rd-year CivE; OCF general
manager, Kloudless DevOps
- Felix Wong: 4th-year EECS; OCF site
manager, ResComp sysadmin
- Jessica Yu: 3rd-year CS; ResComp
sysadmin
What is Unix?
❖ The connection Introduction ❖ What is this? ❖ Who are we? ❖ What is Unix? ❖ What is sysadmining? ❖ Logistics Diving into the shell Text editing 6 / 21
System III & V family
BSD (Berkeley Software Distribution) FreeBSD NetBSD OpenBSD SunOS Solaris NextStep MacOS X Xenix OS GNU Project GNU/Linux Commercial UNIX HP-UX AIX UnixWare IRIX
BSD family
1970 1980 1990 2000
Time
Microsoft/SCO Richard Stallman Darwin GNU/Hurd K16 Linus Torvalds Andrew S. Tanenbaum Minix 7.2 5.0 4.5 10 5/09 5.7 3.3 2.6.30.1 3.1.3a 11i v3 6.1 7.1.4 MP4 6.5.30 4.1.3 Research UNIX 10 Bell Labs: Ken Thompson, Dennis Ritchie, et al. Bill Joy Sun Microsystems AT&T IBM SGI Univel/SCO Apple Computer
https://en.wikipedia.org/wiki/File:Unix_history.svg
What is sysadmining?
❖ The connection Introduction ❖ What is this? ❖ Who are we? ❖ What is Unix? ❖ What is sysadmining? ❖ Logistics Diving into the shell Text editing 7 / 21
http://xkcd.com/705/
Logistics
❖ The connection Introduction ❖ What is this? ❖ Who are we? ❖ What is Unix? ❖ What is sysadmining? ❖ Logistics Diving into the shell Text editing 8 / 21
- lecture-lab format: lab due at start of
next week’s class
✦ lab = homework
- grading: attendance, labs, final project
- bring laptop if possible
Diving into the shell
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 9 / 21
The shell
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 10 / 21
- an ordinary program (e.g., bash) that
lets you access the system
✦ text-based
- edit files, run other programs, etc.
- can be automated with shell scripting
In a nutshell
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 11 / 21
- there’s a prompt
- type something
- read output
- repeat
Common shells
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 12 / 21
- sh/bash
- csh/tcsh
- zsh
- fish
Basic programs
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 13 / 21
- pwd: print working directory
- ls: list file
- cd: change working directory
- mkdir: make directory
- rmdir: remove empty directory
Basic programs
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 14 / 21
- touch: create/access file
- mv: move file
- cp: copy file
- rm: remove file
Basic programs
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 15 / 21
- echo: print text
- cat: print file
- less (more): scroll (“page”) through
file
- grep: search file for specified pattern
Saving keystrokes
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 16 / 21
- command history
- tab-completion
RTFM
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 17 / 21
- programs have command line options.
✦ e.g., ls -l
- programs are (usually) documented
✦ e.g., man ls, ls --help
- search manpages with apropos (or
Google)
Unix paradox
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 18 / 21
Good Unix programs are
- simple
- do one thing well
“cat came back from Berkeley waving flags” (Rob Pike [Unix minimalist])
ls -l
❖ The connection Introduction Diving into the shell ❖ The shell ❖ In a nutshell ❖ Common shells ❖ Basic programs ❖ Basic programs ❖ Basic programs ❖ Saving keystrokes ❖ RTFM ❖ Unix paradox ❖ ls -l Text editing 19 / 21
- filenames preceded with a dot are
hidden by default
✦ e.g., .bashrc
- special directories
✦ . (one dot): current directory ✦ .. (two dots): parent directory
Text editing
❖ The connection Introduction Diving into the shell Text editing ❖ vi(m) 20 / 21
vi(m)
❖ The connection Introduction Diving into the shell Text editing ❖ vi(m) 21 / 21
“I was trying to make it usable over a 300 baud modem” (Bill Joy [Berkeley graduate student])
- modal text editor: normal mode, insert
mode
- vimtutor