When I did the command above, X11 opened. I am perplexed. Did I run it? How can I be sure that I do not run any program when looking at things? I really hate the idea that reading a text file may execute a program. How is it programmable possible to make programs that executes when running a simple cat-command, or similar command?
If you run
file /tmp/:0
you should see that this is not a normal 'text' file but a socket. Aliasing ls
thus
ls -F
will help identify such files automatically in your shell.
machine:0 is an X display (the first display on 'machine')
I have never seen /tmp/:0 but it might be that your machine is configured so that all unmatched machine names map onto localhost.
You haven't executed anything, the X server will simply try and interpret any commands sent by cat as X instructions. It's like doing cat to an http address
The :0
thing is a socket refering to the X server. Programs use this socket to communicate with the X server (for example to draw a window). Reading from this socket somehow caused the server to activate. The X server must have been already running before you did this command.
This sounds like OSX 10.5 behaviour.
launchd listens on a socket '/tmp/launch-xxxxxx/:0'. The DISPLAY variable is set to tell X applications to write to that socket. When an X application opens the socket, launchd automatically starts 'X11.app' to provide the application with a display.
cat'ing the socket opens it and triggers X11.app. I don't think there are any other instances of that behaviour configured by default.