Now that we can see and monitor processes, let's gain some control over them.
So for our experiments, we are going to use a little program called X Logo as our guinea pig.
So the X logo program is a simple and sample program supplied with the X window system and the underlying
engine that makes the graphics on our display go, which simply displays a resizable window containing
the x logo.
Here you will enter x logo here and as you can see here, that's our X program right here.
You can resize this.
Oops, where'd it go?
Here.
So you can resize this, right that and drag this down.
So actually it doesn't have any functions.
It's just a sample and dummy program.
So after entering the command, the small window containing the logo should appear somewhere on the
screen here on some systems X logo might print a warning message, but it can safely be ignored.
And if your system does not include X logo program, try gedit.
Actually, let's close this.
So try gedit or as you can see it asks me to install or you can also use the gedit.
And here the second program was.
Actual.
The second program was key.
Right.
Yeah, right.
Your key.
Right.
Here as we let's install the key right now.
Enter our password.
Yes, it's 175MB.
I think the that is going to be much less in size.
Edit Yes.
As you can see, it's 50MB.
And you can also open just another window in from your tab here.
In this case, let's actually we can also use the screen recording for just for just example here.
But in most systems, the X logo is comes with default.
So you don't have to install it.
Probably it has in your system Linux system here.
So we can verify that the x log is running by resizing and its window if the log is redrawn in the new
size like this and here like this, then it means the program is running.
So notice how our shell prompt has not returned, as you can see here, just doing a sync.
So this is because the shell is waiting for the program to finish, just like all other programs we
have used so far.
So if we close the X logo window right here.
As you can see here, the prompt returns and we can enter a new command in this prompt here.
So let's observe what happens when we run X log again.
So first, enter the X log command and verify that the program is running.
Next, return the terminal window and control.
Actually, let's actually see happens right here and make it X logo.
Here and now.
We're going to in-terminal.
We're going to press control.
Quantum control.
Thompson.
And see.
Command and see.
Let's.
Let's see what happens right here.
And that's it here, as you can see in terminal.
We press the Ctrl key.
When you press any programming control C, it will interrupt a program.
So this means we are politely asking the program to terminate after we press Ctrl C, the x log of windows
is closed here and the shell prompt returned.
Many, but not all common line programs can be interrupted by using this technique.
Let's actually put a process in the background right now.
So let's say we wanted to get the shell prompt back without terminating the program.
We can do this.
Actually, we can do this.
By placing the program in the background.
A think of the thermal as having a foreground with the stuff visible on the surface, like the shell
prompt and the background with the stuff hidden behind the surface to launch a program so that it it
is immediately, immediately placed in the background.
We will use this command X logo and operator X logo and operator ampersand character here enter.
And as you can see here, we now enter the shell and we also opened our X logo without terminating it.
So after entering the command X logo, window appeared, as you can see here, and the shell prompt
is returned.
But some funny numbers were printed right here.
So this matches is a part of a shell feature feature called the Job Control.
Your.
Job.
Control.
So.
The job control with this message.
The Shell is telling us that we have a started job number.
Job number one and that it has process ID So this is a job number and this is a process ID after job
number is 12,496.
So if we run the PS command right here.
Yeah.
If we run the PS command right now, we can see our processes.
That's it.
12 496 12 496 and X logo.
Here.
As you can see, our program name is writing right here.
So the Shell job control facility also gives us a way to list the jobs that have been launched from
our terminal.
So using the jobs command, using the jobs command, we can see this list right here.
So the result shows that we have one job number one that it is running and that the command was X logon.
Let's now return the process to the foreground.
So a process in the background is.
You mean you mean from terminal keyboard input, including any attempt to interrupt it with the control
C here.
As you can see, whenever we click Ctrl C it does not.
It happens nothing here actually.
Let's make it always on top and make it right here so it will not disappear right as it did in previous
here.
Clear the clear.
As I said, it processes in the background is immune from terminal keyboard input.
So to return a process to the foreground.
Use the f g.
Command in this way.
So first, you're going to enter the jobs here to see what is is here.
And now we're going to use the FG and percentage and one.
Here, As you can see here, the FG command followed by a present sign on the job number called a job
spec does a trick.
So if we only have one background job, the job spec is optional too.
To terminate the x logo here.
Uh, you will press the control C here and it will terminate our process that we used in background.
We can also pause or stop a process.
So sometimes we will want to stop a process without terminating it, which you will learn in next lecture.
How to stop a process.
So I'm waiting you in next lecture.