Process Management Commands (fg, bg, top, ps, kill, nice, renice, df, free) Linux Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to the video tutorial on managing processes in Linux so what is the process an instance of a program is called the process in simple terms any command that you give to your Linux machine starts a new process for example when you launch offers to write an article it creates this process and it's possible to have multiple processes aka instances for the same program there are two types of processes the first one are the foreground processes they run on the screen and need input from the user an example of them are the office programs the second one are the background processes there are in the background and usually do not need user input them an example of them is the antivirus that you use you can start a foreground process either from the dashboard or you can run it from the terminal so if you want to run the badge your media player you can go to - type in banshee and you can run the media player this way otherwise you can go to terminal and type in banshee and execute the command when using the terminal you will have to wait until the foreground process runs if you start a foreground process or a program from the terminal then you cannot work on the terminal till the program is up and running to avoid such a situation you can run the program and send it to the background so that the terminal remains available to you let's learn how to do this for running a process on the background you need to start the program by typing in the command main once execute the program you need to present ctrl + Z then type BG to send process to the background so if we try the same on terminal we need to put in the command name for the process or the program and when it starts running we need to press in ctrl + Z which will stop the process then we need to type in BG to send the process into the background this way you can send the process to the background and keep the terminal free you can use the command FG to continue a program which is stopped and bring it to the foreground the simple syntax for this utility is FG space the job name an example for this s we will launch the Banshee media player stop the process and then we will type in FG to continue the process on the foreground let's look at some other important commands to manage processes starting with top this utility tells the user about all the running processes on the Linux machine the syntax for this utility is talked so when we run this utility on the terminal you would find a lot of fields with different abbreviations which we'll learn now one by one so starting with the PID it is the process ID of each task you can see here that it differs for each task or a process the user is a user name of the task owner so it can vary from root to as many user accounts that you have on your Linux system the PR is the priority it can be 20 which would be highest or minus 20 which would be lowest and I is a nice value of a task the VI RT that you read on the screen is the virtual memory used it shows memory in kilobytes the re s is the physical memory used and it also shows in kilobytes as h r is a shared memory used and it also shows in kilobytes the s is the status there are five types of the same the first one is d which says uninterruptible sleep our is running s is sleeping T is traced or stopped and the last one z is for zombie the cpu percentage that you see is the percentage of cpu time the percentage of memory is the physical memory used time plus tells us about the total CPU time and the command is the command name we will discuss some of these fields in this tutorial the next one is the PS utility this utility stands for process status it is similar to the task manager that pops up in a Windows machine when we use ctrl + Alt + delete this command is similar to the top command but the information displayed is different you can use these in Texas with the PS command that is try them so to check all the processes running under a user you need to use this command it will give us all the information on processes and programs running under guru 99 you can also check the process status of a single process by using the syntax PS space PID but first we need to find the PID of a process which we can do by typing in PID of space the process name here we'll type in Banshee and check its PID so it says two seven eight three so let's go ahead and check the process status of this single process this is how you can get information on the status of a single process this command terminate running processes on a Linux system the syntax for the kill command is kin space PID in order to use this utility again you need to know the PID of the process that you want to kill let us try it with an example let's say we have the Mozilla Firefox program running on our system and we want to kill it using the terminal for this you need to find out the PID of the program Firefox so now we know the PID of the program Firefox let's go ahead and kill it if the terminal does not return with an error it implies that the program was terminated successfully Linux can run a lot of processes at a time which can slow down the speed of some high-priority processes and result in poor performance to avoid this you can tell your machine to prioritize processes as per your requirements this priority is called niceness and Linux and it has a value between minus 20 to 19 the lower the niceness index the higher would be the priority given to that task the default value of all the processes is 0 to start a process with an iceless value other than the default value you need to use the following syntax it says nice space - n then the nice value then the process name if there's some process already running on the system then you can realize its value using the syntax let us understand this by an example so let us launch the Banshee media player with a nice value other than the default value which is zero so here we have chosen 19 as a nice value for this program now let us run it now after cleaning the terminal with the clear command we will now run the top utility and check the niceness value of the program Banshee so here we have the Banshee media player and its niceness value shows 19 now for realizing the value of an already running process we need to know it PID and as it shows here the PID for the Banshee media player is 3 8 4 4 so let us go ahead and realize its value from 19 to minus 20 for this we need to type in sudo realize then the new nice value which would be 20 here then - P then the PID which was three eight four four once we execute this command sudo would ask for the password upon entering the password terminal would tell us that the nice value of the process ID three eight four four has been changed from 19 to minus 20 this is how you can prioritize the processes running on your Linux system and make it more efficient moving on to DF utility it suppose the free disk space on all the file system the syntax says DF upon running this utility we will see all the file systems on our computer with the used and the available disk space if you want the above information in a readable format then you can use the DF utility with this option now you can see the total size the used and the available disk space on your computer this command shows the free and the used memory on the Linux system you can use the arguments free space - M to display output in megabytes or you can go with free space - gene to display the output in gigabytes let's try them so if we type in free space - enemy we will see that the total memory on the system is one thousand two megabytes and out of it 860 megabytes have been used this is how you can check the free and the used RAM on your Linux system let us summarize quickly any learning program or a command given to a Linux system is called a process a process could run in foreground or background the priority index of a process is called nice and Linux its default value is 0 and it can vary between 20 to minus 19 the lower the niceness index the higher would be the priority given to that task let us go through the utilities as well the BG command sends a process to the background the FG command runs a stopped process in foreground use top to get details on all active processes PS gives the status of processes running for end-user PS space PID would give the status of a particular process PID off space process name gives the process ID of the process or program kill space PID terminates a process or a program nice starts a program with a given priority green eyes changes the priority of an already running process DF would give you the free hard disk space information on your system and free because the free Ram details on your system thank you for watching this tutorial I hope to see you in the next one you
Info
Channel: Guru99
Views: 136,360
Rating: undefined out of 5
Keywords: ubuntu, linux, unix, os, tutorial, file permissions, ps tutorial, process commands, ps/unix, renice linux command, renice linux, sap, what is sap, sap software, sap tutorial for beginners, sap erp, sap introduction, what is sap software, what is sap course, linux tutorial, linux commands, process control
Id: P8GrPOpD8Sk
Channel Id: undefined
Length: 11min 27sec (687 seconds)
Published: Mon Mar 04 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.