In this lab you will use the ps command to monitor
processes as you create them using UNIX commands.
If you get stuck, have a question or want to share something you learned with this lab then use the CIS 90 Forum at
Log on to Opus so that you have a command line shell at your
service. Be sure you are in your home directory to start this lab.
- Run the C shell program csh. Then run the Bourne shell sh.
Run the ps command to see that you have three shell
- Run the ps command with the -l option. Look at the
column headed by the symbol SZ. This is the size of the process in 1K blocks.
Which of the three shells that you are running is the largest? Redirect that line of
output to the file bigshell.
- Now terminate the Bourne and C shells by typing the exit command
- Run the ps command with the -ef option. What is the
parent of your shell process? The Grandparent? The Great Grandparent?
- What is the name of the program with the PID of 1? (What is its parent)?
- Run the app command in the foreground.
- Notice that you are stuck. Bring up another window on opus and kill this process.
Hint: use the command ps -u $LOGNAME to find the pid number.
- Run the app
command in the background by adding a & on the command line
(Hit the Enter key to get your prompt back)
- Now try to log out by entering the exit command. What does the
- Enter exit again, and then log back in. Use ps to
check on the app process. Is it there? What happened?
- This time enter the following command:
find $HOME > files.out 2>/dev/null &
- We will now use the at command to submit the work you have just done.
Since the find process may not be finished running yet, we will set the command to be
executed just before midnight. The at command gets its input from stdin,
so you will have to type the following lines:
at> cat files.out bigshell > lab08
at> cp lab08 /home/rsimms/turnin/lab08.$LOGNAME
Note: the Ctrl-D (hold down the Ctrl key and tap the D key) must be entered as the first character on the last line.
If you get a warning message from the at command about using the
Bourne shell to execute your job, that is ok. Tomorrow morning you should see the file,
lab08 in your home directory.