Lab 12

Back Up Next

horizontal rule

Home
Lab 1
Lab 2
Lab 3
Lab 4
Lab 5
Lab 6
Lab 7
Lab 8
Lab 9
Lab 10
Lab 11
Lab 12
Lab 13
Lab 14
Lab 15
Lab 16
Lab 17
Lab 18
Lab 19
Lab 20

Lab 12

(Chapter 12)

 

 


 

Learning Objectives

  1. To learn how to use UNIX I/O redirection and pipe operators
  2. To learn to use the I/O redirection and pipe operators to perform complex tasks which cannot be performed by individual commands
  3. To learn how to use UNIX FIFOs
  4. To learn how to use the UNIX I/O operators, pipes, and FIFOs to perform challenging tasks which are not possible with individual commands

Lab Work

  1. Log on to your UNIX system.
  2. Display the absolute pathname for the foobar file in your home directory. Redirect error messages to /dev/null. Show your session.

 

 

 

  1. Locate the foobar file in your home directory and save its absolute pathname in the foobar.path file. Append error messages to /dev/null. Show the contents of foobar.path. Show your session.

 

 

 

 

 

  1. A program, called banner, reads input from standard input and sends its output to standard output. Run this program so that it reads input from the student.records file and sends its output to the output.data file. Error messages are appended to the error.log file. Show your session.

 

 

 

  1. Create a file test.data using the cat command that contains the following data. Once you have created the file, display its content with the cat command. Show your session.

This data is to be stored in a file called test.data by using the cat command. We can create the test.data file with this data by using a text editor such as vi. However, the purpose of this exercise is to show an interesting use of output redirection.

 

 

 

 

 

 

 

 

 

 

 

  1. Combine data in the following files (in this order) and append it to the all.labs file. Any errors should be redirected to the error.log file. Show your session.

 

 

 

  1. The smallFile file used in Lab 10 contains student records. Use a command line to display the records for the top five students in ascending (sorted) order, i.e., with the highest GPA student’s record displayed first. Show your session.

 

 

 

 

 

 

 

 

  1. Perform the task outlined in 7 and e-mail output of the command to yourself. Use one command line. Show your session.

 

 

 

  1. Perform the task outlined in 7 but print the output on the HP2_left printer with the output page containing a nice header. Show your session.

 

 

 

  1. Use a command line to perform the task outlined in 8 as well as save command output in a file called topFiveList. Show your session.

 

 

 

 

 

  1. Create two FIFOs, called fifo1 and fifo2. Use these FIFOs, the tee command, and I/O redirection operators to generate the following output: total number of processes running on the system, status of all daemon processes, and total number of daemons running on the system. Show your work.

 

 

 

 

 

 

 

  1. How many soft links are there in the /usr directory. Show the command and its output.

 

 

  1. Logout


 

 

horizontal rule

Back to CS140U Homepage
This page was last modified September 26, 2004
wmorales@pcc.edu