Linux Basics and about Process

Naveen Singh
2 min readApr 6, 2020

Program- software that is in your hard disk that is setup file which is saved in your storage.

Process- Setup or executable file running currently on your system or program that is executed on system and keep running. Process occupies memory that is RAM of system not hard disk (storage).

Pid — every process have a unique id. Process can be identified by its id.

PPid- Every process has a parent process. The child process is often started by parent process.

init — init or systemd is system and service manager for linux OS. This process have pid 1 as it run during boot process. It don’t have parent and hence called as foster parent for orphaned process.

Daemon- Process that start at system startup and keep running forever called daemon process and it never dies.

Kill — when you want to a process to die, you kill it.

Zombie- when you kill a process but it keep showing on system is called Zombie.

Basic Process Management

$$- it a shell parameter. It contains current shell process id (shell is running).

$PPID- it tells current shell parent process.

Example- echo $$ $PPID, output = 2782 2775 (your output may vary)

Fork & exec- when you run a process its parent process makes a identical copy of itself (forked) and replace that copy from its child process (exec).

#exec without forking can execute a new program that is if a new program execute without forking it replaces the current program and take its pid and the current program gets killed.

To get pid of process we have many commands like

· ps fax- give all process id

· ps –aux — give all process id with detailed information.

· top — give all process id and press h for help after running top

To find process by name

· Ps –C command name example = ps –C bash, output= 2782 (vary)

· pgrep command name

· pidof command name

KILL- killing the process

· Kill pid or kill -15 pid — kill this particular process

· Kill -9 pid — this signal is sent to kernel rather than a process to kill the process and call it SURE KILL.

To kill process by name

· pkill bash

· killall bash –kill all the process with a certain name

· top can be used to kill a process just by running top and then press k.

--

--