Unix Test Two Answer Sheet

Part A: Unix work

You will need to be running Floppix with networking to do some of this test. You must have network access to use telnet and ftp to reach the machines mentioned in this test.

The IP address of the Test Machine is 205.211.47.76.

Unix Task A ­ Marks: 2

Put a reverse­sorted copy of your Floppix file /etc/motd into a file named floppix_motd_reverse_sorted.txt in your HOME directory on the Test Machine.

sort -r /etc/motd >temp
ftp 205.211.47.76
put temp floppix_motd_reverse_sorted.txt
quit

Unix Task B ­ Marks: 2

On the Test Machine: Put the four­word sentence It's raining $5 bills! into a new file named it_is_raining.txt in your HOME directory. Copy the sentence exactly!

echo It\'s raining \$5 bills! >it_is_raining.txt
   -or-
cat >it_is_raining.txt
It's raining $5 bills!
^D
   -or-
...try vi...

Unix Task C ­ Marks: 2

On the Test Machine: Create a sub­directory named .trash in your HOME directory. Set the permissions on this directory to be: execute only permissions for you, read and execute permissions for group, and read only permissions for anyone else.

mkdir .trash
chmod u=x,g=rx,o=r .trash
   -or-
chmod 154 .trash

Unix Task D ­ Marks: 2

On the Test Machine: Put a translated copy of the file /tt/mercury into the file named linux_mercury_translated.txt in your HOME directory. The translation should change the lower­case characters aeiou to the upper­case characters AEIOU.

tr   aeiou     AEIOU   </tt/mercury >linux_mercury_translated.txt
   -or-
tr '[aeiou]' '[AEIOU]' </tt/mercury >linux_mercury_translated.txt

Unix Task E ­ Marks: 2

On the Test Machine: Find all lines that contain the string 000 (three zeroes) in the file /tt/venus and place the output into the file named linux_venus_three_zeroes.txt in your HOME directory.

grep 000 /tt/venus >linux_venus_three_zeroes.txt

Unix Task F ­ Marks: 2

On the Test Machine: Create a reverse­sorted list of all the names (just the names, not including any hidden names) contained in the directory /tt/earth. Put the reverse­sorted output into the file named linux_earth_reverse_sorted.txt in your HOME directory.

ls -r /tt/earth >linux_earth_reverse_sorted.txt
  -or-
ls /tt/earth | sort -r >linux_earth_reverse_sorted.txt

Unix Task G ­ Marks: 2

On the Test Machine: Show the full listing (permissions, owner, etc.) for all the non­hidden names (including files and directories) in the directory /tt/mars that end in the digit 5. Put the output into the file named linux_mars_permissions.txt in your HOME directory. (Note: Do not show the contents of any names that might be sub­directories.)

ls -ld /tt/mars/*5 >linux_mars_permissions.txt

Unix Task H ­ Marks: 2

On the Test Machine: Create a directory named jupiter under your HOME directory. Under the jupiter directory, create two directories named io and callisto. Under the io directory, create two files (any size) named europa and ganymede. Under the callisto directory, create two files (any size) named metis and thebe. The name thebe should be a second name for the file named ganymede.

mkdir jupiter jupiter/io jupiter/callisto
touch jupiter/io/europa jupiter/io/ganymede jupiter/callisto/metis
ln jupiter/io/ganymede jupiter/callisto/thebe

Unix Task I ­ Marks: 2

On the machine acadaix there is a compressed text file named /thome/alleni/tt/saturn.gz containing a message. Do what the message says.

gzip -d </thome/alleni/tt/saturn.gz
   -or-
cd
cp /thome/alleni/tt/saturn.gz .
gzip -d saturn.gz
cat saturn
   -or-
[use ftp to copy /thome/alleni/tt/saturn.gz to a Linux machine]
zcat saturn.gz
Use "ls -id dirname" to get the inode information about the directory.

Unix Task J ­ Marks: 2

Consider the sub­directory named /thome/alleni/tt/neptune on the machine acadaix. This sub­directory neptune might (or might not) contain a file named "cow". If the data in the file cow is accessible, place a copy of the phrase contained in the file cow into the file named acadaix_neptune_phrase.txt in your HOME directory on the Test Machine. If the data in the file cow is not accessible, place the word no into the file named acadaix_neptune_phrase.txt in your HOME directory on the Test Machine.

cat /thome/alleni/tt/neptune/cow
...works fine; data is readable...