[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 5

startx Command

Purpose

Initializes an X session.

Syntax

startx [ -d Display:0 ] [ -t | -w ] [ -x Startup | [ -r Resources ] [ -m Window_Manager ] ] [ -wait ]

Description

The startx command streamlines the process of starting an X session.

The command does the following:

The startx command redirects X server and X client error messages to the file specified by the user's XERRORS environment variable. This process is useful for debugging and gives the X server a clean startup and shutdown appearance on a workstation.

If a startup script file name is not given at the command line with the -x option, then the startx command searches for a file specified by the user's XINITRC environment variable. If the XINITRC environment variable is not set, then the startx command searches the user's home directory for a file called .Xinit, .xinit, .Xinitrc, .xinitrc, or .xsession, respectively, to begin the X client programs.

If a startup file is not found, the startx command runs the Window Manager indicated at the command line with the -m option, or invokes the window manager mwm, twm, awm, or uwm after finding the associated configuration file (.mwmrc, .twmrc , .awmrc, or .uwmrc, respectively). If a window manager configuration file is not found in the user's home directory, startx initiates an Xterm client and the mwm window manager.

When a startup file is not found, the startx command also instructs the loading of the resources file given at the command line with the -r option, or a file from the user's home directory called .Xdefaults, .xdefaults, .Xresources, or .xresources, respectively. If an X resources file is not found, then the X session will not be personalized.

If a startup file exists for a workstation and no resources are loaded by the user, then the xinit command within the startx command attempts to load an .Xdefaults file.

The use of a workstation is assumed when the X session is initiated from /dev/lft*. If this is not the case, then the -t or -w option must be used.

Flags

-d Display:0 Specifies the display name of the X server to pass to the X clients during the process for startup.
-m Window_Manager Starts the Window Manager when no startup script is found.
-r Resources Loads the resources file when no startup script is found.
-t Starts X clients for an X terminal.
-w Starts the X server and X clients for an X window session on a workstation.
-wait Prevents the X session from being restarted when the xdm command invokes startx.
-x Startup Starts an X window session using the startup script.

Note: You can use one or both of the -m and -r options, or the -x option, but you cannot use the -x option with the -m and -r options. In the startup script, it is the responsibility of the user to start a window manager session, load X resources, and spawn X clients.

Examples

  1. To start an X session on a workstation, or an X terminal, enter:

    startx
  2. To force start an X session on a workstation, enter:

    startx -w
  3. To start an X session for an X terminal, and log off the user's telnet session, enter:

    startx; kill -9 $$
  4. To start an X session using the .xinitrc script, enter:

    startx -x .xinitrc
  5. To start an X session using the mwm window manager, enter:

    startx -m mwm

    However, if a startup script file is found, the -w option is ignored.

  6. In the startup script, it is the responsibility of the user to start a window manager, load X resources, and spawn X clients. The following is an example of an .xsession script.

    #!/bin/csh
     (mwm &)
     xrdb -load .Xdefaults
     (xclock -g 75x75+0+0 &)
     (xbiff -g 75x75+101-0 &)
     if ("/dev/lft*" == "`tty`") then
        aixterm -g 80x24+0+0 +ut -C -T `hostname`
     else
        aixterm -g 80x24+0+0 +ut -T `hostname`
     endif

For a workstation, the last line in the startup script should be a foreground aixterm command with the -C option for console messages.

For an X terminal, the last line in the startup script should be a foreground aixterm command without the -C option. In addition, because some X terminals do not terminate the telnet session upon closing, the user must exit the current telnet session before using hot keys to switch to the X session.

Also, the startx command can be used by the xdm command in the /usr/lib/X11/xdm/Xsession file. This provides the xdm command with the features of the startx command.

Files

The following file names have been historically used for the startup of an X session.

$HOME/.xerrors Where startx is to redirect error messages. By default, startx redirects errors to the .xerrors file in user's home directory.
$HOME/.Xinit,  
$HOME/.xinit,  
$HOME/.Xinitrc,  
$HOME/.xinitrc,  
$HOME/.xsession Used as a Startup file containing shell commands to start a window manager, load X resources, and spawn X clients.
$HOME/.Xdefaults,  
$HOME/.xresources Used as an X resources file loaded to set user preferences for X clients.
$HOME/.mwmrc An mwm configuration file.
$HOME/.twmrc A twm configuration file.
$HOME/.awmrc An awm configuration file.
$HOME/.uwmrc A uwm configuration file.
/dev/lft* The terminal, or tty, interface of a workstation's initial login shell.

Related Information

The mwm command, xinit command, xdm command, aixterm command, telnet, tn, or tn3270 command, X command, and xrdb command.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]