Unix Commands and Remote Login



next up previous contents index
Next: Adding xterm Windows Up: Your Workspace: xterm Previous: Copy and Paste

Unix Commands and Remote Login

Being able to run multiple windows becomes very useful when you use options to run specific commands with your xterm windows. For example, using xterm -e runs a program inside an xterm window, so that when the program terminates, the window closes. Your Unix command is the argument following the -e option. Here's some examples:   

% xterm -e vi .Xdefaults   	Edit .Xdefaults file in new window.    
% xterm -e rlogin theo   	Remote login with new window.    

The first line starts up a window running vi .Xdefaults. After you have completed your editing and you terminate vi, the window will close. The second line opens a window which automatically logs you onto the theoretical physics machine theo (as discussed in Chapter 3, Computer-Computer Communications). You can even avoid the hassle of entering your password and user ID when the window opens, if you have the same user ID on both machines and a .rhosts file in your home directory on the remote machine with the name of your local machine in it.

As also discussed in Chapter 3, you can use the commands telnet or tn3270 in a window to log onto machines that do not have rlogin available. For example, to connect to an IBM mainframe running the VMS operating system and do it using a separate window:

% xterm -e tn3270 osuvm   	Emulate 3270 terminal for VMS.     

It is somewhat of a fine point, but one which can be frustrating for those who care, that when you give commands with xterm, they run directly without opening a shell (starting an independent command line interpreter). If you want to run a command inside a shell, you must explicitly open the shell and then run the command:

% xterm -e /bin/sh -c "ls /usr/*"   	Open a shell, execute command.     

This opens the Borne shell, lists all usr files in a window (the wild card * is evaluated by the shell), and then runs mail for the user. The quotes are optional here but are good practice for those times when several commands are placed on the line as a group.



next up previous contents index
Next: Adding xterm Windows Up: Your Workspace: xterm Previous: Copy and Paste