Nothing shows up when I type man exit or which exit, so is it an actual command or is it a special keyword that the terminal application recognizes to disconnect? Is it no different than closing a terminal window by hitting the close button in the GUI Terminal app, despite getting a confirmation dialog for the UI way and none for the CLI way?
shell - How do I exit or cancel a bad bash command? - Unix & Linux Stack Exchange
unix - What is the proper way to exit a command line program? - Stack Overflow
shell - Linux basics - how to exit a running command - Stack Overflow
VLC is stuck in full screen and I can't exit it. Please help!
Videos
You can always try the obvious things like ^C, ^D (eof), Escape etc., but if all fails I usually end up suspending the command with ^Z (Control-Z) which puts me back into the shell.
I then do a ps command and note the PID (process id) of the command and then issue a kill thePID (kill -9 thePID if the former didn't work) command to terminate the application.
Note that this is not a tidy (no pun intended) way to terminate the application/command and you run the risk of perhaps no saving some data etc.
An example (I'd have used tidy but I don't have it installed):
$ gnuplot
G N U P L O T
Version 4.2 patchlevel 6
....
Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot>
Terminal type set to 'wxt'
gnuplot>
gnuplot> ##### typed ^Z here
[1]+ Stopped gnuplot
$ ps
PID TTY TIME CMD
1681 pts/1 00:00:00 tcsh
1690 pts/1 00:00:00 bash
1708 pts/1 00:00:00 gnuplot
1709 pts/1 00:00:00 ps
$ kill 1708 ###### didn't kill the command as ps shows
$ ps
PID TTY TIME CMD
1681 pts/1 00:00:00 tcsh
1690 pts/1 00:00:00 bash
1708 pts/1 00:00:00 gnuplot
1710 pts/1 00:00:00 ps
$ kill -9 1708 ### -9 did the trick
$
[1]+ Killed gnuplot
$ ps
PID TTY TIME CMD
1681 pts/1 00:00:00 tcsh
1690 pts/1 00:00:00 bash
1711 pts/1 00:00:00 ps
Try pressing Ctrl-D or Ctrl-C. If it fails, kill the process .
Trying with the tidy command you mentioned, Ctrl-D works.
Using control-z suspends the process (see the output from stty -a which lists the key stroke under susp). That leaves it running, but in suspended animation (so it is not using any CPU resources). It can be resumed later.
If you want to stop a program permanently, then any of interrupt (often control-c) or quit (often control-\) will stop the process, the latter producing a core dump (unless you've disabled them). You might also use a HUP or TERM signal (or, if really necessary, the KILL signal, but try the other signals first) sent to the process from another terminal; or you could use control-z to suspend the process and then send the death threat from the current terminal, and then bring the (about to die) process back into the foreground (fg).
Note that all key combinations are subject to change via the stty command or equivalents; the defaults may vary from system to system.
If you do Ctrl + Z and then type exit, it will close background applications.
Ctrl + Q is another good way to kill the application.