Tuesday 2 June 2015

Redhat Linux, CentOS - Part 2


Processes

A process is created in memory when a program or command is initiated. It is assigned with a unique identification number known as process identification (PID). The background system processes are called daemons and critical to system functionality.
PPID - process ID of the parent process. TTY column shows the terminal on which the process was started. Console represents system console and ? indicates that the process is a daemon.

$ps -ef == process status -e (every) -f (full)



$top also can be used.
$pidof crond  == to list PID of a given process name
$ps -U root == list all processes owned by root. -G can be used for group


There are 5 process states and each process is in one state at any given time - running, sleeping, waiting, stopped and zombie.
sleeping - process is currently waiting for input from a user or another process
waiting - process has received the input it has been waiting for and it is now ready to run as soon as its turn arrives
stopped - process is currently halted and will not run even when its turn comes unless it is sent a signal.
zombie - process is dead; takes up no resource.

Listing Open Files

A file is opened when the process or program stored in it is executed and closed when it is no longer required. To see which files are open, which processes are using them, and who the owners are, use lsof (list open files) command.