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

Commands Reference, Volume 6

xinit Command

Purpose

Initializes the X Window System.

Syntax

xinit [ [ Client Options ] [ - - [ Server ] [ Display Options ]

Description

The xinit command starts the AIXwindows server and a first client program on systems that cannot start X directly from /etc/init or in environments that use multiple window systems. When this first client exits, the xinit command stops the X server and then ends.

If no specific client program is given on the command line, the xinit command looks for a file to run to start up client programs. The xinit command looks for the $XINITRC environment variable. If the file is not there, it then looks for the $HOME/.xinitrc file. If it still does not find the file, it follows these steps:

  1. The xinit command looks next to /usr/lib/X11/$LANG/xinitrc.
  2. Next, it looks to /usr/lpp/X11/defaults/$LANG/xinitrc.
  3. And finally, it looks to /usr/lpp/X11/defaults/xinitrc.

If no such file exists, xinit uses the following as a default:

aixterm \-geometry +1+1 \-n login \-display :0

If no specific server program is given on the command line, the xinit command follows these steps:

  1. The xinit command looks for a file to run as a shell script to start up the server. The xinit command looks for files first in the $XSERVERRC environment variable.
  2. If the file is not there, it looks for the $HOME/.xserverrc file.
  3. If it still does not find the $HOME/.xserverrc file, it looks next to /usr/lpp/X11/defaults/xserverrc file.
  4. And finally, if it does not find any of the previous files, the xinit command runs the X command to start the X server and uses the following as a default:

    X :0

Note that this assumes that there is a program named X in the current search path. However, servers are usually named Xdisplaytype where displaytype is the type of graphics display which is driven by this server. The site administrator should, therefore, make a link to the appropriate type of server on the machine, or create a shell script that runs the xinit command with the appropriate server.

Note: If you attempt to start AIXwindows without an available pointer device, such as a mouse or a tablet, AIXwindows will not open. Some devices can be plugged in but not defined and thus not available to the system, as well as the reverse.

An important point is that programs which are run by .xinitrc should be run in the background if they do not exit right away, so that they do not prevent other programs from starting up. However, the last long-lived program started (usually a window manager or terminal emulator) should be left in the foreground so that the script does not exit (which indicates that the user is done and that xinit should exit).

An alternate client and/or server may be specified on the command line. The desired client program and its arguments should be given as the first command line arguments to xinit. To specify a particular server command line, add a -- (double dash) to the xinit command line (after any client and arguments) followed by the desired server command.

Both the client program name and the server program name must begin with a / (slash) or a . (period). Otherwise, they are treated as an arguments to be added to their respective startup lines. This makes it possible to add arguments (for example, foreground and background colors) without having to retype the whole command line.

If a clear server name is not given and the first argument following the -- (double dash) is a : (colon) followed by a number, xinit uses that number as the display number instead of zero. All remaining arguments are added to the server command line.

The following environment variables are used with the xinit command:

DISPLAY This variable gets set to the name of the display to which clients should connect.
XINITRC This variable specifies an init file containing shell commands to start up the initial windows. By default, .xinitrc in the home directory is used.
Options List any option you wish that is available to the client you specified.
Client Specify the client with which you are working. For example, xterm or aixterm. The client you specify must begin with a . (dot) or a / (slash).
Server Use any valid xserver. The server you specify must begin with a . (dot) or a / (slash).

Examples

  1. To start up a server named X and run the user's xinitrc program, if it exists, or else start an aixterm command enter:

    xinit
  2. To start a specific type of server on an alternate display, enter:

    xinit -- /usr/bin/X11/X qdss:1
  3. To start up a server named X, and add the given arguments to the default xinitrc or aixterm command, enter:

    xinit -geometry =80x65+10+10 -fn 8x13 -j -fg white -bg navy
  4. To use the command /Xsun -l -c to start the server and add the arguments -e widgets to the default xinitrc or aixterm command, enter:

    xinit -e widgets -- ./Xsun -l -c
  5. To start a server named X on display 1 with the arguments -a 2 -t 5, then start a remote shell on the machine fasthost in which it runs the command cpupig, telling it to display back on the local workstation, enter:

    xinit /usr/ucb/rsh fasthost cpupig -display ws:1 -- :1 -a 2 -t 5
  6. The following sample of the .xinitrc script starts a clock, several terminals, and leaves the window manager running as the last application. Assuming that the window manager has been configured properly, the user then chooses the Exit menu item to end the AIXwindows session.

    xrdb -load $HOME/.Xresources
    xsetroot -solid gray &
    xclock -g 50x50-0+0 -bw 0 &
    xload -g 50x50-50+0 -bw 0 &
    xterm -g 80x24+0+0 &
    xterm -g 80x24+0-0 &
    mwm
  7. Sites that want to create a common startup environment could simply create a default .xinitrc script that references a site-wide startup file:

    #!/bin/sh . /usr/local/lib/site.xinitrc
  8. Another approach is to write a script that starts the xinit command with a specific shell script. Such scripts are usually named x11, xstart, or startx and are a convenient way to provide a simple interface for novice users:

    #!/bin/sh xinit /usr/local/lib/site.xinitrc -- /usr/bin/X11/X bc

Files

.xinitrc Contains the default client script files.
aixterm Contains the command the client runs if .xinitrc does not exist.
.xserverrc Contains the default server script.
X Contains the command the server runs if .xserverrc does not exist.

Related Information

The startx command, X command.

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