I found many questions about how to open the terminal but cant find a question with an answer on how to close the terminal and return back to the desktop of Ubuntu (note: I am on virtual machine)

  • In effect this question, taken together with the OP's comments below, has two parts: figuring out the kind of terminal, then getting out of it accordingly. There's also the potential problem of key combinations being applied to a host (physical) system rather than the guest (virtual) system. But I think we can make this a duplicate of How do I get to the GUI after switching to a virtual console?, I accidentally hit Ctl Alt F<num>. How do I return to the GUI?, or Reverting from Ctrl - Alt - F1. Apr 12, 2015 at 4:00
  • 1
    It should be made clear whether OP is concerned about returning from a terminal emulator to desktop or from a tty to desktop. For terminal emulator enter exit and for tty press ctrl + alt + f8 or alt + f8. Apr 12, 2015 at 4:10
  • @Faizan I think that comment by the OP, taken with the question, pretty strongly indicates the goal is to get back to the GUI from a text-based virtual console. The OP doesn't seem to have been back in months, but I agree clarification from them remains welcome. Btw, on Ubuntu, X11 nearly always runs on tty7--so Alt+F7, rather than Alt+F8. (I've heard many Mint systems have X11 on tty8, but I don't know if that's true as my only Mint system is LMDE and not the more common Ubuntu-based Mint.) Apr 12, 2015 at 6:10

3 Answers 3


You can type exit. You can type ctrl-d. Or (if you're on a virtual terminal), you use ctrl-alt-F8.

  • my terminal in virtual machine is at a black background and when i type exit it refreshes its not a program opened in ubuntu like i see in videos what can i do & is there a program that let me have the terminal as a openable program in the ubuntu Dec 10, 2014 at 20:11
  • I sometimes notice that after trying to log out with crtl+d the log takes longer or the window doesn't close, pressing ctrl+c usually helps (and if we're talking about ssh using the parameter -v).
    – LiveWireBT
    Apr 12, 2015 at 1:14

ctrl + shift + w closes the current tab and ctrl + shift + q closes the entire window.



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.


TL;DR: Press Alt+F7.

You are apparently asking how to close a virtual console, also known as a virtual terminal--a full-screen text terminal you got to by pressing a key combination like Ctrl+Alt+F1, Ctrl+Alt+F2, and so forth.

In infer this since you say you wish to "return back to the desktop of Ubuntu" (indicating you are not on your desktop now) and, in a comment, wrote:

my terminal in virtual machine is at a black background and when i type exit it refreshes its not a program ...

Rather than actually closing your text-based virtual console, you probably just want to get back to the virtual console on which the graphical user interface is running. This is usually the seventh virtual console, so press Alt+F7. (Ctrl is optional when switching from a virtual console that does not have the GUI running on it; however, you must use it when switching from a virtual console that does have the GUI running on it.)

If those key combinations do not work--or change the virtual console of the host rather than the guest--and your Ubuntu system is a VirtualBox guest system, see How do I switch between virtual terminals in a guest system? as suggested by LiveWireBT.

Another way, which is much less often used, is to run the command chvt 7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.