Linux / UNIX: Run Multiple X Sessions

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.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 5 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • Stjujsckij Nickolaj Apr 28, 2010 @ 9:34

    Or one could just use Qingy: http://qingy.sourceforge.net/

  • Steven Apr 28, 2010 @ 15:42

    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.

    • Daemon_ZOGG May 25, 2010 @ 4:05

      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 ;)

  • Ex-Opesa Apr 29, 2010 @ 3:20

    Thanks for the info! I didn’t know that^^

  • yannick Feb 2, 2011 @ 13:29

    Hello,

    If You want launch a simple Xorg session with the next command line :

    # Xorg :0 (control+alt+F7)
    # Xorg :1 (control+alt+F8)

    (which is lauched by startx — :1)

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum