-
Chvt – Switch between Virtual Terminals – Linux Command
Posted on July 22nd, 2009 No commentsIn Linux you have multiple virtual terminals which you usually navigate using the
[Ctrl] + [Alt] + [Fn]key.[Fn]stands forF1toF12keys.But the same thing can be achieved by using a little command in Linux called
chvt.
chvtcommand stands for CHange Virtual Terminal. It takes one option which is a number which tells it the virtual terminal to switch to.For example, if you are logged in at the first virtual terminal and you want to switch to the 7th where the xserver usually displays the GUI, then run the
chvtas follows :$ chvt 7
And to return to the 1st virtual terminal, type :
$ chvt 1
Suppose you have Imagemagick installed on your Linux machine and you wish to take a screenshot of your GUI while you are logged in at the console. Here is a simple way of doing it :
$ chvt 7; sleep 2; import -display :0.0 -window root screenshot-output.png; chvt 1;
What this does is, it first moves to virtual terminal 7, sleeps for 2 seconds, then use the import command to capture the screenshot of the desktop and save it in the file
screenshot-output.png, and finally return back to virtual terminal 1 which was your original console. Cool isn’t it ?Related Posts
- pwd – Linux Command to Print Working Directory
- How to print a man page from the command line in Linux
- How to find large files in Linux using command line
- lshw command – List hardware information in Linux
- Take screenshots in Linux with Scrot
