I have a simple C program and when I compile and run it with ./output
, does it get a PID on Linux? (I think, every running program is a process and it should have a PID.)
I used the ps aux
command but I couldn't find the process name there.
I remember, when my console application (a C program) was running on Windows 7, I was able to get its PID via the Volatility tool.
#include<stdio.h>
void main()
{
printf("Hello World!");
}
Yes, every running program on Linux gets a PID.
Your program just prints "Hello, World!"
, and will complete so quickly that by the time you run ps aux
it will have finished.
Also, void main()
should be int main(void)
, and you should add \n
to the end of your output string.
It should. just printf getpid() in you program to see it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With