Question

with SCREENSHOTS PLEASE Linux+ Guide to Linux Certification Project 9-4 In this hands-on project, you view...

with SCREENSHOTS PLEASE

Linux+ Guide to Linux Certification Project 9-4 In this hands-on project, you view and manage processes using the top command-line utility. 1. On your Fedora Linux virtual machine, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!. 2. At the command prompt, type top and press Enter. 3. From the output on the terminal screen, record the following information: a. Number of processes:_________________ b.Number of processes:_________________ c. Amount of total memory (K):____________ d. Amount of total swap memory (K):____________ 4. While in the top utility, press the h key and observe the output. When finished, press the h key to return to the previous top output. 5. By observing the output under the COMMAND column on your terminal screen, identify the PID of the top command in the output and record it here: 6. Type r in the top utility to change the priority of a running process. When asked which process to change (renice), type the PID from the previous question. When asked which value to use, type 10 to lower the priority of the top process to 10. Does this new prior- ity take effect immediately? 7. Type k in the top utility to send a kill signal to a process. When asked which process, type the PID used in the previous question. When asked which signal to send, type 2 to send an INT signal. Did the top utility terminate? 8. At the command prompt, type top and press Enter. 9. By observing the output under the COMMAND column on your terminal screen, identify the PID of the top command in the output and record it here: 10. Type k in the top utility to send a kill signal to a process. When asked which process, type the PID from the previous question. When asked which signal to send, type 15 to send a TERM signal. Did the TERM signal allow top to exit cleanly? 11. At the command prompt, type clear and press Enter to clear the screen. 12. Type exit and press Enter to log out of your shell.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

This question is totally based on 'top' command . It is used in linux for following purposes.

a) To find the running processes .
b) How much memory is getting used by each process.
c) How much space is getting used and how much is left.
d) For finding the process id(PID) of running processes and for few more reasons.

Please find my answers below each points:

1. On your Fedora Linux virtual machine, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!.

Solution:

   Press Ctrl+Alt+F2
   Enter username: neeraj
   Enter password: LNXrocks!

   Press ENTER.  

   Let us say it looks something like this after getting logged in:

   /home/neeraj>

    Note: Please use your username. I m using 'neeraj' here as my root username is neeraj.

2. At the command prompt, type top and press Enter.

Solution:
/home/neeraj> top
  
Sample Output:
-------------------

top - 23:41:21 up 15:36, 2 users, load average: 0.67, 0.66, 0.49
Tasks: 276 total,   1 running, 275 sleeping,   0 stopped,   0 zombie
%Cpu(s): 3.1 us, 0.9 sy, 0.1 ni, 95.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 8089964 total,   765128 free, 5039996 used, 2284840 buff/cache
KiB Swap: 15999996 total, 15599376 free,   400620 used. 1580236 avail Mem

------------------------------------------------------------------------------------------------------------
PID USER    PR   NI VIRT            RES      SHR      S   %CPU %MEM TIME +   Command
----------------------------------------------------------------------------- -------------------------------                                    
2978 neeraj 20   0    2543900 542224 133332 S   5.0        6.7   28:58.83 Web
3840 neeraj 20   0    1046912 38012 22844   S   2.3        0.5   12:22.02 unity

2226 neeraj 20   0    1620448 146276 47680    S   2.0        1.8   21:08.91 java

23762 neeraj 20   0      41944    3792     3096      R   0.7    0.0    0:00.17 top


3. From the output on the terminal screen, record the following information:

Ans.
          
a. Number of processes: 276.

Explanation: Line number 2 of sample commands tells total tasks which are running, stopped, sleeping etc. You can see below:

Tasks: 276 total,   1 running, 275 sleeping,   0 stopped,   0 zombie

b. Number of processes: 276:

Explanation: Line number 2 of sample commands tells total tasks which are running, stopped, sleeping etc. You can see below:

Tasks: 276 total,   1 running, 275 sleeping,   0 stopped,   0 zombie

