To close a terminal window you can use the exit command . Alternatively you can use the shortcut ctrl+shift+w to close a terminal tab and ctrl+shift+q to close the entire terminal including all tabs.
Videos
Is there anything to force close the window, regardless of whether something is running?
I'm using KDE Neon if that makes a difference, checked in keyboard shortcuts but didn't find anything
To close a terminal window you can use the exit command . Alternatively you can use the shortcut ctrl+shift+w to close a terminal tab and ctrl+shift+q to close the entire terminal including all tabs.
You can use the ^D shortcut - that is, hitting Control and d. This works in many shells and shell-like environments. Technically speaking, this key combination emits the end-of-transmission character (ASCII code 04). In gnome-terminal, i.e. bash and other shells, this is interpreted as finishing the interactive session. You can also see this behavior in programs like cat which read from standard input (the keyboard). Try running it without arguments; you can terminate by entering ^D.
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.
@Kerth G. if you press these buttons: Ctrl+Alt+(F1 to F6), you will get TTY, to exit from that you have two ways:
- Press Ctrl+Alt+F7, if you have function keys enabled press Ctrl+Alt+Fn+F7.
- Log into TTY with your user credentials, then in TTY type command:
init 5, press Enter, now you will get Graphical User Interface.
To log out of a virtual console, you need to type exit.
Your Desktop Environment will be started in one of the virtual terminals. On Ubuntu, it is on tty7. So to get to it, press Ctrl + Alt + F7 (F2 since 17.10).
You can type exit. You can type ctrl-d. Or (if you're on a virtual terminal), you use ctrl-alt-F8.
ctrl + shift + w closes the current tab and ctrl + shift + q closes the entire window.
Also,
exit
This is similar to other commands that also are normally ctrl + whatever such as, ctrl + c and ctrl + v for copy and paste which, in gnome-terminal are, ctrl + shift + c and ctrl + shift + v respectively.
I'm not sure if the following works in a virtual machine, however, it is important to also note that when you switch to a tty text session such as tty1 - tty6 using ctrl + alt + f1 up to ctrl + alt + f6, you can return to the regular desktop xsession by pressing ctrl + alt + f7 typically or sometimes ctrl + alt + f8.
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.