2

Is it possible, in latest Ubuntu distro, to launch GUI apps directly from a tty without loading window/desktop manager?

We need this in situations like: After configuring an Ubuntu system to boot into text-mode CLI, we just need to launch:

  • gedit to edit some source files.
  • evince to view some pdf files
  • firefox to quickly view some movies for short entertainment

The idea is to have an easy-enough life inside text-mode Linux with quick-and-brief access to X stuffs. We only need one GUI window each time.

2 Answers2

3

That's easy. All you need to do is edit your .xinitrc and enable command line login.

WARNING: The following steps tell you to do "exactly" what you are asking. You will not be able to move any windows with your mouse because there won't be a window manager running. I advise you to at least have a window manager running so that you can move the windows or at least have a tiled window manager such as i3.

If you still wish to proceed despite this warning, follow these steps:

  • Install xterm: sudo apt install xterm
  • Open/Edit ~/.xinitrc and put xterm at the bottom and save the file
  • Disable GUI: sudo systemctl set-default multi-user.target
  • Restart and the system should now start in command line mode.
  • Log in and type startx and X will start with xterm running
  • Launch any program you want from there. To exit, type exit.
  • To re-enable GUI mode, type: sudo systemctl set-default graphical.target

Special note: You may need to click inside the xterm window with your left mouse button before you are able to type. Another way to exit is via pressing simultaneously Ctrl+Alt+Backspace.

marko
  • 928
  • 5
  • 10
0

marko's solution is great. I just wanted a one off solution to run inside of a new virtual terminal without configuring defaults differently and it is as simple as logging in on a new tty and running:
startx xterm

iyrin
  • 1,439