Page | 1
of 2
Lab 4 – task 1
Describe two ways to show line 5 from the /etc/passwd file. (#1: Found in Working with Other Useful Text Processing Utilities section)
(#2: Found in Displaying the First or Last Lines of a File with head and tail section)
1.
Use the sed command by typing sed -n 5p /etc/passwd
Figure 1:sed -n 5p /etc/passwd command output
2.
Use the head and tail commands by typing head -n 5 /etc/passwd | tail -n 1
Figure 2: head -n 5 /etc/passwd | tail -n 1command output
Lab 4 – task 2
How would you locate all text files on your server that contain the current IP address? Do you need a regular expression to do this? Lab 4 – task 3
You have just used the sed command that replaces all occurrences of the text Administrator with root. Your Windows administrators do not like that very much. How do you revert? Lab 4 – task 4
Assuming that in the ps aux command the fifth line contains information about memory utilization, how would you process the output of that command to show the process that has the heaviest memory utilization first in the results list? Lab 4 – task 5
Which command enables you to filter the sixth column of ps aux output?