c. Amount of total memory (K): 8089964 KB(KiloBytes)

Explanation: Line number 4 of sample commands tells total memory available, used , free, cached etc. You can see below:

KiB Mem : 8089964 total,   765128 free, 5039996 used, 2284840 buff/cache

d. Amount of total swap memory (K):15999996 KB(KiloBytes)

Explanation: Line number 5 of sample commands tells total swap memory available, used , free, cached etc. You can see below:

KiB Swap: 15999996 total, 15599376 free,   400620 used. 1580236 avail Mem

4. While in the top utility, press the h key and observe the output. When finished, press
the h key to return to the previous top output.

Ans.
Make sure top is running. Then press h.

At the end of output you will see something like below:

( commands shown with '.' require a visible task display window )
Press 'h' or '?' for help with Windows,
Type 'q' or <Esc> to continue : <Press Esc or type q here>

5. By observing the output under the COMMAND column on your terminal screen, identify
the PID of the top command in the output and record it here:

Solution. From sample output in question 2 you can see the PID(process id) of 'top' is 23762.

6. Type r in the top utility to change the priority of a running process. When asked which process to change (renice), type the PID from the previous question. When asked which value to use, type 10 to lower the priority of the top process to 10. Does this new priority take effect immediately?

Solution. Run 'top' command if not running already. Press r. r is used to change the priority of processes running.
     It will ask for PID of the process whose priority you want to change.
     Here we want to change the priority of a 'top' process itself.

     PID to renice [default pid = 2978]: Enter the PID of top.(look at sample output in question 2. Enter PID of top i.e. 23762).
     Renice PID 23762 to value : <Enter 10>

Yes. The new priority takes effect immediately.      

7. Type k in the top utility to send a kill signal to a process. When asked which process, type the PID used in the previous question. When asked which signal to send, type 2 to send an INT signal. Did the top utility terminate?

Solution:

Yes the top utility will terminate. k option is used to kill the process whose PID should be specified. By default it takes the PID of top command.

8. At the command prompt, type top and press Enter.

Solution:

/home/neeraj> top

9. By observing the output under the COMMAND column on your terminal screen, identify

the PID of the top command in the output and record it here:

Ans.

Sample Output:
-------------------

top - 23:41:21 up 15:36, 2 users, load average: 0.67, 0.66, 0.49
Tasks: 276 total,   1 running, 275 sleeping,   0 stopped,   0 zombie
%Cpu(s): 3.1 us, 0.9 sy, 0.1 ni, 95.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 8089964 total,   765128 free, 5039996 used, 2284840 buff/cache
KiB Swap: 15999996 total, 15599376 free,   400620 used. 1580236 avail Mem

------------------------------------------------------------------------------------------------------------
PID USER    PR   NI VIRT            RES      SHR      S   %CPU %MEM TIME +   Command
----------------------------------------------------------------------------- -------------------------------                                    
2978 neeraj 20   0    2543900 542224 133332 S   5.0        6.7   28:58.83 Web
3840 neeraj 20   0    1046912 38012 22844   S   2.3        0.5   12:22.02 unity

2226 neeraj 20   0    1620448 146276 47680    S   2.0        1.8   21:08.91 java

24678 neeraj 20   0      41944    3792     3096      R   0.7    0.0    0:00.17 top
By observing the sample output of top command provided in above question. You can see the PID of top is 24678.

10. Type k in the top utility to send a kill signal to a process. When asked which process, type the PID from the previous question. When asked which signal to send, type 15 to send a TERM signal. Did the TERM signal allow top to exit cleanly?

Solution. Yes the top utility will terminate cleanly.

11. At the command prompt, type clear and press Enter to clear the screen.

Solution: Not needed

12. Type exit and press Enter to log out of your shell.

Solution: Not needed

Add a comment
Know the answer?
Add Answer to:
with SCREENSHOTS PLEASE Linux+ Guide to Linux Certification Project 9-4 In this hands-on project, you view...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT