Linux command switch terminal

Switch to Console in Ubuntu 18.04 — How to Leave GUI?

To install the graphics driver I need to exit GUI / Gnome and go to the terminal. How can I do this in Ubuntu 18.04? Ctrl (STRG)+ Alt + F1 . F7 does not work, neither on the desktop, nor on the login screen.

Hm. But the keyboard otherwise works? If need be, you can boot from grub in ‘recovery mode’ which will give you a console. From the menu start networking and install the necessary driver packages.

Yes, try recovery mode. You will need to enable networking to be able to download the driver. If you run into any issues connecting, don’t worry there are solutions for that

8 Answers 8

In Ubuntu 18.04, they have changed things around and you cannot get to tty1, it is always showing the display manager / login screen. If you log in, you then cannot get to tty2 because it becomes the GUI for the first logged in user. The tradition of both GUIs showing on tty7 has ended.

You can get to tty3 by pressing Ctrl + Alt + F3 , tty4 by pressing Ctrl + Alt + F4 , tty5 by pressing Ctrl + Alt + F5 and tty6 by pressing Ctrl + Alt + F6 .

You can then switch between tty3-6 by pressing Alt with the appropriate F-key.

Finally, you can get back to the GUI with Alt + F1 for the login chooser or Alt + F2 for the logged-in user’s desktop.

Nothing helps me I have tried ALT+F1 ALT+F2 CTRL+ALT+F1 CTRL+ALT+F2 CTRL+ALT+F7 . still in terminal. The ‘who’ output that there tty2 and tty5 but not inform which of them I currently logged in

Thank you for the explanation. For me, this worked exactly as described with a fresh install of 18.04 (desktop).

I have to press Fn as well as Ctrl + Alt + F3 .

Assuming you’re on a Desktop or Laptop, just use:

Or, you can boot into single-user mode, although you probably don’t want this as getting internet in this mode can be tricky.

My preferred way of entering recovery mode is to set

after you get a shell. Then, you can try using

for ethernet. If you use WiFi, try this question.

i lost my gui and my ubuntu suddenly got locked into command mode. after logging in i was still in command mode.. ctrl+alt+f2 helped.. although not the same issue has the op has, but my problem got solved! thanks.

The «official» way to this under Ubuntu is to pass systemd.unit=multi-user.target as a kernel parameter. So in my /boot/grub/grub.cfg I have the following entry:

menuentry 'Ubuntu Console Linux 4.15.0-23-generic' < linux /boot/vmlinuz-4.15.0-23-generic root=/dev/sdb1 ro rootfstype=ext4 apparmor=0 quiet systemd.unit=multi-user.target initrd /boot/initrd.img-4.15.0-23-generic >

Unfortunately, the grub.cfg file is populated with all kinds of unnecessary information. I usually delete all that and have the above chunk plus a similar one without the systemd.unit=multi-user.target which starts up gdm ( The X11 GNOME display manager).

Читайте также:  Линукс запустить network manager

Here is how it worked for me, thanks for all the help that brought me there:

choose advanced options in Grub choose recovery mode in the options that show up, one can load the network driver and mount r/w (mount r/w is part of the load network driver and dpkg options) choose "root. " to get to the console (use "mount -o remount,rw /" to get read and write access if not done with the options above already) 

Note1: Loading the network driver didn’t work for me, the pc always freezes. However I had the nvidia driver installation file locally, so could install it. After that I could not enter gnome any more, so had to reinstall Ubuntu 18.04 completely.

Note2: After installing the Nvidia driver for my graphics card different: via «sudo apt-get install nvidia-390», I always get the error in python «ModuleNotFoundError: No module named ‘tkinter'», but of course tkinter is installed. So currently I can not use python. it was the same error in ubuntu 16.04 and the reason why I updated. Hoped it would work in 18.04. I opened a new post for this: After installing Nvidia driver I get «ModuleNotFoundError: No module named ‘tkinter'» error in Python3

My original question here how to get to the console is answered and aside from freezing instead of loading the network driver is solved.

Источник

Переключение между консолями Linux

В Linux по умолчанию доступно целых двенадцать так называемых TTY консолей, которые можно использовать для выполнения команд, восстановления системы, запуска Wine или дополнительного X сервера, а также для многого другого.

Сегодня мы разберемся что это за консоли, где они взялись и как выполняется переключение между консолями Linux.

Что такое TTY консоли?

Аббревиатура TTY означает Teletype или телетайп. Чтобы понять откуда это всё взялось, надо немного оглянуться назад, а именно в 1830 год. Тогда были разработаны специальные машины, под названием телетайп, который позволяли отправлять набранные на клавиатуре сообщения в удалённые места. Это был большой шаг для телеграфии, потому что раньше для этих целей использовалась азбука морзе. Сообщения кодировались, передавались, а затем декодировались и печатались на бумаге. Тогда была запатентована специальная система кодирования, которая опередила ASCII на 89 лет. В машинах, использующих эту систему было всего пять клавиш и оператору приходилось запоминать различные сочетания для каждой буквы.

Когда в 1963 году появилась кодировка ASCI, производители телетайпов начали её использовать. После изобретения телефона телетайп стал применяться ещё шире, потому что появилась возможность объединить много машин в одну сеть. Затем из этого всего получился факс в 1980 году.

