Real unix sysadmin may want to use X-window sometimes, like when you want to analyze network packet or install Oracle. So, here it is a bash function to run just a single command. 2 lines are commented out because Oracle installer didn't work. I'm sure most other commands are fine with these 2 lines. Tested on Solaris10 and RedHat4.
vncexec () { \mv -i ~/.vnc/xstartup{,.$$}; echo "$* &" >~/.vnc/xstartup; # echo "onecommand=\$!" >>~/.vnc/xstartup; echo "twm &" >>~/.vnc/xstartup; # echo "wait \$onecommand; vncserver -kill \$DISPLAY" >>~/.vnc/xstartup; chmod u+x ~/.vnc/xstartup; vncserver -geometry 1024x992; \mv -i ~/.vnc/xstartup{.$$,} }
Here's a sample how you run wireshark.
$ vncexec wireshark -r $PWD/ssl.snoop
Install oracle.
$ vncexec sh -x ~oracleidm/Disk1/runInstaller