[fedora] how switch between text and graphical consoles

来源:互联网 发布:王自如 知乎 编辑:程序博客网 时间:2024/06/16 17:24

原文链接:http://www.faqs.org/docs/lnag/lnag_xwindows.html


摘抄几段:

How to switch between text and graphical consoles?

Pressing the key combination <Ctrl><Alt><F1> will switch you to to the firsttext console at any time. <Ctrl><Alt><F2> will switch you to the second text console, <Ctrl><Alt><F3> to the third text console, etc, up to <Ctrl><Alt><F6>, for the total of 6 text consoles. <Ctrl><Alt><F7> will switch you to the first graphical user interface (GUI) console if one is running<Ctrl><Alt><F8> to the second GUI console, etc., up to <Ctrl><Alt><F11> for the total of 5 GUI consoles.  The 12th console is either used as the 6th GUI (RedHat 6.1) or a place to which kernel messages are continually displayed (Mandrake 7.0, really cool feature). Typically none or only the first GUI console is running.

<Ctrl><Alt><F1> means: "Press the left <Ctrl> and <Alt> keys and hold them. Now press <F1>. Release <F1>. Release <Ctrl> and <Alt> keys."

Thus, sitting at a Linux computer I can have many consoles opened at the same time, and I can switch between them using the hot keys as described above. I have to log in on each console to be able to use it--I may log in as the same user (multiple times), or different users. Each login session is quite separate; they should not interfere with each other (the X sessions sometimes may if you log in as the same user twice). The first 6 consoles are text-based, command-line terminals (CLI, "command line interface") and are named tty1, tty2 ... tty6 (historical name, "tty" stands for "teletypewriter").  The subsequent consoles are graphical (GUI).  These are all *local* consoles--my local linux computer is truely muliuser and multitasking.

You can connect to a Linux computer remotely, over a network. While connected, you can have a program run on the remote Linux server and the display sent to your terminal on your "local" console. This local console can be Linux-based or another operating system-based.  One cannot run programs remotely on an MS Windows server, but it is often used with Linux. It is really helpful to be able to distinguish if your program is run locally or remotely.

The full-screen text consoles are terminals by themselves. Under the GUI consoles, you can also create "slave" pseudo-terminals (in a window) on demand--they will be called pts0, pts1, ....

Sitting at a text terminal, you can determine the name of your terminal using the following command:

tty

I can determine the computer on which my current session is located using:

uname -a

The name of the command "uname" is derived from "UNIX name". It shows the operating system name,  the server name, the version of the operating system kernel, and the time of the compilation of the kernel.

You can close any text terminal by typing "exit" inside it.

The Linux GUI console is quite similar to other GUIs you might have used,  e.g., MS Windows, but there are also numerous important differences. I love multiple "desktops" to stay organized--the default setup in KDE offers 4 desktops (it can be customized to between 1 and 16). I run many programs and never close them, so to stay organized I keep a connectivity application (netscape with all its windows, knode newsreader, and licq) together on Desktop2,  abiword, staroffice and a text editor on Desktop3, games and konqueror with helpfiles on Desktop4, and leave Desktop1 for the more occassional chores.  One can switch between desktops by clicking on the "desktop pager" on the "K-panel" or using <Ctrl><TAB>.  To switch between applications on a same desktop, I may click the application window, or click its icon representation on the "applicaton panel", or use <Alt><TAB> to toggle between the applications. <Ctrl><Esc> will give me a list of the processes currently run on the local machine ("localhost").

Can I have a GUI login prompt?

To start your X-server automatically on the system start-up and display a graphical login prompt, you have to change (as root) just one character in the file /etc/inittab .  This file specifies something like:
id:3:initdefault:
Change it to
id:5:initdefault:
This sets up the default runlevel to 5, which is X-Windows. The meaning of the different runlevels is explained in the same /etc/inittab file :
0 - halt (Do NOT set initdefault to this) 
1 - Single user mode 
2 - Multiuser, without NFS (The same as 3, if you do not have networking) 
3 - Full multiuser mode 
4 - unused 
5 - X11 
6 - reboot (Do NOT set initdefault to this)
You can change the runlevel from the command line. E.g., this command (has to be executed as root):
init 6
will reboot your computer, while the following command would switch your computer to a single-user mode:

init 1

To find out which runlevel I am currently at, I use the command runlevel.

To fine-tune the appearance of my X login screen, I can use (under X):

kcontrol &

and select "System"-"Login Manager".  I like a login screen with an analog clock, big font, the login name of the last user already typed in, and the focus pre-set on the password field in the dialog box.

Can I have multiple sessions of X running at the same time?

Yes, you can. When you issue the first startx command on your system, it opens the first X-session on the default display 0.  The second X-session must be opened on a different display. For example, this will open a second X-session on the  display 1:
startx -- :1
You can have up to 6 concurrent X sessions. Use <Ctrl><Alt><F7> to switch to display 0,  <Ctrl><Alt><F8> to second screen,  etc. up to <Ctrl><Alt><F12>   Try man startx  if you need more info.
In a similar fashion, you can open another bare X-server session without a window manager. This will open one on display 2:
xinit --  :2
On this bare-bone X-display I can run a different windows manager (so as to have two different ones running at the same time) by typing in the X-terminal window one of these (see the previous answer for more details):
startkde 
gnome-session 
xfce 
afterstep 
AnotherLevel 
fvwm2 
fvwm

Can my sister have second GUI login prompt so she does not have to kill my X-session to start hers?

