STARTX(1)

๐Ÿ‘‘ STARTX(1) โ€” like, the manual page for startx, bestie

okay so real talk: this is the startx(1) page from the General Commands Manual, and it ships with X Version 11 / xinit 1.4.4 (we'll gush about that at the end, don't worry ๐Ÿ’–). It's the little script that could โ€” your glowy screen era starts here. โœจ


๐ŸŒธ NAME ๐ŸŒธ

startx โ€” initialize an X session

like, it starts the X. that's the whole job. iconic behavior only.


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

startx [ [ client ] options ... ] [ -- [ server ] [ display ] options
... ]

so yes, there are brackets inside brackets inside brackets. it's giving nesting doll realness ๐Ÿช† but honestly? you'll probably just type startx and move on with your life.


โœจ DESCRIPTION โœจ

okay so the startx script is a front end to xinit(1) โ€” like, xinit is the main character and startx is the hype girl who makes it presentable. it gives you a "somewhat nicer user interface" for running a single session of the X Window System. and bestie, most of the time people run it with literally no arguments at all. no cap.

Whatever arguments you put right after the startx command get used to start a client, exactly the same way xinit(1) does it. ๐Ÿ’…

Then there's the special argument -- โ€” that's the bouncer at the door ๐Ÿšช it marks the end of client arguments and the beginning of server options. so anything after -- is server business. Super convenient to specify server options with startx so you can change them per-session, which is lowkey the whole point. Some examples of specifying server arguments follow โ€” but fr fr, consult the manual page for your X server to figure out which arguments are actually legal, because we are not out here guessing. ๐Ÿ™ˆ

startx -- -depth 16
startx -- -dpi 100
startx -- -layout Multihead

๐Ÿฆ‹ which client though?

To determine the client to run, startx goes down a checklist like it's doing a vibe check:

  • first it checks the environment variable XINITRC for a filename.
  • if that variable is unset, or does not contain a filename, it looks for a file called .xinitrc in the user's home directory.
  • if that's not found, it uses the file xinitrc in the xinit library directory.

but wait โ€” if you gave command line client options, those override this whole behavior and it reverts to the plain xinit(1) behavior. periodt.

๐Ÿงš which server though?

Same energy for the server:

  • startx checks the environment variable XSERVERRC for a filename.
  • if that variable is unset, or does not contain a filename, it looks for a file called .xserverrc in the user's home directory.
  • if that's not found, it uses the file xserverrc in the xinit library directory.

and again โ€” if command line server options are given, they override this behavior and it reverts to the xinit(1) behavior.

ngl, users rarely need to provide a .xserverrc file. like... rarely rarely. don't make one just to feel something. ๐Ÿซถ

See the xinit(1) manual page for more details on the arguments โ€” it's the source material, bestie.

The system-wide xinitrc and xserverrc files live in the /usr/libexec/xinit directory. ๐Ÿ“โœจ

๐Ÿ’œ what .xinitrc actually is

The .xinitrc is typically a shell script which starts many clients according to the user's preference. When this shell script exits, startx kills the server and performs any other session shutdown needed. so like, the script ending = the whole party's over ๐Ÿ’€

Most of the clients started by .xinitrc should be run in the background (that's the &, iykyk). The last client should run in the foreground; when it exits, the session will exit. People often choose a session manager, a window manager, or an xterm as the ''magic'' client. ๐Ÿ‘‘ that's the one holding the whole session together.


๐ŸŒˆ EXAMPLE ๐ŸŒˆ

Below is a sample .xinitrc that starts several applications 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 shut down X. cute, clean, and it works. ๐ŸŽ€

xrdb -load $HOME/.Xresources
xsetroot -solid gray &
xbiff -geometry -430+5 &
oclock -geometry 75x75-0-0 &
xload -geometry -80-0 &
xterm -geometry +0+60 -ls &
xterm -geometry +0-100 &
xconsole -geometry -0+0 -fn 5x7 &
exec twm

notice how everything's got a & except that final exec twm? that's the magic client, bestie. it's the one in the foreground. ๐Ÿ’…


๐Ÿ“ ENVIRONMENT VARIABLES ๐Ÿ“

  • DISPLAY โ€” This variable gets set to the name of the display to which clients should connect. Note that this gets set, not read. so it's output, not input. she's a giver. ๐Ÿซถ
  • XAUTHORITY โ€” This variable, if not already defined, gets set to $(HOME)/.Xauthority. This is to prevent the X server, if not given the -auth argument, from automatically setting up insecure host-based authentication for the local host. ๐Ÿšจ like, security thing, pay attention. See the Xserver(1) and Xsecurity(7) manual pages for more information on X client/server authentication.
  • XINITRC โ€” This variable should contain the location of an xinitrc file. If unset, $(HOME)/.xinitrc or /usr/libexec/xinit/xinitrc will be used.
  • XSERVERRC โ€” This variable should contain the location of an xserver file. If unset, $(HOME)/.xserverrc or /usr/libexec/xinit/xserverrc will be used.

๐Ÿงš FILES ๐Ÿงš

  • $(HOME)/.xinitrc โ€” Client to run. Typically a shell script which runs many programs in the background.
  • $(HOME)/.xserverrc โ€” Server to run. The default is X.
  • /usr/libexec/xinit/xinitrc โ€” Client to run if the user has no .xinitrc file.
  • /usr/libexec/xinit/xserverrc โ€” Server to run if the user has no .xserverrc file.

๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

xinit(1), X(7), Xserver(1), Xorg(1), xorg.conf(5)

go read them, they're literally the lore. ๐Ÿ“š


X Version 11 ยท xinit 1.4.4 ยท STARTX(1) โ€” and that's the whole page, bestie!! ๐Ÿ’–โœจ you read the entire thing, I'm so proud of you. now go type startx and slay. ๐Ÿ’…๐ŸŽ€๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from