Wednesday, April 15, 2015

Day 12: The Linux Command Line Ch10 Notes


Chapter 10 - Processes

Commands:
ps – Report a snapshot of current processes
top – Display tasks
jobs – List active jobs
bg – Place a job in the background
fg – Place a job in the foreground
kill – Send a signal to a process
killall – Kill processes by name
shutdown – Shutdown or reboot the system

Question 1
Given the following output:




Answer the following:
a) What is the process id?
b) How long ago did the process start?
c) What is the percentage of that the process uses?
d) How many kilobytes of physical memory does the process use?

Question 2
Which command does display processes continuously and how to stop it ?

Answers

Answer the following:
a) What is the process id?

1226

b) How long ago did the process start?

19 hours and 19 minutes

c) What is the percentage of that the process uses?

0.0%

d) How many kilobytes of physical memory does the process use?

1020 kB

Question 2
Which command does display processes continuously and how to stop it ?

$ top 
$ q


Lab 5

1. Start nano text editor from the command line. In nano write: "Raspberry is Cool."
2. Pause nano by putting it to the background (do not terminate it).
3. Start another nano text editor from the command line. In this copy of nano write: "Inline skating is cool."
4. Pause nano by putting it to the background (do not terminate it).
5. Display the jobs put to the background.
6. Bring the first nano to the foreground (you should see the line: "Raspberry is Cool."
7. Put this process to background again.
8. Bring the second instance of nano to the foreground (you should 
9. Put this process to the background again.
10. Display the processes running by this terminal
11. Bring first nano to the foreground and exit without saving the text, then CTRL-x and don't save the file
12. Bring first nano to the foreground and exit without saving the text, then CTRL-x and don't save the file

Lab 5 Solutions

1. Start nano text editor from the command line. In nano write: "Raspberry is Cool."

$ nano

2. Pause nano by putting it to the background (do not terminate it).

$ CTRL-z

3. Start another nano text editor from the command line. In this copy of nano write: "Inline skating is cool."

$ nano

4. Pause nano by putting it to the background (do not terminate it).

$ CTRL-z

5. Display the jobs put to the background.

$ jobs

6. Bring the first nano to the foreground (you should see the line: "Raspberry is Cool."

$ fg %1

7. Put this process to background again.

$ CTRL-z

8. Bring the second instance of nano to the foreground (you should see the line: "Inline skating is cool."

$ fg %2

9. Put this process to the background again.

$ CTRL-z

10. Display the processes running by this terminal

$ ps

11. Bring first nano to the foreground and exit without saving the text.

$ fg %1
then CTRL-x and don't save the file

12. Bring first nano to the foreground and exit without saving the text.

$ fg %2
then CTRL-x and don't save the file