To enable several concurrent GUI logins on different local consoles under RedHat (RedHat uses program gdm for graphical logins), I had to edit the file: /etc/X11/gdm/gdm.conf . I have the following entry at the end of this file to enable 4 login terminals  <Ctrl><Alt><F7>  to  <Ctrl><Alt><F10>:

[servers] 
3=/usr/bin/X11/X vt10 
2=/usr/bin/X11/X vt9 
1=/usr/bin/X11/X vt8 
0=/usr/bin/X11/X vt7

Having four GUI lets me run KDE and GNOME at the same time on one computer with two GUI terminals spare, so my sister can login despite my having screensavers with password-protection.

To enable several concurrent GUI logins on different local consoles under Mandrake (Mandrake uses kdm for graphical logins), I had to modify two files:  /etc/X11/xdm/Xservers to include something like:

:0 local /usr/X11R6/bin/X :0 
:1 local /usr/X11R6/bin/X :1 
:2 local /usr/X11R6/bin/X :2

and  /etc/X11/xdm/xdm-config  to copy all the settings for display 0 to display 1 and 2 so that it includes this:

DisplayManager._0.authorize:    true 
DisplayManager._1.authorize:    true 
DisplayManager._2.authorize:    true 
DisplayManager._0.setup:        /etc/X11/xdm/Xsetup_0 
DisplayManager._0.startup:      /etc/X11/xdm/GiveConsole 
DisplayManager._0.reset:        /etc/X11/xdm/TakeConsole 
DisplayManager._1.setup:        /etc/X11/xdm/Xsetup_0 
DisplayManager._1.startup:      /etc/X11/xdm/GiveConsole 
DisplayManager._1.reset:        /etc/X11/xdm/TakeConsole 
DisplayManager._2.setup:        /etc/X11/xdm/Xsetup_0 
DisplayManager._2.startup:      /etc/X11/xdm/GiveConsole 
DisplayManager._2.reset:        /etc/X11/xdm/TakeConsole

This enables me to run gnome and kde at the same time on a single computer with the third GUI terminal spare.

How do I Display and Control a Remote Desktop using VNC

(VNC  = Virtual Network Computing). A very useful application--don't miss it.

VNC is a cross-platform utility that allows me to display a remote graphical desktop over a standard network connection. For example, I can use VNC on an MS Windows PC to display an X-window environment of my mighty Linux server downstairs, or the other way around. VNC will even run over a 56k modem networking, but probably only for fun or in emergency (too slow a connection for normal work).

Recent Mandrake or RH will have vnc on their distributions CD. The MS Windows version you have to download yourself. See http://www.uk.research.att.com/vnc/ for download information and more details.

On Linux, VNC consists of four commands: vncserver, vncviewer, vncpasswd, and vncconnect. I typically need just two of them: vncserver and vncviewer.  A brief description of the commands follows.

vncserver 
The server that has to be running on the host (remote) computer.  You start the server as the user whose desktop will be displayed (don't run the server as root or somebody else somebody may kidnap your computer!).

vncviewer 
The local application wich connects to the vncserver and displays the remote environment.  You need to know the password and ip address of the server to connect.

vncpasswd 
Password selection utility for vncserver. The server won't run without password (good behaviour). Therefore, if you don't select one, it will prompt you. Hence, I don't need to explicitly run vncpasswd.

vncconnect 
Tells vncserver to connect to a listening VNC viewer on the given computer and port. This way I can avoid giving anybody a password.

Xvnc 
A "master" program that I don't really need to run directly (vncserver and vncviewer are scripts which call Xvnc).

For a list of all available options I run: 
Xvnc -help

It is not recommenced to run the VNC server as root due to potential security issues. If you need root privileges, login as a user and then execute su

Two examples of "typical" sessions follow.

Example 1. Sitting at an MS Window computer, I can display an X environment from my Linux server, using the following sequence:

[start a DOS terminal and type in the following command] 
telnet my_linux_server_name 
[log in to your user account on Linux and type in it the following command] 
vncserver 
[provide a really good password of your choice when prompted; mine was "357+Simon&Garfunkel"] 
[re-enter the same password for confirmation] 
[watch the messages and note the screen number on which the server is started; mine was ":4"] 
[From the "Start" menu on the MS Windows computer, select "Programs" - "Vnc" - "Run VncViewer" 
[in the input box that appears, type the server ip address and screen number as shown on the next line] 
my_linux_server_ip_address:4 
[in the input box that appears type the password as follows] 
357+Simon&Garfunkel 
[an X-windows desktop should now appear on top of your MS Windows desktop] 
[do your work as you normally would in Xwindows] 
[when done, switch to the telnet session window and type in it the following two commands] 
vncserver - kill :4 
logout

Example 2.  Sitting at my Linux X desktop, I can display and remotely control an MS Windows computer screen. Hopefully, nobody else is using this MS Windows computer at the same time, because I move its mouse pointer.

[Walk to the MS Windows computer because you probably cannot telnet it] 
[From the "Start" menu, select "Programs" - "Vnc" - "Run WinVnc (app mode)" 
[From the "System Tray", click the mouse right button on the "Vnc" icon, and select "Properties"] 
[In the dialog box that appears, fill in the password. Leave the screen number on "auto".] 
[Walk back to your Linux desktop] 
[Start an X terminal and type in it] 
vncviewer ms_windows_server_name_or_ip 
[When prompted, type in the password] 
[a MS Windows desktop should now appear on top of your X] 
[do your work as you normally would on MS Windows] 
[When done, right click on the Vnc icon in the system tray and select "Close VNC".]


0 0
原创粉丝点击