TrumanWong

startx

Used to start X Window

Supplementary instructions

startx command is used to start X Window. The program that actually starts X Window is xinit.

grammar

startx(parameter)

Parameters

  • Client and options: X client and options;
  • Servers and options: X servers and options.

Example

To start an X session on your workstation or X terminal, enter:

startx

To force an X session to start on the workstation, enter:

startx -w

To start an X session for an X terminal and log out of the user's telnet session, enter:

startx; kill -9 $

To start an X session using a .xinitrc script, enter:

startx -x .xinitrc

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. In the startup script, it is the user's responsibility to start the window manager, load X resources, and spawn the X client. Below is an example of a .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 workstations, the last line in the startup script should be the foreground aixterm command with the -C option for console information. For X terminals, the last line in the startup script should be the foreground aixterm command without the -C option. Additionally, because some X terminals do not terminate the telnet session when closed, the user must exit the current telnet session before using the hotkey to switch to the X session.

The xdm command in the /usr/lib/X11/xdm/Xsession file can also use the startx command. This provides the xdm command with the functionality of the startx command.

The following are the file names that are always used to start an X session.

$HOME/.xerrors Among them, startx is used to redirect error messages. By default, startx redirects errors to a .xerrors file in the user's home directory.
$HOME/.Xinit,
$HOME/.xinit,
$HOME/.Xinitrc,
$HOME/.xinitrc,
$HOME/.xsession serves as a "startup file" containing shell commands to start the window manager, load X resources, and spawn an X client.
$HOME/.Xdefaults,
$HOME/.xresources As loaded X resource files to set user preferences for the X client.
$HOME/.mwmrc mwm configuration file.
$HOME/.twmrc twm configuration file.
$HOME/.awmrc awm configuration file.
$HOME/.uwmrc uwm configuration file.
/dev/lft* Terminal or tty, workstation initial login shell interface.