Is there a possibility to enter the terminal mode accessible with Ctrl+Alt+F1 with a bash command so that I can tell a script to do so?


Since you intend to use a command in a script, you probably want to use something that doesn't need root privileges to be ran as 'chvt' or 'openvt' .

That's why you may prefer xdotool Install xdotool. After you have installed, you can use the following command to simulate this shortcut input Ctrl+Alt+F1:

xdotool key Ctrl+Alt+F1

Command for changing virtual terminals is named chvt. In gnome-terminal:

$ sudo chvt 1

Here is an exmplanation why do you need sudo: https://superuser.com/questions/69807/why-does-chvt-work-fine-as-a-regular-user-on-a-virtual-terminal-but-not-under-x

In a virtual terminals 1-6 root privileges aren't needed.

To run a command on another virtual terminal you can use openvt:

$ sudo openvt -s pwd

More examples and explanation here: http://www.ae.iitm.ac.in/pipermail/ilugc/2008-December/045004.html

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.