Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connecting to target computer through SSH from command line. Target computer is running Gnome. I need to be able to tell the target computer to change its desktop to a fullscreen text console (like when you do ctrl-alt-f2). Running Gnome terminal fullscreen is not an option. Is this possible?

share|improve this question

migrated from serverfault.com Oct 29 '12 at 23:14

This question came from our site for system and network administrators.

up vote 7 down vote accepted

chvt N with N the number of the terminal (2 in your example). On Debian it's in the kbd package, I guess it should be the same on Ubuntu.

share|improve this answer
I don't know why I got downvotes, but I'm happy I asked because you and 200_success gave me a working solution! I'd also upvote but don't have enough reputation for that. – user14742 Oct 29 '12 at 22:59

You could run: telinit 3 or init 3 as root.

That will kill the graphical multiuser sessions and go into runlevel 3.

You don't mention the specific version of Linux, but for subsequent reboots, you want to default to runlevel 3 (instead of 5) in your /etc/inittab.

share|improve this answer
It seems to be distribution dependent. Neither init 3 nor telinit 3 stop xorg under debian 6 here. wiki.debian.org/RunLevel. Btw :Is there still any reason to use telinit nowadays except very old aix? – user21448 Oct 29 '12 at 17:48
Remote computer is Ubuntu 11.10. telinit 3 or init 3 didn't work. Also there is no inittab, maybe because Ubuntu uses upstart? – user14742 Oct 29 '12 at 17:52
Well, I guess Ubuntu is a valid OS :) Check out: askubuntu.com/questions/115469/… – ewwhite Oct 29 '12 at 18:46

Switch to virtual console 2 by executing chvt2.

share|improve this answer

You will want to use wmctrl. It's a program which can mess with X windows. More information can be found here. Also: Wikipedia article and man page. This program can be installed on the target machine by running apt-get install wmctrl.

share|improve this answer
wmctrl seems to require correct Display parameter to be set and I don't want to use any X-forwarding. Am I missing something? – user14742 Oct 29 '12 at 17:57
-1: wmctrl doesn't have anything to do with this (he wants to switch to a text console). – Renan Oct 29 '12 at 23:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.