



(12 ratings)
< How to start X sessions >
There are two ways to start the first X session: you either start the X Window System manually after logging in, or X starts automatically when your Linux system boots up. If your system is configured to start X automatically, you don't have to worry about the first X session: it's already running.
If you don't have a graphical login, you probably start X with the startx command after logging in:startx
The first X session you start runs on screen 0.
It does this by default, so when you start an X session, you don't have
to specifically tell it to run on screen 0. However, you can run the
second X session on screen 1, the third on screen 2, and so on. This is
how you tell X to run on screen 1:startx -- :1
Of course, to run X on screen 2, you'd use the command startx -- :2, and so on.
< Switching between X sessions >
You probably know you have several virtual terminals. On a default Linux configuration, you have command line sessions running on your first six virtual terminals. Your first X session is running on the seventh virtual terminal (screen 0). If you're running only one X session, all the terminals after terminal seven are empty.
As you probably guessed, the second X session runs in virtual terminal eight, the third session in virtual terminal nine, and so on. You switch between X screens the same way you switch between virtual terminals: Press Ctrl, Alt and the F key with the desired terminal's number.
For example, to switch from screen 0 to screen 1 (from the first X session to the second one), you'd press Ctrl + Alt + F8. To go back to the first X session, you use Ctrl + Alt + F7.
< Useful tips >
When starting multiple X sessions with startx, make sure you have a file called .xinitrc in your home directory. It's the file that controls things like what window manager is started. For more info about .xinitrc, have a look at the Changing the default window manager tuXfile.
Because
the default screen is 0, some graphical applications may get a bit
confused when using other screens. If you type an application's name at
the command line of a terminal emulator, the application may run on
screen 0 although you launch it from another screen. This isn't a
problem, though. Many applications have a command line option for
specifying the screen it runs on. For example, to run Gimp on screen 2,
you'd start it with:gimp --display :2
This is actually an advantage. You can launch the application from any X session or virtual terminal you want and send it to any X screen you like!
No one is forcing you to use the same window manager or configuration in all the X sessions. This is probably one of the reasons you'd want to run multiple X sessions at the same time: to be able to quickly switch between different window managers, resolutions, or color depths.
To have an X session with another color depth than the default one, you'd use the -depth option. For example, to run a second X session with a really ugly 8 bpp color depth, you'd type:startx -- :1 -depth 8
Of course there are much more options than just the -depth option. To get more help with startx, check out the manual page:man startx
20 Random Tutorials from the same category :
Using Emacs
Pipes - Get the most out of your shell
Unix And C/C++ Runtime Memory Management For Programmers
How to change a file's owner and group in Linux
What are the SUID, SGID and the Sticky Bits?
Viewing and searching the man pages
Introduction To Unix Signals Programming
How to use the most popular command in Unix - Grep
About your files on Linux
Linux file permissions
Debugging "C" And "C++" Programs Using "gdb"
Installing software from source in Linux
A Quick Introduction to Bash Programming - Part 1
Moving around in the Linux file system
Installing software from RPM packages
How to set Shell Environment Variables (bash shell)
An abbreviated description of the Linux Boot up process
Changing the default window manager
Building And Using Static And Shared "C" Libraries
Change from text login to graphical login













