Near dupes of What is effect of CTRL + Z on a unix\Linux application
and https://unix.stackexchange.com/questions/135077/ctrl-c-vs-ctrl-z-with-foreground-job
Unless you've fiddled your stty settings, in which case you would know better than to ask this question:
Ctrl+Z "stops" a process in common Unix terminology, but "stop" does NOT mean "end". A process "stopped" with Ctrl+Z is effectively frozen, but you can resume it, either in background (so it runs but does not use the terminal) or foreground (runs and does use the terminal). While "stopped" it keeps files and sockets open, and the open socket continues to "reserve" the port. Think of it like a stop-light on a street: when you get to the stop-light you must stop and stay in one place while the light is red, but when it turns green you can resume moving (and if you don't, people start honking at you, at least in the US). Some people and tools use the word "suspend[ed]" instead, which you may find clearer.
To involuntarily end a process on your terminal (in foreground) use Ctrl+C, which Unix calls "interrupt" (INTR). If the process is not running in foreground on your terminal, you can instead use kill
(traditionally a program, now a shell builtin) with the PID (process id) number; this works even for processes running under another shell if you find the correct PID. If it is suspended or running in background under your shell, you can use the kill
builtin (only) with the jobid shown in the list from the jobs
builtin.
A program can also exit voluntarily, depending on the program. Running a jar uses java
to run a Java program starting with the designated main class within that jar as one thread; the program may create additional threads. If every thread returns from its main or initial class, or any thread calls System.exit()
, java
exits. To determine if and how this Java program does those things, you'll need to look at the Java program, or talk to somebody else who can look at or has already looked at the program.