CSE 374 22sp Homework 0

Due: Thursday, March 28, 2022, at 11 pm (you really really don't want to burn up late days on this one!).

The purpose of this assignment is to be sure that you have your Linux environment set up for the quarter and that you can log in and execute shell commands. For this assignment you must use either your account on the cancun.cs.washington.edu machine or your own copy of the CSE Linux Virtual Machine. It is possible to use another reasonably recent Linux system for many things, but we will use the CSE systems to evaluate submitted work, and you need to verify that everything you submit works correctly there. See the Linux Resources page on the course web site resources tab for more information about how to get started.

  1. (Shell) You must be sure that your default shell is bash. Otherwise you will run into strange, baffling problems with shell scripts. Enter the command echo $SHELL. The response should be /bin/bash. If the shell name is different (csh, tcsh, or something else), use the appropriate commands on your system to change your login shell to bash. On many Linux and Unix systems this can be done with the command chsh or ypchsh.

  2. (gcc) You need to be sure that you are running the correct version 9 of gcc. Open a shell window and type the following command:
    touch ~/.gcc9
    That creates an empty file named .gcc9 in your home directory, which Rocky Linux uses to select the proper version of gcc when you open a terminal window. Close the terminal window and then open a new one. Type the command
    gcc --version
    The message that is printed should show version 9 of gcc. If you still see version 8, you should log out and back in, which should reinitialize things properly.

  3. (Commands) Open a shell window and enter the following commands. They should work without errors if typed exactly as shown. The script command will capture the terminal session and save it in a file named hw0.script in the current directory which should be your home directory if these commands are executed properly.
       cd 
       script hw0.script
       whoami
       echo $SHELL
       pwd
       uname -a
       cat /etc/rocky-release
       gcc --version -std=c17
       exit
    Notes: if the gcc command generates a warning that -std=c17 is not a recognized option, your C compiler and, probably, your Linux version are too old, and you should use the current UW CSE Linux system for this class.

    The cat /etc/rocky-release command should print a message that begins with Rocky Linux release 8.5... . If it does not, or if you get a message that the file is not found, you are not using a properly configured UW CSE Linux machine, and you should repeat the assignment once you fix that.

Assessment: Your solution will be evaluated on how well it follows the instructions and produces the desired results. Note: the script command captures everything, including backspaces and other corrections as you are typing input. It's fine if there is some of this in the submitted file, but if there is too much clutter or too many mistakes, it would be best to start over and get a reasonably clean hw0.script file to turn in.

Turn-in Instructions: Use gradescope, linked on the course resources web page, to turn in the hw0.script file created in problem 2. Gradescope will allow you to turn in your homework up to two days late, if you choose to use one or two of your late days, but you are strongly advised to save your late days for much later in the quarter when you may really want them.

If you create the hw0.script file on cancun, you can use scp (winscp on windows) to transfer the file to your local machine so it can be submitted using your local web browser. If you are using the UW CSE Linux virtual machine, use the "file cabinet" (files) program to open a window showing your home directory. The hw0.script file should be located there, and you can use a web browser on the VM, probably Firefox, to upload the file to gradescope.