I want to make a little tutorial with more than one post showing how to manage processes in unix systems and, if I have time, I will make a little script to show the processes in the terminal using the awk command(I will talk about it). :)
I'm not going to teach about programming(at least not yet) so for us a brief description of process is that each program that is running in the system is a process.
If you don't know, the system processes and all their information is inside a folder called proc (/proc/*), inside this folder we'll see folders with numbers, those are the processes and its names are their corresponding process identifier(PID). And inside each folder as you will expect, are the files with the information about the process.
Some of the files are:
--cmdline: Is the path of the process.
--maps: It contains information about the process memory map.
--status: It contains information about the process like the PID,PPID,STATE and attributes about memory consumption.
--stat: It contains a lot of information about the process, is a text file made up with several fiels separated by the space character(it could be helpfully for scripts managing processes information, but for me not because is too messy XD).
--cmdline: Is the path of the process.
--maps: It contains information about the process memory map.
--status: It contains information about the process like the PID,PPID,STATE and attributes about memory consumption.
--stat: It contains a lot of information about the process, is a text file made up with several fiels separated by the space character(it could be helpfully for scripts managing processes information, but for me not because is too messy XD).
You dont have to go to the folder to view the file, just type in the terminal:
--> One important thing is that 'ps' ONLY takes a snapshot of the processes, if you want to view it in real time you should use the 'top' command.
If you use the imagination we can made a script to do a real-time 'ps' command script by using a loop and the 'sleep' command. Well, in programming you just have to be imaginative so play with it, I will post more things about that process managing guide soon. ;)
--------------------------------------------------------
Voy a escribir este tutorial en inglés por que creo que se entenderá bastante bien, pero si tienen algún problema con eso, lo puedo traducir en un momento :)
more /proc/$pid/$file #Where $pid is the PID pf the process and $file is the file you want to see(I think it is clear XD)But well... you have no idea of what PID have the process you want? no problem hehe, type:
ps -Ato see all the processes in your system and their corresponding PIDs, that command will show the processes in the terminal. ^^ You can also use the 'man ps' command to learn about 'ps'.
--> One important thing is that 'ps' ONLY takes a snapshot of the processes, if you want to view it in real time you should use the 'top' command.
If you use the imagination we can made a script to do a real-time 'ps' command script by using a loop and the 'sleep' command. Well, in programming you just have to be imaginative so play with it, I will post more things about that process managing guide soon. ;)
--------------------------------------------------------
Voy a escribir este tutorial en inglés por que creo que se entenderá bastante bien, pero si tienen algún problema con eso, lo puedo traducir en un momento :)