Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UNIX Ramblings

UNIX Ramblings

AllPlayers.com Eat 'n Geek - UNIX wizardry - Bill Miller

allplayers

July 26, 2012
Tweet

More Decks by allplayers

Other Decks in Technology

Transcript

  1. • GE / Bell Labs / MIT joined together on

    Multics project way back in 1965 (MAC - Multiple Access Computers project) ◦ simultaneous computer access to large community (1st time share) ◦ easy data sharing between users • AT&T/ Bell Labs says enough we are stopping multics project it failed (1969) • Multics later finished in 1972 Very Brief History of Unix...
  2. • Ken Thompson/Dennis Ritchie work on it on their own

    as they needed on OS for a PDP-7 to play space travel game • The result was system which a punning colleague called UNICS (UNiplexed Information and Computing Service) -- an 'emasculated Multics'; soon changed to UNIX Very Brief History of Unix...
  3. • Designed to be small and simple OS • 1st

    written on PDP-7 in 1969, then PDP- 11 on 1970 • 1973, Ritchie and Thompson rewrote kernel in C as 1st portable operating system (hardware independent) UNIX Created
  4. • ATT (BTL) UNIX • BSD UNIX - ATT gave

    source code to universities since not in computer business, and was picked up by Berkley forking to BSD 1977 • SUNos from BSD as well as openbsd, netbsd, next, macos • Xenix - MS's UNIX, later by SCO • ATT goes commercial system V - 1979 • Posix standard to get best of BSD and V • Linux Flavors of *nix
  5. ON being told most of the code being written for

    multics was for error recovery Ritchie -- "We left all that stuff out. If there's an error, we have this routine called panic, and when it is called, the machine crashes, and you holler down the hall, "Hey, reboot it" Error Code.. bah hum bug...
  6. • Ken Thompson - b, fortran,ed, sort,grep, uniq, plot,dd,.. •

    Dennis Ritchie - C, fork-exec,db,ed, fortran • Steve Bourne - bourne shell (sh), adb,.. • Bill Joy - BSD UNIX, vi, csh, and founder of SUN micro, adding TCP/IP to BSD.. • Brian Kernigham - name UNIX, awk, troff, eqn,.. UNIX Hall of Fame
  7. • David Korn - Korn shell,.. • Richard Stallman --

    FSF, emacs, GNU,.. • Brian Fox - bash shell while at FSF, emacs maintainer, GNU tools • Linus Torvalds -- LINUX using GNU tools UNIX Hall of Fame
  8. 2 - Tools/APPS -- commands and programs -- applications, programs

    1 - SHell -- interprets commands, executes programs, and internal commands -- system calls, libraries 0 - Kernel -- schedules tasks and manages storage and devices -- Hardware UNIX NUT
  9. • Multi-user • Multi-tasking • Portable (hardware independent) • Extensible

    (easy to add to scripts, commands, ...) • Robust (rare crashing, permissions, simple filesystem used for files,disks, devices, pipes,...) • Tools (many from the early days to years and years of contributed tools) -- modular The Power of UNIX
  10. • disk's, directory -- all the same to a user,

    and easy to mount a disk anywhere • easy to navigate hierarchical file system and links • file system i/o, is all the same regardless if a file, device, network stream, pipe, stdin (fd = 0) ,stdout (fd = 1) , stderr (fd =2), - , /dev/null ◦ all progs have access to stdin/stdout/stderr The Power of UNIX
  11. • # -- comment • ; -- chain commands •

    \ -- extend a line or quote char • < > -- redirect input , output • << >> -- redirect append input , output | -- pipe output • ` -- run command and place output as .. • " -- quote input as a unit • ' -- quote without variable replace Some special chars
  12. • & -- run command in background • ? ,

    *, [a-z] char matching.. • ~ , users home dir shortcut • cat file >afile 2>&1 (stderr to stdout) ◦ but not cat file 2>&1 >afile • ..... Some special chars
  13. • ^o - flush • ^s - stop • ^q

    - start • ^z- background (&, fg, bg, and %#) • ^c - interrupt • ^u - kill • ^d - end input • ^\ - terminate with core file • ...... Some Terminal Control Chars
  14. • used emacs bindings on linux unless exported env for

    VISUAL or EDITOR • ^a - front of line, ESC-a (sentence) • ^e - end of line, ESC-e (sentence) • ^k - kill line • ^y - yank kill ring • ^p - previous line • ^n - Next line • <tab> completion for files Command line editing
  15. • ^f - foward char , ESC-f (word) • ^b

    - back char , ESC-b (word) • ^s - search forward, ^r search backward • ..... Command line editing
  16. • /tmp • /dev/null • / or /root • /home

    • /usr (/usr/local, /usr/bin, /usr/lib) • /var (/var/log,/var/lib, /var/tmp, /var/run, /var/crash,/var/mail,/var/spool,/var/local) • /opt Common directories
  17. • some shell built-ins, many std, and many add-ons •

    Directory navigation / Files ◦ cd, pwd ◦ pushd, popd ◦ ls ◦ file ◦ strings ◦ which ◦ whereis UNIX tools............
  18. • find • locate • touch • mkfile • sum

    • nl, wc • cat, zcat, od, hd, echo • grep, egrep • more, less, pg • head • tail File & display commands
  19. • man, man -k • clear • stty • script

    • tee • xargs • bc • banner • fortune • spell Various
  20. • sed, ed • awk • cut • sort •

    uniq • tr Manipulate text strings +
  21. • w • who • finger • uptime • uname

    • hostname • last • top • date , cal Host related
  22. • time • watch • sleep • kill, pkill, killall

    • nohup • nice, renice • ps • cron, at Command Control
  23. • lsof • gdb • strace, ptrace, truss • fuser

    • ldd • nm Debugging , monitoring
  24. • ifconfig • netstat • route • tcpdump,snoop • nettop

    • nslookup, dig, • ping, traceroute • iptables, ipchains Network
  25. • df • du • mount • exportfs • fdisk

    • dd • mkfs • tar, dump disk
  26. • su • chmod • chown • chgrp • groups

    • passwd • login • acl Permissions and account