Practice Practice Practice DAT2330 - Ian Allen - Spring 2001 These are the kinds of questions you might be asked on a practice Unix test. This is not the real test. Part A: Unix work. You will need to be running Floppix to do this test. To log in to the Linux Machine, use telnet with your Algonquin userid (abcd0000). Windows telnet will not be permitted during the test. The IP address of the Linux Test Machine is 205.211.32.99 Unless otherwise indicated, input files are on the Linux Test Machine. Unless otherwise indicated, all output files must be placed in your HOME directory on the Linux Test Machine (not on ACADAIX; not on Floppix). Marks will be deducted (up to 100%) for files incorrectly placed and/or incorrectly spelled. Marks: 1 Put the single word "hello" into a (new) file named hello.txt under a (new) directory named "mydir" in your HOME directory. Marks: 1 Place a copy of the file /etc/motd into the file named firewall_motd.txt. Marks: 2 Translate all the blanks in file /etc/motd into dollar signs and put the translated output in file dollar_motd.txt. Marks: 2 Create a directory named mysecret.dir that only has read and execute permissions for you and write permissions for your group. (It should have no other permissions.) Marks: 2 Put this sentence into a file named sentence.txt: It isn't hard to lose a $2 coin. Use any method you know to create this file. Marks: 2 Put a simple list of all the names (just the names; but, including all the hidden names) contained in the /etc/skel directory on the Linux Machine into the file named skel.txt. Marks: 2 Show the permissions, owner, and date modified for all the non-hidden names in the /etc directory that end in the letter b. (Don't show any hidden names.) Put the output in the file named etc_permissions.txt. Marks: 2 Find all the lines in the file /etc/termcap that contain the adjacent digits 123. Put the output in the file 123_termcap.txt. Marks: 3 Place a copy of the file /etc/motd from your Floppix system into the file named floppix_motd.txt in your HOME directory on the Linux Machine. Marks: 3 Create a directory named "super secret" in your HOME directory on the Linux machine. (This directory name contains a blank.) Remove all permissions from the directory. Marks: 3 Create a file named myfile and a directory named "my*" in your HOME directory on the Linux machine. (The directory name contains an asterisk - the name is three characters long.) Marks: 3 File /thome/alleni/tt/saturn1.gz on machine ACADAIX is compressed. Find a way to uncompress and read the contents. Do what the file says. Marks: 4 Create a directory named "foo.dir". Under foo.dir, create directory "bar.dir". Under bar.dir, create a file named "one.txt". Under foo.dir, create a second directory "bleen.dir". Create a second name for the one.txt file under directory bleen.dir. The second name should be "two.txt". Both names should lead to the same data. Create a third name for the file, "three.txt", under the foo.dir directory. All three names should lead to the same data. Marks: 4 Put a reverse-sorted copy of your Floppix file /etc/hosts into the file named floppix_sorted_hosts.txt in your HOME directory on the Linux Machine. Marks: 4 Transfer a copy of the file /etc/motd from the machine acadaix into the file named acadaix_motd.txt in your HOME directory on the Linux Machine with all the asterisk characters changed to dollar signs. ____________________________________________________________ Part B - Multiple Choice What permissions do you need on a file to be able to remove its name from a directory? What permissions do you need on a directory to be able to access the data in a file under the directory? How many hidden directory names are in the /var directory on the Linux Machine? How many hidden directory names are in the /etc directory on ACADAIX? How many hidden directory names are in the /home directory on your Floppix system? How can you increase the link count of a directory that you own? Can you make a hard link to a directory? If file "foo" contains nine lines, each of which is the number of the line in the file, what is the output of this command: sort foo foo | head -4" If file "foo" contains twenty lines, each of which is the number of the line in the file, what is the output of this command (as written): sort foo head If file "foo" contains nine lines, each of which is the number of the line in the file, what is in file foo after this command: head -1 foo >foo If file "foo" contains nine lines, each of which is the number of the line in the file, what is in file foo after this command: ls foo >foo If file "foo" contains nine lines, each of which is the number of the line in the file, what is in file foo after this command: wc foo >foo What is in file "foo" after this command executes? who | echo hi | tee foo >bar If file "foo" contains ten lines, and file "bar" contains twenty lines, then how many lines are in file "bleen" after this command: cat foo bar >bar ; cat foo bar >bleen How do you display names in the current directory that are exactly two digits (not two letters)? How do you remove a name containing a special character from a directory? What permissions on my directory "foo" let me see the names in the directory but do not let me access any of the files?