Linux Basic Process Control Command

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
here friends I welcome you again and today I am going to cover process control command in Linux or UNIX what are this process control command I mean these are the command through which you can control a process or you can analyze a process or you can you can do anything with the process so I will cover the main come process control command which are generally used ok so let's move the tutorial the first thing is very basic I mean many of the times when we are running a command through our terminal we have a requirement that we want to send that command to background generally we run it on the foreground and then we want to send it to background and then we again want to bring it the foreground and want to analyze it ok so how we can do that ok so I will I will go through an example here what we are not trying to do I am just trying to create a process I see a watch utility you know what utility generally executes anything that is mentioned to it in a loop and by default it executes every two seconds right so you can also change it using - and if you want to execute it after every second so it will execute this command in a after every 2 seconds so I can there's two ways of sending it to the background either I use ampersand along with it and enter then it will go to the background directly or I can just execute this command and I can say ctrl + J and it will go to thee it will just go into sleep mode and then I have I have to type BG then it will go to the backbone okay so I will show you how we can do it and I will also show you how we can bring our how we can bring our background process into the foreground and how we can see how many web background process we are running and how to bring them into programs using jobs come on ok ok so let's go into the practical section here suppose I have I'm using a man pH say and I say am sent okay you see it goes into background and suppose if I say watch and I say LS - LT RH and I entered so you see after every two seconds it's during this come on by that control Z to slip it then I say BG so BG will be affecting the currently background slip come on I say V G so now watches also goes into the background so now I need to see how many jobs I have in the background so I will say Jo vs jobs now I can see that they are one job that is LS man LS i man LS that is executing in the background and similarly there is another command this process is cooking in the background what just plus and minus signifies plus signifies that when I do FG foreground then it will invoke this process okay so let us let me do FG and I enter you see the this process that was showing with plus as foreground out now I again say it will sleep and then I say BG - background it okay now let's see jobs suppose if I want to foreground this process then how would I say I say FG now I say one because it is Devon so you see it is foregrounded and I can see and I can say quit so now how many jobs am left with jobs only one right similarly I mean you can execute n number for one from a terminal and you can for grand or you can background as per your requirement okay so if you want to send it to background use it with - with M person in the beginning only or if you want to see some output and then you want to do it then just run it and say control Z and then you can do BG for sending it to background okay so pretty simple so let's go forward you tutorial okay we don't defy this yep so the next process control command is called PS PS command is the process command it's a very effective utility I general you can it's heavily used for searching any process and analyzing any process very much use in this shallow script so what is this it's very simple you say PS - e or e f or capital F or ily and in VSD you said the bsd linux you say a X or X we'll we'll concentrate on the normal - okay so so what a signifies is signifies to display all the processes F to the capital F wraps around the output right ly is more detailed version of it okay so we'll see that in detail to print a process tree so this is for printing a process tree EJH and in v SD formatter than this to know about threads you use L capital N and suppose you want to search a specific process then you can say PS - AF grab the process name so it will tell the detail of the particular process that you're looking for similarly if you know the process ID you say PS - V along with the process ID similarly if you just know the user ID use a process - you and the user ID okay that's a typo okay let's go to the practical session and we'll we'll see some handy practicals that will enhance our knowledge okay so versus PS the default command so what it says it says these are the processes which are running currently which is linked to this terminal right so which we are working versus the bash we know watch is still executing of you have not stopped that process with celexa buting and PS the third process that we have used so it's its PID R this it is linked to be this DT wire so this is the second terminal through which we are working okay and it mentions about the time from which it's running and the command name okay so if I say e it will mention all the processes so it's better to use it with a pager command that we have already covered so if you want to learn more about the pager command like less more so go to my another video tutorial so I said yes so now I can each I can see all the processes so E is stands to display all the processes right similarly okay similarly I can I can do full listing and I can see all the details of the processes like which is PID what is current ID what is resident memory size and time and everything right okay so and similarly if I want even the more detail format I say e ly right it gives me even the more detailed information about the process and I can look into the all the information okay similarly if I want to say see the process 3 IC e J and capital edge and it generally shows the process 3 that how which process is running and it's calling which process and how that actually the process tree expands right so it will all show you the kernel thread and the particular process we need it and it will show the entire tree of the process ok so this is mainly used for analyzing or debugging or understanding a particular binary that you're running okay similarly if you know about the it said okay so I say PS - e.l.f I will say I'm okay and I say because app may ask you to be okay so you see this is the Apache main main process and these are all the child processes that are running so using L I can see all the threads or the child processes okay and I can use graph for filtering out the particular if I want I would just want to see the HTTP process I will say crap and I can see the tail of it so I just what I did I say PS along with thee whatever thing I want to display and I piped it and I say crap and acitivity the process there okay so okay similarly suppose if I know the process ID - I will say PS - II and I will say the process ID and it will display the process getting information okay so it's only showing the process and it's information similarly suppose if I want to see all the processes running from a particular user column per search I would say I will say a PS - new research right I believe right now no process is running from this how can no process is away from this okay so let us let us open okay let's say watch and held on to your HM let us keep it is it getting now let's see okay so you see if I know a user ID I can say - new and it's showing that following processes are running to this user ID so we have seen that it's PS is a very handy command to analyze and understand aha lamina Here I am just having a basic information of it for detail you can refer to my another video tutorial in which I am just I have covered peers in a grid detail so you can master this command okay so our next command is let's go to the PPT and next command is top okay what is top top is a very good utility in Linux through which I can see various information for analysis for all the process that is running on the system even I'm kind I can see what is the CPU usage what is the memory usage which is total CPU says what is processed by CPUs I can see what is even in the memory I can see what is total physical memory usage the swap uses what are the buffers and I can even sort and I can play I can kill I mean top is one of the very handy command that is used and enemies I have I have another video tutorial which is educated to mastering top since it's used so widely so I have also created a separate video tutorial in this tutorial we'll we'll just try to cover the Asics of water okay so it displays the complete active process CPU membrane hello of information and if you want to list if you want to order process according to the memory usage to use a safe - - e and so - m4 memory uses - people - CPUs so the process which is taking the highest memory or highest process it will be on the top similarly you can press jet to have actually a very black and white view so you can press yet to have a more colorful interface see for seeing the absolute current running path of the process this you know some time it's very important sometime when you're analyzing you see a particular process and we want to go to the particular directory of that process and want to do some work with that so you just interrupt you say see and it will show you the path and you can just go anything work so great thing similarly you can killer any process from the top itself you classic atlast will process ID you just mention it and it will kill that process similarly if you want to save the configuration then it will use safe W and save it into the this path okay similarly suppose you if you want to see all the processes running of a particular user you say top - you the way you waited for the PS okay so let's go and practice okay so we say top 4 bucket CC top it's showing that for how long my system is up this much time okay and other details similarly task information total task current running tasks slipping task top tasks zombies and CP usage and then memory usage and this web I've covered everything in detail in my other video people I will explain each and every filled in that so if you are interested in mastering top please watch the tutorial okay these are the list of process IDs along with the users and all the all the other informations ok so this is a process ID and this is complete information of the SSD process running that this is percentage CP usage is using this much of CPU and the memory usage ok so I have also covered all this thing that what each of this attribute means in the top so in that video tutorial I mention everything in detail now here if I want to short my output through to memory usage I will say sift M and it is sorted in order of its memory usage so you see GD GD am greeter is using 1.5 percentage of memory ok so you can see all this if you want to sort in the order of CPU so either shift P and it is listed in the order of CPU such ok similarly it since it's a very black and white view I can say is that I just press that for a more colorful output ok so if I want to see the absolute path of the positioning I say see so here I don't have any process which is which has any particular path otherwise not showing here but because it see it will show the complete part of the process ok similarly if you say shift no it has it shows the road configuration to that particular box okay huh let's see it again so this particular part since algorithm okay and similarly if I want to kill a process I say K knots asking which process I want to fill so I can give any process from here right suppose if I want to kill this process right I say this enter it asks do you really want to kill it I will say yes and I will enter it will kill that process okay so it has killed that book you see like critical that process okay similarly you can kill any process from here but how do you quit you say suppose if I want to kill top I will seek a I have top ID I say and yes let's kill that process and you press Q for quitting the top okay similarly if I want to see processes of a specific user then I will say - new username and it will tell me all the processes which other name right and suppose here also if I want to kill some process which is running like the watch that we visit there I say Phil is asking for yes I say yes let's tell that okay did you see it a scalar process Q for exiting so this this was all regarding we from let's go and see what else we are left to cover what is a section okay so we are we have already seen how to kill from that top but suppose if you some process is misbehaving also you want to put some process so how how do you do you see kill when the process ID it will krill it will kill the process but the important thing is you should be owner of that process if you are killing some others process which are running some other user ID and we go to write you will not here so you can use kill all for killing all the main process suppose you are killing the IAM process from root it will who knows all the them which is exhibited and saluting from any of the login so when you say kill all it will give kill all the processes sometimes a simple kill is not enough for killing a process so you say - 9 and you give a process ID and it will forcefully kill with sick kill okay similarly similarly if you don't remember the process ID or you do not want to grab the process ID you can say Pitkin I can mention - I or anything the way you want okay so let's see some examples of it okay so let's fry it again and okay so so let us not as such for that particular process that we have - I never watch so we have one watch process running from root and one from words suppose if I want to kill I'll say kill - nine why'd I say root to the process ID I said kill and now you can see that is L fight this one process similarly if I say equal - nine and I leave a process ID it will kill okay so okay one I did a mistake it's a pickle - it will get processed name right the process name is watch let me see yes quell the process okay similarly I mean you can say kill all while opening all the wall DVR it will all the processes of multiple processes and if from multiple user and kill all of them so kill is a pretty dangerous amount so it should be very careful while using it okay that's all we had in today's session and I hope you learnt a lot and enjoyed it also friends I have one request if you like this tutorial please like it share with your friends share feedback and also subscribe to this channel okay watch the other tutorials also in this section and share free rapid okay bye signing off
Info
Channel: Linux Tutorial
Views: 49,589
Rating: undefined out of 5
Keywords: process control, process commands, foreground, background, jobs, top, kill, bg, ps, process command in linux, top/linux, ps/linux, kill/linux, commands in linux, linux tutorial, linux command tutorial, basic linux commands, command of linux, unix linux commands, Linux basic commands, linux ubantu commands, command-line interface, ps/unix, top/unix, kill/unix, Command, GNU/Linux (Operating System), learn linux commands, unix tutorial
Id: swiHsaD8BGI
Channel Id: undefined
Length: 21min 31sec (1291 seconds)
Published: Tue Jun 17 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.