OS Introduction Practical Test Revision Notes

Time and place

The practical test will take place in room 016 on Friday 17th July between 2.00pm and 16.00pm.

This will include a number of exercises to be demonstrated to the tutor. You will have to start on an empty Gutsy Host 1 making sure you can demonstrate to the tutor that you are starting on a clean system.

Exercises

1. copying files

Using Unix command lines:

  1. Create 2 directories within the /user/home directory.
  2. In one of these create 5 empty files.
  3. Ensuring you are in the same directory as the one containing the 5 files, copy these to the other directory. You must using a wildcard for the source of the copy. You must use a relative pathname involving the parent of the current directory to traverse to the destination of the copy.

Demonstrate the command to your tutor and write it in your logbook.

2. Using pipes, redirections and appropriate filters

Using a single pipelined command line:

  1. extract from the file /etc/passwd the record for useraccount: user
  2. store columns 3 (UID) and 6 (home directory path) in the file /home/user/cols3and6.txt . The output columns must be separated using spaces .

Demonstrate the command to your tutor and write it in your logbook.

3. Develop a Bash shell script

Using a suitable text editor develop a script which:

  1. prompts the user to input a filename for a text file.
  2. If the file exists and is readable compute and output the number of words in it.
  3. If the file does not exist or is not readable output a suitable error message.

Demonstrate the script to your tutor by running it to cover relevant test cases with appropriate test data and write the shell script text in your logbook.

4. use of ps commands:

Demonstrate to your tutor ps commands which:

  1. Show the relationship between parent and child processes using ascii art.
  2. Show the relationship between parent and child processes using PID and PPID columns.

Write in your logbook which one of these would be more useful within a shell script used to identify the parent process for a child process with a particular command name. Describe the procedure you would use to develop such a script in your logbook.

5. controlling background, foreground and stopped jobs

After testing suitable shell commands

  1. Write in your logbook how a command is launched in background
  2. Write down how a foreground program running in the console can be stopped
  3. Write down how background and stopped jobs can be identified through jobnumbers and process IDs identified.
  4. Write down how stopped jobs can be restarted.
  5. Demonstrate to your tutor, when an editor session where a file was partly created without it being saved, and was accidently stopped, can be recovered and the file then saved.

6. adding users and groups, and use of chmod command

Using shell commands:

  1. Create new groups for girls and boys
  2. Add 2 boy users and 1 girl user login accounts (e.g. ali, pete and mary) to the appropriate groups. (you can have 2 girl accounts and one boy if you prefer).
  3. Create a directory /home/boys with contents which both boys can write to but to which girls have no access. (You can include the 2 girls in /home/girls and exclude the boy if you prefer)
  4. Test the permission on the directory by attempting to access (read and write) files in this directory by both girls and boys.
  5. Demonstrate to your tutor that the required discretionary access is in place and works as required.
  6. Write down the commands used to add the accounts and achieve the permissions in your logbook.

7. apt-get package installation

Using suitable commands and editors etc:

  1. mount a .iso CD/DVD image file containing .deb packages using a loopback mount
  2. add a suitable line for the file source to the /etc/apt/sources.list file
  3. install one or more .deb packages (e.g. nfs-common, nfs-kernel-server)
  4. test and demonstrate the installed packages to your tutor
  5. write the commands used in your logbook.