CSE 490c/303 Homework 0

Due: Friday 10/1/04

This assignment is designed to provide enough experience using a Unix shell to make progress on the next assignment.

Preamble

All material in this course will assume the bash shell. This seems to be the default on a cygwin install. It does not seem to be the default on the instructional Linux boxes.

To determine your default shell:

$ grep yourloginname /etc/passwd
The shell will be at the end of the line of nonsense (e.g., /bin/bash). If it is not the bash shell:
  1. Type which bash to find the absolute path name of the bash shell.
  2. Use the chsh command to change your login shell to bash.
  3. Because it takes a while for that to take effect, invoke bash explicitly typing its full path name as a command (e.g., /bin/bash).

Exercises

Do this, but don't hand anything in about it. Listed below are a set of commands to execute. Type them, see what happens, and try to make sure you understand what they do. (Some additional commands/reading may be required for that.)

You can do this on any Unix machine, or with cygwin (unless you've failed to install something needed).

If you see the following notation: Ctrl+X;  on a line, hold down the control key and press the letter specified.  Ctrl+X, for example, specifies the cut operation in Windows.  Don't hold down the shift key to make the letter uppercase. 

  1. man
  2. man man
        No need to read this page in detail at this point.

  3. man less
        man uses less to display pages.

  4. less /usr/include/stdio.h
        Now find the defintion of "putc".
  5. cat /usr/include/stdio.h
  6. cat /usr/include/stdio.h | less

  7. pwd
  8. ls
  9. ls -al
  10. mkdir HW0
  11. cd hw0
  12. cd HW0
  13. pwd
  14. ls -al
  15. ls -al ..
  16. cp /usr/include/stdio.h testfile
  17. ls -al; ls -l
  18. mv testfile test
  19. ls -l test
  20. ls -l te[now hit a tab]
  21. cp test test2
  22. ls -l te[now hit 3 tabs]
  23. rm test2; ls
  24. pushd /etc
  25. pwd
  26. popd; pwd
  27. ls ~
  28. cd ..
  29. mkdir HW0prime
  30. cd HW0prime
  31. ln -s ~/HW0/test linkedTest
  32. less linkedTest
  33. ls -l
  34. rm ../HW0/test
  35. less linkedTest
  36. ls -l
  37. rm linkedTest

  38. ls >files
  39. less files
  40. ls >files
  41. less files
  42. ls >>files
  43. less files
  44. cat files > /dev/null
  45. cat files >> files
  46. cat files >> files2
  47. cat files >> files2
  48. cat files2

  49. cd ../HW0
  50. history
  51. man history
         [read description]
  52. cp /usr/include/stdio.h testfile
  53. ls
  54. rm testfile
  55. [up arrow 3 times]
  56. [up arrow twice]
  57. !cp
  58. ls
  59. !!
  60. Ctrl+Rrm
  61. Ctrl+Rcp
  62. ^testfile^copyfile
  63. ls
  64. Ctrl+P
  65. rm testfileCtrl+Urm copyfile 

  66. man grep
  67. grep putc testfile
  68. grep -w putc testfile
  69. wc testfile
  70. grep -w putc testfile | wc

  71. sleep 1
  72. sleep 20[hit enter, then Ctrl+C]
  73. sleep 240 &
  74. jobs
  75. kill %1
  76. jobs
  77. sleep 240 [hit enter, then Ctrl+Z]
  78. jobs
  79. bg
  80. jobs
  81. fg [hit enter, then Ctrl+C]
  82. jobs