Web осень 2013 лекция 2

Embed Size (px)

Text of Web осень 2013 лекция 2

  • 1. linux

2. Ubuntu2 3. Ubuntu 1. (Unetbootin) http://unetbootin.sourceforge.net/ 2. VirtualBox ( 20Gb) 3. Ubuntu (12.04 LTS) http://pingvinus.ru/note/ubuntu-install4. VirtualBox extension pack 5. VirtualBox, 3 4. / Ctrl + Alt + t exit Ctrl + D () Ctrl + Alt + F1 .. F3 Alt + F74 5. Alt + b / Alt + f / Ctrl + w / Alt + d / Ctrl + u / Ctrl + k / Ctrl + p / Ctrl + n / Ctrl + r blabla (!!!)5 6. / X-windows src: dst: , src: Ctrl + Ins dst: Shft + Ins Ctrl + c / Ctrl + v 6 7. Linux7 8. , . : (), . /: stdin, stdout, stderr () pid , ppid 8 9. Python import sys import os print "argv: " + " ".join(sys.argv) print "env: " + " ".join(os.environ.keys()) word = sys.stdin.read(3) sys.stdout.write(word + "n") sys.stderr.write("bug!n")print "pid: " + str(os.getpid()) print "ppid: " + str(os.getppid()) exit(1) 9 10. 10 11. ? ? ? argv: os.argv, @ARG, char* argv[] .. :h () f () v ( ) 11 12. ? ? / ? env: os.environ, %ENV, char** environ .. ? , .. . 12 13. PATH , USER HOME TERM ( , ) PYTHON_PATH python , python 13 14. 14 15. ? 2 fork() exec() fork() exec() : 15 16. ?16 17. unix17 18. 18 19. . ? - (SIGKILL) 19 20. import time while True: print "Zzz-zzz-zzz..." time.sleep(1) ? Ctrl + c INT HUP : kill INT 12345 , 12345 pid kill KILL 12345 20 21. SIGALRM SIGHUP SIGTERM SIGSEGV SIGKILL SIGPIPE / SIGCHILD SIGUSR1, SIGUSR2 21 22. 22 23. SHELL (bash) SHELL , , .bash stdin . stdin , stdout/stderr . 23 24. SHELL ( telnet ssh) stdin/stdout/stderr , bash . 24 25. 25 26. 26 27. $PATH. + export , . $?27 28. exit man program ls cd pwd ? cat filename stdout rm cp mv 28 29. find locate / updatedb grep stdin , sort stdin wc , , xargs stdin29 30. / stdin / stdout / stderr . stdout stdin stderr . stdout results.txt, stderr - 30 31. PIPE: PIPE bash stdout c stdin , 31 32. PIPE: add_product, c .py , /admin/ ip , web 32 33. IF , 0 ( ), [ - test 33 34. seq 1 1034 35. Linux35 36. # # # # # # # # # # , pid- .. 36 37. ? 37 38. 38 39. , smal@corp.mail.ru