How do I know if an C program's executable is run in foreground or background ? - by Saradhi In my C program I want to know if my executable is run in foreground like this $./a.out or like this $./a.out & Read the article