Virtual Terminals
Linux, FreeBSD, and many other modern Unix kernels support a virtual terminal.(VT) (or virtual console ) capability, which provides independent virtual video cards. The monitor, keyboard, mouse, and physical video card are associated with only one VT at a time, and each virtual video card can be in a different display mode—some may be in character mode while others are in graphical mode. This enables multiple X servers and nongraphical sessions to be active at the same time.
When you are connected to a virtual terminal that isn’t running an X server, you can use Alt-LeftArrow to go to the previous VT and use Alt-RightArrow to switch to the next VT. FreeBSD provides a very similar VT capability, except that the VTs are numbered starting at zero, and the key combination to switch VTs when in character mode is Alt-Fx .
NOTE: Although most kernels support more than 12 virtual terminals, this capability is rarely used because you can’t usually use the keyboard to go directly to higher-numbered Vts.
Starting a Raw X Server Manually
1. The simplest way to start an X server is also the least-used technique: simply type the name of the server at a shell prompt:
$ X
You must enter “X” as a capital letter.
2.If an X server is already running on display :0 , you will get an error message, because the network port will already be in use. In that case, you can give the new X server a different display number:
$ X :1
3 .By default, the X server will start on the first unused VT (usually VT8). You can
request a specific VT by specifying it on the command line:
$ X :1 vt10
4. You can also specify that a particular configuration file should be used, or a particular ServerLayout within a configuration file:
$ X :1 -config configFile
$ X :1 -layout layoutName
NOTE: The downside to starting the X server this way is that no clients are started. Until you start some manually, you’ll be left staring at a blank screen with only a mouse pointer to amuse yourself.
4.You can start the X server and a client at the same time like this:
$ X :1 -terminate & sleep 2 ; DISPLAY=:1 xterm
Using a Display Manager to Start the X
Server
5 .Three display managers are in common use. The biggest difference between them is the toolkit upon which they are built:
• GDM: GNOME Display Manager (built on GTK)
• KDM: KDE Display Manager (Qt)
• XDM: X Display Manager (Xt)
6.You may be able to recognize the display manager used on your system by its appearance, since each toolkit has a distinctive look. Alternately, you can search the process table to see what’s running, using the following:
$ ps -e | grep '[gkx]dm'
7. When you boot into any runlevel that does not start X automatically, you can start
the display manager manually by typing the command name at a root shell prompt:
# gdm
NOTE: By default, Debian-based systems (including Ubuntu) start the display
manager in all runlevels. You can easily disable the startup of the display
manager in runlevel 3 by executing these commands:
# update-rc.d -f gdm remove
# update-rc.d gdm start 31 2 4 5 . stop 31 1 3 .
Started Directly by init
In some Linux distributions, the display manager is directly started by init . For example, in Redhat based systems /etc/inittab, you will find this entry:
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
The script /etc/X11/prefdm will execute /usr/sbin/autologin to automatically log in one user if that feature has been set up. Otherwise, it will start one of the display managers (GDM, KDM, or XDM) depending on the specification in /etc/sysconfig/desktop . If that file does not exist, then the first display manager found in alphabetical order will be used.
Since init has been set up to respawn the display manager automatically, it is relatively easy to load and test changes to the display manager configuration file—just kill the display manager! If you’re using XDM or KDM, you can kill the display manager by name:
# killall xdm
NOTE: Killing the display manager will also kill all the display manager’s child processes, including X serversso if you do this through the graphical interface, expect your session to disappear!
GDM is a wrapper script for gdm-binary, so if your system uses GDM , you’d have to kill the display manager with the following:
# killall gdm-binary
You can restart GDM immediately using its restart script:
# gdm-restart
you can specify that a restart should take place as soon as everyone is logged out:
# gdm-safe-restart
On a SUSE system, the display manager is started by
/etc/rc.d/rc5.d/S17xdm
(which is a symbolic link to /etc/rc.d/xdm ).
Similar to the prefdm script used by Fedora, this script finds your preferred display
manager using a configuration file—in this case,
/etc/sysconfig/displaymanager
(or it uses XDM if that file is missing.)
Since this is a regular init script, it is executed only once at startup; when the display manager terminates, it will not be restarted. After editing the display manager configuration file, you can reinvoke the XDM init script using the restart option to put your changes into effect:
# /etc/X11/xdm restart
Or you can use the SUSE shortcut:
# rcxdm restart
Starting Multiple X Servers Using a Display
Manager
Starting Multiple X Servers Using XDM
XDM and older versions of KDM (pre-3.4) use the Xservers file to configure the number of servers started by the display manager.
Open /etc/X11/xdm/Xservers, /opt/kde3/share/config/kdm/Xservers
To start additional X servers, simply add lines at the bottom of this file:
:0 local /usr/bin/X // This is the default line.
Add the lines
:1 local /usr/bin/X :1 vt8
:2 local /usr/bin/X :2 vt9
If you wish to specify a different configuration file for one of the X servers, you can
add a -config argument to the command:
:3 local /usr/bin/X -config configgile :3 vt10
Starting Multiple X Servers Using KDM
If you’re using KDE 3.4 or higher, the local X server configuration is controlled by
the kdmrc file
# /usr/share/config/kdm/kdmrc
In the [General] section of that file, you can specify a list of local displays to be started by adding a StaticServers key:
StaticServers=:0,:1,:2
If this line is missing, the default is to start only display :0 .
Starting Multiple X Servers Using GDM
GDM is configured using two files; the first specifies default values, which may be
overwritten when GDM is updated, and the second provides local values, which are
never overwritten.
/usr/share/gdm/defaults.conf - Defaults
/etc/gdm/custom.conf – Local Values
# vi /usr/share/gdm/defaults.conf
Go to the section
[servers]
0=Standard
1=Standard // Thsi will start second X in
If you wish to use a different configuration for a specific display, you can add a new
configuration section to the local configuration file:
[server-LowRes]
name=Low-Resolution Server
command=/usr/bin/X -config /etc/X11/xorg.conf-lowres
flexible=false
Then specify that configuration for one of your displays:
[servers]
0=Standard
1=Standard
2=Standard
3=LowRes
Recent versions of both GDM and KDM are capable of starting additional X servers
on demand. This is useful when you occasionally want to use multiple X servers but
don’t want the extra overhead when a single X server only is in use. The GNOME
developers call these additional servers flexible servers; the KDE folks call them
reserve servers.
$ gdmflexiserver
gdmflexiserver can also start a nested X server (using Xnest) and present a session
login prompt there:
$ gdmflexiserver -n
Starting Additional X Servers Using KDM
To start multiple KDE desktop on boot open kdmrc file and enter the following.
ReserveServers=:3,:4,:5
The xinit utility can be used to start an X server with specified clients, but the startx wrapper script provides a friendlier interface. After logging in at a character-based login prompt, simply execute:
$ startx
You can explicitly specify a client to be started:
startx /usr/bin/xterm -bg yellow -geometry 180x50
Switching VTs from the Shell Prompt
xdpyinfo
We can switch the virtual terminals using one of the following command.
$ switchto 7
Or:
$ chvt 7
We can also use this command Remotely.
Starting X Within X
To start Xnest on the current display, use the following:
$ Xnest :1
To start Xnest with a particular client, you can use the startx script:
$ startx /usr/bin/startkde -- /usr/bin/Xnest :1
To start Xnest with two screens of 600 * 400 pixels, use the following:
$ Xnest -scrns 2 -geometry 600x400 :1
For many applications it’s desirable to have the X server exit when the last client disconnects. This is configured by adding the -terminate option to the X command line:
$ X -terminate
Let the X Server Configure Itself
The X.org server can, in most cases, probe, guess, and assume enough about the display configuration to start without a configuration file. Even better, it can generate a basic configuration file, if you specify the -configure option on the server command line:
# X -configure
If you’re already running the X server, you can specify an alternate display number
(such as :1 ) on the command line:
# X -configure :1
The X server will gather as much information as possible by probing the hardware,
and will then write the configuration file to /root/xorg.conf.new .
You can test the configuration file by manually specifying it on the command line:
# X -config /root/xorg.conf.new
If the server appears to start and then immediately exits, while displaying
the message Fatal server error: failed to initialize core devices, then
your configuration may be fine except for the pointer device. Try telling
the X server to continue even if the pointer cannot be opened:
# X -config /root/xorg.conf.new -allowMouseOpenFail
Nice one vasanth..Keep on writing....
ReplyDelete@Jayanth.S Thank you Jayanth. I am in Research with Regular Expressions in UNIX Apache,Perl, etc.
ReplyDelete