COP3353 - 2017 Summer
Assignment 2
Due by 11:59pm Wednesday, June 21 2017

Working with files and directories

Step 0

Login to cop3353.org with the username COP3353_fsuid@cop3353.org (where "fsuid" is your fsuid) with your ssh key that you created for assignment 1. For instance, if you accepted the default filename and location, and your "fsuid" was "fsu99c", then you would login as

$ ssh COP3353_fsu99c@cop3353.org

Welcome to COP3353.org!

COP3353_fsu99c@cop3353:~$ 

If you used another filename, say ".ssh/id_rsa-3353", then you will need to use the "-i" option:

$ ssh -i .ssh/id_rsa-3353 COP3353_fsu99c@cop3353.org

Welcome to COP3353.org!

COP3353_fsu99c@cop3353:~$ 

Step 1

First, use the rm program to remove the file "unnecessary.stuff" that's in your home directory.

Step 2

Next, create a directory called nonce/ in your home directory with the mkdir program:

COP3353_fsu99c@localhost:~$ mkdir -v nonce
mkdir: created directory 'nonce'
COP3353_fsu99c@localhost:~$ ls -ldi nonce
127759 drwxr-xr-x 2 COP3353_fsu99c COP3353_fsu99c 4096 Jun 14 16:33 nonce
COP3353_fsu99c@localhost:~$ 

Inside of the directory nonce/, create three subdirectories: alpha/, beta/, and gamma/. Copy the file /etc/motd to nonce/alpha/, and copy the file /etc/hosts to nonce/beta/:

Now retrieve the file at http://www.cs.fsu.edu/~langley/newfile.txt with wget, and move it to nonce/gamma/:

Edit the file nonce/gamma/newfile.txt with any editor that you like, replacing the "----" with appropriate answers:

Now run the program "cat", redirecting its output so that it reads /proc/self/maps and writes to nonce/alpha/self-maps:

COP3353_fsu99c@localhost:~$ cat /proc/self/maps > nonce/alpha/self-maps
COP3353_fsu99c@localhost:~$ cat nonce/alpha/self-maps
00400000-0040c000 r-xp 00000000 08:00 65                                 /bin/cat
0060b000-0060c000 r--p 0000b000 08:00 65                                 /bin/cat
0060c000-0060d000 rw-p 0000c000 08:00 65                                 /bin/cat
00e53000-00e74000 rw-p 00000000 00:00 0                                  [heap]
7fe15df38000-7fe15e0d9000 r-xp 00000000 08:00 37626                      /lib/x86_64-linux-gnu/libc-2.19.so
7fe15e0d9000-7fe15e2d9000 ---p 001a1000 08:00 37626                      /lib/x86_64-linux-gnu/libc-2.19.so
7fe15e2d9000-7fe15e2dd000 r--p 001a1000 08:00 37626                      /lib/x86_64-linux-gnu/libc-2.19.so
7fe15e2dd000-7fe15e2df000 rw-p 001a5000 08:00 37626                      /lib/x86_64-linux-gnu/libc-2.19.so
7fe15e2df000-7fe15e2e3000 rw-p 00000000 00:00 0 
7fe15e2e3000-7fe15e303000 r-xp 00000000 08:00 37623                      /lib/x86_64-linux-gnu/ld-2.19.so
7fe15e34e000-7fe15e370000 rw-p 00000000 00:00 0 
7fe15e370000-7fe15e4f9000 r--p 00000000 08:00 20451                      /usr/lib/locale/locale-archive
7fe15e4f9000-7fe15e4fc000 rw-p 00000000 00:00 0 
7fe15e501000-7fe15e503000 rw-p 00000000 00:00 0 
7fe15e503000-7fe15e504000 r--p 00020000 08:00 37623                      /lib/x86_64-linux-gnu/ld-2.19.so
7fe15e504000-7fe15e505000 rw-p 00021000 08:00 37623                      /lib/x86_64-linux-gnu/ld-2.19.so
7fe15e505000-7fe15e506000 rw-p 00000000 00:00 0 
7fff0e302000-7fff0e323000 rw-p 00000000 00:00 0                          [stack]
7fff0e399000-7fff0e39b000 r--p 00000000 00:00 0                          [vvar]
7fff0e39b000-7fff0e39d000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
COP3353_fsu99c@localhost:~$ 

When you do ls -laR ~/nonce, it should look something like:

Step 3

Create a shell variable called x with the value of running uuidgen like so:

Create a tar file, named with the result of the uuidgen program:

COP3353_test@cop3353:~$ tar cvf ${x}.tar nonce
nonce/
nonce/gamma/
nonce/gamma/newfile.txt
nonce/alpha
nonce/alpha/motd
nonce/alpha/self-maps
nonce/beta/
nonce/beta/hosts

(If you have already submitted based on the original version which erroneously had "nonce.tar" rather than $x, that's not a problem.)

Check the contents of the file with:

COP3353_test@cop3353:~$ tar tvf ${x}.tar
drwxr-xr-x COP3353_test/COP3353_test 0 2017-06-14 16:58 nonce/
drwxr-xr-x COP3353_test/COP3353_test 0 2017-06-14 17:04 nonce/gamma/
-rw-r--r-- COP3353_test/COP3353_test 105 2017-06-14 17:04 nonce/gamma/newfile.txt
drwxr-xr-x COP3353_test/COP3353_test   0 2017-06-14 17:05 nonce/alpha/
-rw-r--r-- COP3353_test/COP3353_test  27 2017-06-14 16:58 nonce/alpha/motd/
-rw-r--r-- COP3353_test/COP3353_test 1750 2017-06-14 17:05 nonce/alpha/self-maps
drwxr-xr-x COP3353_test/COP3353_test    0 2017-06-14 16:58 nonce/beta
-rw-r--r-- COP3353_test/COP3353_test  186 2017-06-14 16:58 nonce/beta

Step 4

Submit the tar file on Blackboard before 11:59pm on Wednesday, June 21. Also, the grader will visit your home directory to verify its contents, and to make sure that you deleted the file ~/unnecessary.stuff.