Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Course Topics &

Intro to Unix
Advanced section #1
2018-02-01 Thurs
Loren McIntyre
decal.ocf.berkeley.edu/slides/a1
Engaging with this lecture
- Follow slides online: ocf.io/decal/slides/a1
- Connect to login server: (ssh or in-browser)
- tsunami.ocf.berkeley.edu, or
- just tsunami, on OCF network
- Ask questions online (or by raising hand)
Overview

- Topics, themes, & background 50m


- Shell 10m
- Philosophy 20m
- Unix
- Free, Libre
- Linux 5m
- History 15m
- Lab (& feedback)
- Attendance
Shell commands
- try them!

ls, cd, grep, cat, less, nano, vim, emacs, curl, wget, tar,
gzip, gunzip

man, man -k / apropos, type, which, help

Aliases, functions, variables, builtins

PATH
Shell patterns

Patterns to play with

- Pipes: | grep / less / sed / awk


- Redirecting...output >, >> ...input < ...error 2>, &>
- Pipemill: | while read VAR; do cmd $VAR | cmd; done | cmd
Levels of Shell
- Level 0: type things, get results
- Level 1: execute programs by name & shell
builtin-functions, “shell” collects and shows you results
- Programs by name
- echo ls cat grep
- Built-ins
- Echo
- Level 2: run interactive programs
- ncurses library
- e.g. nano, vim, emacs, irssi, weechat, ncdu, joplin
Shell
Philosophy - Unix
The Art of Unix Programming (TAOUP), written in 1999-2003.

- Notes on how and why of well-designed Unix application


- Text-interfaces
- Universal API
- "the case against learning unix culture" http://www.catb.org/esr/writings/taoup/html/ch01s03.html
- "attitude matters too" http://www.catb.org/esr/writings/taoup/html/ch01s09.html
- “To do the Unix philosophy right, you need to have (or recover) that attitude. You need to care. You need to
play. You need to be willing to explore.”
- "Culture? What culture?" http://www.catb.org/esr/writings/taoup/html/ch01s01.html
- etc... Senior engineers develop huge bodies of implicit knowledge, which they pass to their juniors by (as Zen
Buddhists put it) “a special transmission, outside the scriptures”.
- "unix philosophy in one lesson" http://www.catb.org/esr/writings/taoup/html/ch01s07.html
- find a section
- http://www.catb.org/esr/writings/taoup/html/index.html
- regex example
Philosophy - Free, Libre
- Closed | Public domain | Open-source | Copyleft
- Copyright
- Determine what others may do with your code
- Nothing / only if they license
- Anything, including using any license for their derivative work
- Use, modify
- Use and modify IFF you redistribute it with same license (“viral”)
- Reference
- tldrLegal.com
- chooseALicense.com
- creativeCommons.org/choose
Open Source Software (OSS)

Free and Open Source Software (FOSS) or Free/Libre Open Source Software
(F/LOSS)

From gnu.org: “free software” refers to freedom and not to price.

“Free as in beer, and free as in freedom”

Open source software - term used by some software and technology


companies. You may not have the right to use, modify, or redistribute the
software or source code.

TAOUP excerpt on license picking


Philosophy
Deep reading

- Coding Horror’s License Woes


- “In the Beginning was the Command Line” - Neal Stephenson
- The Art of Unix Programming (TAOUP) - Eric Raymond (esr)
- Recommend skimming as you recognize words / have interest
- Free Software Foundation
- Enforcement of GPL, Copyleft licenses.
- Homesteading the Noosphere
- Free software projects. Social dynamics of project forks.
- Cathedral & Bazaar
Linux’s advantages over non-Unix
systems
Built to be extensible, introspectable: procfs, strace, dbus

Sockets for networking, now copied beyond Unix systems, e.g.


WinSock

"It's very simple — you read the protocol and write the code." -- Bill
Joy on implementing TCP/IP

UNIX idea: “everything is a file”

Worse is better.
History

Decades of software development and businesses


go out of business. Code you can learn at one job,
use at another.

Berkeley connection

GNU / software freedom

Now. The world runs on free-software. Companies


actively support free software projects
Other books, resources

- ArchWiki
- The Linux Documentation Project tldp.org
guides: Bash scripting, System Administration
- Debian System Administrator’s Handbook
- How to ask good questions
- https://jvns.ca/blog/good-questions/
- https://stackoverflow.com/help/how-to-ask
- http://www.catb.org/esr/faqs/smart-questions.html
Lab (+ feedback) & Attendance

Lab at [todo]

Attendance at ocf.io/decal/signin or
https://goo.gl/3Lf9kh

Magic word: Cerf


decal.ocf.berkeley.edu/signin

ocf.io/decal/signin

Or https://goo.gl/3Lf9kh

[magic word]
Challenge

Make a random password generator. Numbers.


Words.

You might also like