A X server is a server because it serves a display and input devices to applications.
Applications like lxterminal
connect to that X server to request some service. For instance:
- Please draw a Window of that shape and size
- Please tell me what key the user presses and releases
They connect to the X server over a UNIX domain or ABSTRACT or TCP socket.
Similarly, the terminal emulator could be considered as a server for terminal applications.
With echo test > /dev/pts/12
, the echo
application can be seen as connecting to the terminal emulator (by way of a pseudo-terminal instead of a network socket, though here the connection is done by the shell redirection, not echo
) and requesting a service: please display test and move the cursor down.
Now, some terminal emulators including gnome-terminal and lxterminal have that (annoying IMO) feature where on first invocation they start a daemon process that handles future requests to open new terminal window.
Later invocations of those connect to that server (using that /run/user/1000/.lxterminal-socket-:0
UNIX domain socket in your case) to request a new terminal window, presumably to save resources or so that some information can be shared between terminal windows.
When you do:
cd /tmp && lxterminal -e vim
While there's already a lxterminal
running, that second invocation just tells the lxterminal
server to run vim
in a new window with the current directory changed to /tmp
.
See xterm
or rxvt
for terminal emulators that work in a more conventional way.
You can actually do that same with:
printf '%s\0' /tmp lxterminal -e vim |
socat -u - 'unix-connect:"/run/user/1000/.lxterminal-socket-:0"'
I find it annoying because that means only the first invocation inherits the environment (environment in the global sense, including umask
, cwd
, env vars...) of the caller, later invocations only get the cwd.
More on that in @JdeBP's fine answer at lxterminal in the netstat output