In: Computer Science
What is the PID for xeyes?
PID means process ID, which is mostly used by the operating system. A process is running instance of program. When a process is created, an ID is automatically assigned to it. Each time the process ID is changed for all processes except init. The init is always the first process in the system and the ancestor of all other processes. It holds PID 1. A process can have child process as well, so PID will be created for both parent and child process.
The default maximum value of PIDs is 32768. This can be verified by running the following command in linux
Cat/proc/sys/kernel/pid_max
Any of the following command can be used to find the process ID in linux:
pidof – find the process ID of a running program.
pgre – look up or signal processes based on name and other attributes.
ps – report a snapshot of the current processes.
pstree – display a tree of processes.
To find the PID of xeyes we can use any of the following command in linux:-
1. pidof xeyes
This displays the parent process ID with the other child process ID in Descending order and the parent process ID would be the highest numbered process ID.
2. pstree –p | grep “xeyes” | head -1
This give the process ID of the parent and the child separately and the parent process ID would be the highest numbered process ID.