Linux / UNIX: Run Multiple X Sessions

Posted on in Categories last updated April 28, 2010

How do I run multiple X Session under Linux or UNIX operating systems? How do I switch between X sessions?

The startx script initialize an X session. You can use the same to run multiple X session. Switch to console mode by pressing CTRL+ALT+F1. Provide your login details and type the following command to start X session:
startx -- :1
By default the first X session runs on screen 0. However, you can run the second X session on screen 1, the third on screen 2, and so on. The above startx command tell X to run on screen 1. To run X on screen 2, you’d use the command
startx -- :2

How Do I Switch Between X Sessions?

  1. To go back to the screen 0 user X session, press Ctrl+Alt+F7
  2. To go back to the screen 1 user X session press Ctrl+Alt+F8.
  3. To go back to the screen 2 user X session press Ctrl+Alt+F9.
  4. Please note that F7 to F12 identify six X sessions.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

5 comment

  1. When using KDE, you have the option to start a new session in the start menu. You are then presented with a new login screen.
    The annoying thing though, is that you have no info on who is already logged in into one of those additional X Sessions.

    1. Open a terminal shell (bash, xterm, etc). Type the letter “w”, press enter… Shows you who’s logged in. No matter what tty they’re logged in to. You don’t have to be root to run the command. It will even show remote users logged in to your machine.
      Cheers ;)

Leave a Comment