Компьютеры тоже развивались. Изначально, инструкции туда вводились с помощью специальных перфорированных карточек, однако это было очень долго и неудобно. Всем было нужно устройство, которое позволяло бы вводить инструкции и сразу же получать результат. Телетайп был идеальным кандидатом на место такого устройства ввода/вывода. Здесь было всё. Устройство было разработано для ввода текста, его кодирования, декодирования и отображения. Только теперь на другой стороне должен быть не ещё один телетайп, а компьютер.

Читайте также:  Linux email client console

Телетайпы начали использовать для управления компьютерами и мейнфреймами. Со временем их вытеснили аппаратные эмуляторы телетайпов, которые уже использовали не бумагу для вывода данных, а электронно-лучевую трубку. Такие устройства давали намного больше возможностей, таких как перемещение курсора по экрану, очистка экрана, редактирование текста и многое другое. Одним из таких виртуальных телетайпов был DEC VT05.

В современных системах, основанных на ядре Linux и других Unix подобных системах, все терминалы представляют из себя виртуальный телетайп. Только теперь телетайп эмулируется программно. Такие терминалы называются псевдо телетайпами (pseudo-teletypes) или PTS.

В Linux есть мультиплексор псевдотерминалов, который обрабатывает подключения ко всем таким PTS. Этот мультиплексор находится в ядре и доступен через файл /dev/ptmx. Каждая из двенадцати консолей, открытых по умолчанию в Linux — это псевдо телетайп устройство, подключённое к этому мультиплексору.

Переключение между TTY консолями

У каждой консоли есть своя горячая клавиша. Это Ctrl+Alt+Fn, где n — это номер консоли от 1 до 12 -ти. Таким образом, чтобы открыть первую консоль следует ввести Ctrl+Alt+F1, вторую — Ctrl+Alt+F2, двенадцатую — Ctrl+Alt+F12 и так далее. Например, откройте третью консоль и авторизуйтесь в ней, затем посмотрите номер псевдотелетайпа:

Как видите, здесь номер устройства /dev/tty3. Аналогично можно открыть шестую, для этого нажмите Ctrl+Alt+F6:

Обычно первая консоль занята менеджером входа в систему, а вторая или седьмая X сервером. Все остальные вы можете использовать в своих целях. Теперь вы знаете что такое TTY консоли, почему они так называются, а также как между ними переключаться.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Источник

How to switch between users on one terminal?

I’d like to log in as a different user without logging out of the current one (on the same terminal). How do I do that?

I asked a similar question, because I ran into issues with XDG environment variables ( $XDG_RUNTIME_DIR in particular) that were driving me nuts. -> unix.stackexchange.com/questions/354826/…

10 Answers 10

How about using the su command?

$ whoami user1 $ su - user2 Password: $ whoami user2 $ exit logout 

If you want to log in as root, there’s no need to specify username:

$ whoami user1 $ su - Password: $ whoami root $ exit logout 

Generally, you can use sudo to launch a new shell as the user you want; the -u flag lets you specify the username you want:

$ whoami user1 $ sudo -u user2 zsh $ whoami user2 

There are more circuitous ways if you don’t have sudo access, like ssh username@localhost, but sudo is probably simplest, provided that it’s installed and you have permission to use it.

Читайте также:  Подкачка оперативной памяти linux

I am getting this error «-su: /dev/stderr: Permission denied» after executing this command echo >>/dev/stderr on a login with su —login . , any tip? I found this btw unix.stackexchange.com/questions/38538/…

Does this allow each new user to have different, overriding values for environment variables? e.g. git config for work, open source, etc.

One finding, when I listed the env it saw that everything was in order as well as a visual inspection can go; And one thing was incorrect: XAUTHORITY=/home/user1/.Xauthority’. Not sure _why_? So X-window doesn’t work by default because the protection on ~/.Xauthority` file is: -rw——- . I made a copy and that let me run gedit as an experiment.

Generally you use sudo to launch a new shell as the user you want; the -u flag lets you specify the username you want:

[mrozekma@etudes-1 ~] % whoami mrozekma [mrozekma@etudes-1 ~] % sudo -u nobody zsh [nobody@etudes-1 ~] % whoami nobody 

There are more circuitous ways if you don’t have sudo access, like ssh username@localhost , but I think sudo is probably simplest if it’s installed and you have permission to use it

sudo -s gives you a shell like su , sudo -i simulates login like su — . Can be combined with -u $user , of course.

much more efficient. being able to «login» as a user who can’t normally login is a great asset. totally allowed me to run a database instance without messing with permissions or selinux

This command prints the current user. To change users, we will have to use this command (followed by the user’s password):

After entering the correct password, you will be logged in as the specified user (which you can check by rerunning whoami .

If you’re running Ubuntu, and if the user you want to login as doesn’t have a password set:

Enter your own password and you should be set. Of course, this requires that your user has rights to gain root privileges with sudo .

To switch the terminal session to a different user, where that user can’t exit back into the original user, use exec:

This will technically login the new user in a new term process, and close out the current one. That way when the user attempts exit or Ctrl-D, the terminal will close as though that user was the one who instantiated it, i.e., the user can’t exit back into the original user’s term. Kind of pointless, considering they can still just start a new terminal session and automatically be in the original user term login, but there it is.

EDIT: For what it’s worth, you can use linux vlock command in your ~/.bashrc to lock terminal sessions by default, requiring the password of the term session user to unlock. This would somewhat prevent the aforementioned term restart under the original user context, given the term isn’t instantiated using the non-default ~/.bashrc of the user, as configured.

Источник

Оцените статью
Adblock
detector