It is likely worthwhile going through the assignment twice. The first time work out what to do at each step. You can use all the resources at your disposal, including lectures and demos, man files, and Google. Remember that you can also use the history command to look at all the commands you have executed - this may help you review your work in preparation for a second run-through that you record for submission.

Commands

  1. Change into your ~/cse374 directory.

  2. Make a new directory called hw1

  3. Change directories to that directory

  4. Enter script hw1.script to start recording a transcript of your work.

  5. Display your current working directory

  6. Run a command to print "Bash is fun" to the screen.

  7. Run the above command and redirect the output to a file called now.

  8. Run a command to print the current date and time and append the output to now.

  9. Run a command to print the kernel release and append it to now.

  10. Your now file should have three lines in it. Use the wc command to display the number of lines (and only the number of lines) in the file.

  11. Show the contents of the now file

    • There are many commands to do this. The commands have subtle differences.
    • The autograder will recognize a few straightforward, but probably not all, options.
  12. Copy the now file to a file called pastnow.

  13. Go to your home directory, and then enter a command to locate the pastnow file in your folders.

    • There are a number of ways to find or locate a file on a Linux system, and more than one way to solve this problem. Remember you can use man -k to figure out the name of a command you don’t yet know.
    • These methods have some differences and are not entirely interchangeable. It is worth understanding the differences.
    • The autograder will accept a few, but probably not all, solutions.
  14. Move to the directory with now in it.

  15. List the contents of that directory. Use the option that shows the additional details (permissions, date edited, etc.) about each file.

  16. Enter a command to reset the permissions for the now file to read, write & execute for the user, and read & execute only for the group and read only for others. You should do this in one step.

  17. Use the same command from step 15 to show whether you got it right.

  18. Return to your home directory.

  19. Define an alias that allows you to type ll and execute the command you used in step 15

  20. Demonstrate your new alias by entering ll.

  21. Enter vim to start vim.

  22. Use ctrl-z to suspend vim.

  23. Bring vim back to the foreground. Then ctrl-z again.

  24. Enter a command to list all the processes belonging to your user.

  25. Since this might be a lot of processes, re-enter the command and pipe the output through grep to find the phrase “vim”

  26. Terminate this process by using a command at your bash prompt.

    • You will need to send a signal -9, or otherwise specify ‘kill’ the process.
  27. And last but not least, use echo, and the existing environment variable USER to print [user] is great, with you as the user, to the screen.

    • Note: Your environment variable may be USERNAME instead of USER - use the applicable one
    • Hint: You can see all the current environment variables by entering printenv, or the value in one variable by entering echo "$VARNAME"
    • My screen says: dy2018 is great
  28. Enter exit to stop recording your script.