Hello friends,
hope you guys are good ,today we gonna learn the very basic but the most important difference between "
ctrl+z" and "
ctrl+c" while working on linux terminal.
Why we shouldn't use "ctrl+z" to terminate program on linux terminal
So, as most of us uses ctrl+z most of the times to terminate any running program, and it seems like it has been terminated but actually "ctrl+z" isn't the proper command to termiante any ongoing process.
For example, i have launched a program called gedit in Linux(ubuntu or any other distro of linux).
Then i pressed "ctrl+z" to terminate this gedit and you can see the picture below it has been terminated.
But guys this program didn't quit, the command "ctrl+z" doesn't terminate the ongoing program, it just push the program in background or we can say it stops the program. To verify if the program is still running in the background we can use command called "jobs", this will show us all the stopped programs running in the background or are at hold in the background.
now we can see our one process running in the background with the process id mentioned, now if we want to bring this process in foreground then for this we have to a command called "fg" followed by the process id of the particular process which we want to bring up, here the process id of gedit is mentioned as "1", to bring this process in foreground we have to write "fg 1" , thats it
Now we can terminate our program with command "ctrl+c" which actually terminates it , we can verify it again by command "jobs" after using "ctrl+c"
if there is still any process running in background.
Sometime you guys must have seen that our system becomes lazy or lags too much and we without bothering the reason behind this lagging of our system just,reset it or reinstall our operating system to resolve the problem,
Sometimes the main reason behind this slow functioning of pc is repeated use of "ctrl+z" in place of "ctrl+c", which consumes space in background day by day and our pc becomes slow.
So, now onward never use ctrl+z to terminate any ongoing process .
that's all in this article, for more such interesting tricks keep visiting our website.
Buy coffee for author
Comments
Post a Comment