Main Course Webpage

In-Class Lab 1: Submitting a Script Session

Objective: Start a Script Session and Submit on Canvas

Login to hills and start a script session. Practice using comments

Comment the beginning of your code according to the homework submission guidelines

Perform the following basic commands

  1. ssh to hills from either your laptop or from one of our linux PCs
  2. Type in and execute the following command exactly:
    cp -r /pub/cs/grwoo/cs160a/Lab1 ~
              

Start your script session using date, pwd and whoami. Be sure to give your script output a meaningful name other than typescript

  1. cd to the new directory Lab1. List it with the -l (lower-case L) option
  2. display the contents of the file README
  3. copy the file README to README1
  4. rename the file wrong to right
  5. find out what kind of file xyz is
  6. list the current directory again with the -l option
  7. list the current directory again with both the -l and -a options. Can you explain the difference?
  8. remove the empty directory dir1
  9. remove the file xyz

Type exit to exit your script session.

Sample Output

Sample Output for Lab 1 may look like:

[grwoo@hills Lab1]$ cat typescript_lab01
Script started on Mon 15 Jan 2018 11:48:26 PM PST
[grwoo@hills Lab1]$ ls -l
total 24
drwx------ 2 grwoo csdept     6 Jan 15 23:24 dir1
-rw------- 1 grwoo csdept   238 Jan 15 23:24 README
-rw------- 1 grwoo csdept     0 Jan 15 23:48 typescript_lab01
-rw------- 1 grwoo csdept    52 Jan 15 23:24 wrong
-rw------- 1 grwoo csdept 15211 Jan 15 23:24 xyz
[grwoo@hills Lab1]$ cat README
This README file is for the Lab1 directory.
This directory contains several practice files for the
first lab in cs160a:
README	this file
xyz	a document
wrong	a dummy file with the wrong name
dir1	an empty directory
.hidden a hidden file
[grwoo@hills Lab1]$ cp README README1
[grwoo@hills Lab1]$ mv wrong right
[grwoo@hills Lab1]$ file xyz
xyz: PDF document, version 1.4
[grwoo@hills Lab1]$ ls -l
total 28
drwx------ 2 grwoo csdept     6 Jan 15 23:24 dir1
-rw------- 1 grwoo csdept   238 Jan 15 23:24 README
-rw------- 1 grwoo csdept   238 Jan 15 23:48 README1
-rw------- 1 grwoo csdept    52 Jan 15 23:24 right
-rw------- 1 grwoo csdept     0 Jan 15 23:48 typescript_lab01
-rw------- 1 grwoo csdept 15211 Jan 15 23:24 xyz
[grwoo@hills Lab1]$ ls -a
.  ..  dir1  .hidden  README  README1  right  typescript_lab01  xyz
[grwoo@hills Lab1]$ rm -rf dir1
[grwoo@hills Lab1]$ rm xyz
[grwoo@hills Lab1]$ exit
exit
      

Submitting Your Homework Assignment

Transfer your output script session as an attachment on Canvas

If you find something particularly interesting, please include that in your homework submission as a comment. I may ask you to share your insights at the beginning of class for participation points.