1. (10 points) The two signals KILL and TERM can both be used to terminate a process, but in terms of guaranteeing that the process is killed, which one should be used? Explain. 

2. (5 points) In terms of permissions, why does UNIX associate users with processes? 

3. (10 points) What process is currently using the CPU the most and using the most memory right now? Note: Allow the command to run for a couple of seconds to get a good predictable result. How did you arrive at your response? Be detailed and precise.

4. (5 points) Why is it always important to contact the owner of a process that is a resource hog? Why not just terminate the process and allow the user to restart at a less busy time?

Part II: Commands (70%): Please simply write the command(s) which performs the following tasks Debian (your VM) in as few commands as possible. Note: If you do not indicate which shell you are using, I will assume you are using the bash shell (whether or not you are actually using this shell) 

1. (10 points) List all regular files in the present working directory showing only those files which have the permissions for group set to rwx. Note: use egrep and ls together!

2. (15 points) Write a regular expression to pass to grep to determine if a Chicago area (773 or 312) phone number, in the form 312-281-3303, is present in a given file (The command would be as follows: cat file* | egrep with the regular expression replacing the statement enclosed in ’s) 

3. (5 points) Find all the groups (in /etc/group) which do not have users attached to them (note: groups without users have no users after the last colon) using egrep 

4. (15 points) List all users (in /etc/passwd) who use either bash (/bin/bash) or dash (/bin/sh) and their home directory is in /home (second to last section of : has home directory). Hint: grep twice! 

5. (10 points) Add the following path to your current path: /etc/rc.d for this session only.

6. (5 points) Create an alias for setting all permissions to read, write, execute (777)

7. (10 points) Copy all png files on the system into the directory /root/pngs using find and command substitution (NOTE: you should be root to do this)

 



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *