-------------------------------------------------------------- DAT2330 - Floppix Lab Test - 25 marks total - 15% of term mark -------------------------------------------------------------- Section 020 - Ian D. Allen - idallen@ncf.ca - February 16, 2000 A. Boot Floppix with DHCP-style networking enabled (select 3.) Mail will not be needed - select "1. - Practice Only". Printers are not needed - just push ENTER to skip over printers. Log in to Floppix as you. B. Download this template.txt file from this location: $ ftp 205.211.47.90 Name: guest Password: (ask your professor for the password) ftp> get template.txt ...messages print here... ftp> quit If you have problems, call over your instructor. C. Make a copy of the template.txt file. The new file name is to be the word "answers" followed by your student number followed by five randomly chosen letters (your choice), e.g. the new file name will look something like this: $ cp template.txt answers040837625wugga The word "answers" is first. The number is your student number. You choose any five letters. Make the copy now. I will refer to this new copy as the "Answers File". D. Edit the Answers File (*not* the template file) and add your Name and Student number where indicated near the top of the file. ------------------------------------------------------------------------ Answer the following questions by editing your answers into the Answers File (*not* into the template file). Edit the Answers File only: 1. (1 mark) Name a hidden file in your home directory that contains the letter "x". 2. (2 marks) How many names (including hidden names) are in the /etc directory? Use a Unix command line to count the names. 3. (2 marks) Give the name and contents of the environment variable that contains your home directory. 4. (2 marks) Give the name and contents of the environment variable that the shell uses to know where to find command names that you type in. 5. (2 marks) Give the name and contents of the environment variable that contains the type of terminal you are using when logged in. 6. (4 marks) Use a Unix command to create a copy of the "readme" file in your home directory, with all the characters changed to UPPER-CASE. a) Enter the Unix command line you used into the Answers File. b) Use the ":r filename" command in VI to read in the upper-case file into the given place in your Answer File as the answer to question 6. c) Delete *all* the blank lines in the text you just read in. (You will have exactly 10 non-blank lines left.) ... CONTINUED ON NEXT PAGE ... 7. (5 marks) Create the following directory structure in your home directory: a/b/c That's a pathname consisting of three directories, each inside the other. a) Remove "r" permissions for "group" from directory "b". b) Remove "x" permissions for "other" from directory "c". c) In the bottom directory ("c"), create a file named "second" with only the second line of the Unix password file in it (no blank lines allowed). The file must have exactly one line in it. Use this exact version of the "ls" command to recursively list the top directory you created (named "a") into a file: $ cd $ ls -lR a >out NOTE: The resulting output file should have 10 lines in it. d) Use the ":r filename" command in VI to read in the "out" file into the given place in your Answer File as the answer to Question 7. 8. (4 marks) The Unix "grep" command can be used with a pattern to select matching or non-matching lines from a file (or from standard input). What command line would select non-matching lines? Create a file that contains all the lines from file /etc/login.defs that do *not* contain a number sign (#). (Warning: # is a shell special character.) Give a count of lines, words, and characters in the file you just created. (Note: the number of lines will be less than 50.) 9. (3 marks) Find the directory containing the "man" command executable file. What directory is it? Give the inode number of this directory, and the permissions of the directory as an octal number. ------------------------------------------------------------------------ E. Use ftp to upload your Answers File to this IP address: $ ftp 205.211.47.90 Name: guest Password: (ask your professor for the password) ftp> put answers040837625wugga ftp> quit Note the number of bytes you uploaded. (It shouldn't be zero!) The number of bytes uploaded should match the size of the file. You're done.