<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:axle="http://www.cs.odu.edu/~zeil/axle" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns0="http://www.cs.odu.edu/~zeil/axle" mode="ignore" ns0:xlinkuri="open/unix.dbk" ns0:xpath="/html" ns0:page="unix" foo="0 " ns0:last="/cocoon/~cs252/open/unix/section-8.2.html"><head><title>An Introduction to Unix</title><link type="text/css" href="_axle/docbookstyle.css" rel="stylesheet"/><link type="text/css" href="_axle/cppformat.css" rel="stylesheet"/><link type="text/css" href="_axle/overrides.css" rel="stylesheet"/><script src="_axle/docbook.js"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html" title="Next" rel="next"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-7.2.html" title="Prev" rel="prev"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html" title="Up" rel="up"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html" title="First" rel="first"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html" title="Last" rel="last"/><script>function gotoNext() {top.location.href="/cocoon/~cs252/open/unix/section-8.2.html";}
function gotoPrev() {top.location.href="/cocoon/~cs252/open/unix/section-7.2.html";}
function gotoUp() {top.location.href="/cocoon/~cs252/open/unix/unix.html";}
</script><xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="stylesheet" href="_axle/navigation.css" type="text/css"/><xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml" src="_axle/navigation.js"/></head><body><table width="100%" class="navigationBar"><tr class="navigationBar"><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="First" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html"><img class="navigationBar" src="_axle/first.gif" alt="First"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Prev" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-7.2.html"><img class="navigationBar" src="_axle/prev.gif" alt="Prev"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Up" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html"><img class="navigationBar" src="_axle/up.gif" alt="Up"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Next" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html"><img class="navigationBar" src="_axle/next.gif" alt="Next"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Last" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html"><img class="navigationBar" src="_axle/last.gif" alt="Last"/></a></td><td class="navigationBar"/><td width="5%" class="navigationBar"><a class="navigationBar" title="CS252 Home" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/directory/announcements.html"><img class="navigationBar" src="_axle/home.gif" alt="CS252 Home"/></a></td><td width="5%" class="navigationBar"><a class="navigationBar" title="discuss this page" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/forum/getXPath/open/unix/section-8.html"><img class="navigationBar" src="_axle/forum.gif" alt="discuss this page"/></a></td></tr></table><br/><script type="text/javascript">
checkForAnchorOnOtherPage('section-1','unix');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mainmini','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.1.1','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('displays','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('networks','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('taleof2','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.2.1','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pcrev','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref1','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref1_live','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref2','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref2_live','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote1','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote2','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mswin','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('reflections','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref3','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref3_live','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote3','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('ssh','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref4','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref4_live','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('puttyConnect','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('sshConnect','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote4','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('login','login');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('termtypes','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref5','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref5_live','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote5','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.7','section-1.7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.8','section-1.8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.1','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref6','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref6_live','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref7','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref7_live','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('basicFileCmds','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref8','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref8_live','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote8','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cmdlist','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('session','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('rlogin','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('filemanip','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cdcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('findcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('lsa','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('lsF','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pwdcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('textmanip','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('catcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('morecmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('printing','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote6','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote7','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.2','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref9','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref9_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('paths','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref10','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref10_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote10','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('specialChar','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cmdpatterns','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref11','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref11_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('wildcards','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref12','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref12_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote12','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('regexp','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('grepregexps','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref13','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref13_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref14','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref14_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote13','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote14','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('sedregexps','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref15','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref15_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref16','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref16_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote15','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote16','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote11','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('quoting','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref17','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref17_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote17','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote9','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.3','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref18','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref18_live','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('redirect','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('piping','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xargs','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('find','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote18','section-2.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4.1','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref19','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref19_live','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote19','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4.2','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref20','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref20_live','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote20','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('umask','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4.4','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vim','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref21','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref21_live','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.1','section-3.1');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.2','section-3.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.3','section-3.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('markregion','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref22','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref22_live','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote22','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.5','section-3.5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.6','section-3.6');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote21','section-3.6');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.1','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('twin','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('icewin','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('starwin','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('connections','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('runningx','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref23','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref23_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchTheServer','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('creatingsession','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.2.1.2','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.2.1.3','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref24','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref24_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote24','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.2.1.4','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref25','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref25_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote25','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchClient','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref26','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref26_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchViaSsh','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref27','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref27_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote27','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchViaPutty','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref28','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref28_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote28','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xlaunch-sessions','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xwin32-sessions','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref29','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref29_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote29','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote26','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote23','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.3','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xappl','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xtrouble','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cannotOpen','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('firewall','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref30','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref30_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref31','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref31_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref32','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref32_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote30','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote31','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote32','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xforwarding','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xfast','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.5.4.1','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.5.4.2','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xtermFont','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('connect-localhost','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('refusedByServer','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('alternatives','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('RDP','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vnc','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vncx','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.2','section-4.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacsinx','section-4.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacsintelnet','section-4.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1.1','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1.2','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mailcommand','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mailsend','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1.3.2','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref33','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref33_live','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote33','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('popmail','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.2','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pinemain','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pinecompose','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pineindex','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-6','section-6');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xfermode','xfermode');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xfersamba','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref34','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref34_live','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote34','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('internetftp','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('anonprivateftp','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref35','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref35_live','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote35','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('ftpclient','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref36','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref36_live','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref37','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref37_live','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote36','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote37','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xferproblems','xferproblems');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('dostounix','xferproblems');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('unixtodos','xferproblems');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compshell','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref38','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref38_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cStructure','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref39','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref39_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fig:compilation','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1.1.1.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1.1.1.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote39','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compilingSingle','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compilingMultiple','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compilerOptions','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref40','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref40_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref41','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref41_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote40','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote41','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote38','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('errmsgs','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('capturing','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref42','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref42_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote42','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('understanding','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('javacomp','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref43','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref43_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('jproject','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote43','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1.4','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacserr','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacs-next-error','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref44','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref44_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote44','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vimcompile','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vimscreen','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref45','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref45_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('artificial-targets','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('writingMakefiles','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2.5','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote45','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref46','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref46_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref47','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref47_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote46','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote47','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3.3','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('gdbmode','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref48','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref48_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref49','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref49_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote48','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote49','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.2','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.2.1','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.2.2','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('gdbxfig','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('dddfig','section-7.2');
</script><div class="sect1" id="section-8" ns0:xpath="//*[@id='section-8']" ns0:page="section-8" ns0:next="/cocoon/~cs252/open/unix/section-8.2.html" ns0:prev="/cocoon/~cs252/open/unix/section-7.2.html" ns0:up="/cocoon/~cs252/open/unix/unix.html" foo="0 " ns0:last="/cocoon/~cs252/open/unix/section-8.2.html" ns0:first="/cocoon/~cs252/open/unix/unix.html"><div class="info_sect1"><div class="title_sect2">8. Shell Games</div></div><div class="TOC">Contents:<div class="TOC-section1"><a href="#section-8.1">8.1 Environment Variables</a></div><div class="TOC-section2"><a href="#loginCustom">8.1.1 Startup Customizations</a></div><div class="TOC-section2"><a href="#xCustom">8.1.2 Customizing X Application Appearance</a></div><div class="TOC-section2"><a href="#programCustom">8.1.3 Program Customizations</a></div><div class="TOC-section1"><a href="section-8.2.html#section-8.2">8.2 Scripting</a></div><div class="TOC-section2"><a href="section-8.2.html#section-8.2.1">8.2.1 Parameters</a></div><div class="TOC-section2"><a href="section-8.2.html#controlflow">8.2.2 Control Flow</a></div><div class="TOC-section2"><a href="section-8.2.html#section-8.2.3">8.2.3 The <span class="code">test</span> and <span class="code">expr</span> Programs</a></div><div class="TOC-section2"><a href="section-8.2.html#section-8.2.4">8.2.4 Scripting Example: The Student Test Manager</a></div><div class="TOC-section2"><a href="section-8.2.html#scriptDebugging">8.2.5 Debugging Your Scripts</a></div></div><div class="sect2" axle:nopage="1" id="section-8.1"><div class="info_sect2"><div class="title_sect3">8.1. Environment Variables</div></div><div class="TOC">Contents:<div class="TOC-section2"><a href="#loginCustom">8.1.1 Startup Customizations</a></div><div class="TOC-section2"><a href="#xCustom">8.1.2 Customizing X Application Appearance</a></div><div class="TOC-section2"><a href="#programCustom">8.1.3 Program Customizations</a></div></div><p class="para">Although you may not have thought of it as such, the Unix commands that you
type into your keyboard consititute a programming language. This
language is interpreted by a program called a <span class="firstterm">shell</span>.</p><p class="para">The Unix operating system is positively overrun with different shell
languages. The C-shell (<span class="code">csh</span>) or TC-shell  (<span class="code">tcsh</span>) that you
have probably been using
as your primary means of interaction is just one example. And,
although we have not touched on it yet, that is a full programming
language, including control flow instructions for branching and
loops.</p><p class="para"><span class="code">csh</span> and <span class="code">tcsh</span> constitute one family of commonly used
shells. They languages they accept are nearly identical. <span class="code">tcsh</span>
adds features that are of especial use when typing commands directly
to the shell. <span class="code">csh</span> is preferred when writing
<span class="firstterm">scripts</span>, short programs in the shell language, if only because
<span class="code">csh</span> is more likely to be installed on any given Unix system.</p><p class="para">Another family is the <span class="code">sh</span> family, which contains <span class="code">sh</span>,
<span class="code">bsh</span>, and <span class="code">bash</span>.
<span class="code">sh</span> is commonly used for writing scripts but
lacks some of the conveniences we would want in an interactive
shell. <span class="code">bsh</span> is the <span class="quote">
      &#8220;Bourne shell&#8221;
    </span> (named for its inventor), and
<span class="code">bash</span>, the default interactive shell for Linux and CygWin, is the
<span class="quote">
      &#8220;Bourne Again shell&#8221;
    </span>.</p><p class="para">These are by no means the only shell or scripting languages available
for Unix, but they'll do for now.</p><p class="para">What distinguishes these shell languages from more general-purpose
programming languages is their emphasis on simplicity. Scripting languages are designed to permit immediate translation. If, every time you typed a command,
you had to wait while a full-fledged compiler was loaded and executed
to process the characters you had typed, the time delays would have
you screaming in frustration. Instead, these languages are designed to
very quickly determine (usually by examining the first word you typed)
 if the command is a special command <span class="quote">
      &#8220;built in&#8221;
    </span> to the
shell. Anything else is a program to be launched.</p><p class="para">The command <span class="code">type</span> can be used to determine if a given word
represents a built-in shell command, a program (and if so, where that
program is located), or something else. Try logging in and giving the
following commands:
<div class="programlisting">
type g++
type cp
type echo
type more
type if
type type
type foobar
</div></p><p class="para">We'll concentrate on the <span class="code">csh</span> for scripting
purposes, with some notes on how <span class="code">sh</span>-like languages, including
<span class="code">bash</span>, differ from <span class="code">csh</span>.</p><p class="para">In any programming language, we expect to have variable names, and
shells are no exception. A typical shell variable name begins with an
alphabetic character and continues with zero or more alphanumeric
characters. Oddly enough, when we want to get the <span class="emphasis">value</span> of a
shell variable, we add a $ to the front of it.</p><p class="para">Try this:
<table border="1"><tr xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML"><th>csh, tcsh</th><th>sh, bash</th></tr><tr xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML"><td align="top"><div class="programlisting">
set A=hello
echo $A
</div></td><td align="top"><div class="programlisting">
A=hello
echo $A
</div></td></tr></table>
and the <span class="code">echo</span> command will produce the string <span class="quote">
      &#8220;Hello&#8221;
    </span>.</p><p class="para">All shell variables hold strings, although in selected instances we
may be able to interpret those strings as numbers.</p><p class="para">The scope rules for shell variables are a bit odd. Most variables are
local to the process where they are assigned. For example, look at the
following command sequence:
<table border="1"><tr xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML"><th>csh, tcsh</th><th>sh, bash</th></tr><tr xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML"><td align="top"><div class="screen"><span class="userinput">
set A=hello
echo $A
<span class="code">hello</span>
csh
echo $A
<span class="code">A: undefined variable</span>
exit
echo $A
<span class="code">hello</span>
</span></div></td><td align="top"><div class="screen"><span class="userinput">
A=hello
echo $A
<span class="code">hello</span>
sh
echo $A
<span class="code">A: undefined variable</span>
exit
echo $A
<span class="code">hello</span>
</span></div></td></tr></table>
What's going on? The first <span class="code">=</span> and <span class="code">echo</span> are obvious enough. We
set <span class="code">A</span> to a value and then printed it. In the next line, we start
another copy of the shell running (<span class="code">csh</span> or <span class="code">sh</span>). This runs as
a separate process (the old one is temporarily suspended). This new
<span class="quote">
      &#8220;child&#8221;
    </span> process does not inherit the variable <span class="code">A</span>, so when we try
to print it, we are told that <span class="code">A</span> is undefined. The <span class="code">exit</span>
command shuts down the child process, returning us to the original
(parent) process where we had previously defined <span class="code">A</span>, and so we
were able to print it again.</p><p class="para">If we prefer, we can make a variable exported, meaning that its value
<span class="emphasis">will</span> be seen by child processes. In <span class="code">csh</span> and <span class="code">tcsh</span> this
is done by using <span class="code">setenv</span> instead of <span class="code">set</span>. In <span class="code">sh</span> and <span class="code">bash</span> this is done by naming the variable in an
<span class="code">export</span> command.
<table border="1"><tr xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML"><th>csh, tcsh</th><th>sh, bash</th></tr><tr xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:m="http://www.w3.org/1998/Math/MathML"><td align="top"><div class="screen"><span class="userinput">
setenv B goodbye
echo $B
<span class="code">goodbye</span>
csh
echo $B
<span class="code">goodbye</span>
exit
echo $B
<span class="code">goodbye</span>
</span></div></td><td align="top"><div class="screen"><span class="userinput">
B=goodbye
export B
echo $B
<span class="code">goodbye</span>
csh
echo $B
<span class="code">goodbye</span>
exit
echo $B
<span class="code">goodbye</span>
</span></div></td></tr></table>
An annoying inconsistency in the <span class="code">csh</span> family: You <span class="emphasis">must</span> use an
<span class="code">=</span> sign when doing <span class="code">set</span>:
<div class="programlisting">
set A=hello
</div>
but you <span class="emphasis">must not</span> use an <span class="code">=</span> with <span class="code">setenv</span>.
<div class="programlisting">
setenv B goodbye
</div>
(It only took me 15 years to get used to that!)</p><p class="para">Many Unix programs use exported shell variables to control or modify their
behavior. Examples that may be familiar include:
<div class="variablelist"><dl><dt class="varlistentry"><span class="term">TERM</span></dt><dd class="varlistitem"> Way back when we were learning to log in with telnet, we
had to set the <span class="code">TERM</span> variable to indicate what kind of terminal
our telnet client was emulating. Many Unix programs use this setting
to determine what control character sequences will work on our
display.</dd><dt class="varlistentry"><span class="term">DISPLAY</span></dt><dd class="varlistitem"> The <span class="code">DISPLAY</span> variable is used by X applications to
determine where to send the windows and graphics for display to the
person running the application.</dd></dl></div></p><p class="para">Another important exported environment variable is <span class="code">PATH</span>. This
determines what programs you can execute without typing in a full path
name. If you type a command that is not a built-in shell command, and
does not contain a '/', then the shell looks at each directory listed
in <span class="code">$PATH</span> to see if the program you have requested can be found
there. For example, suppose you have compiled a C++ program and
produced a new program, <span class="code">yourProgram</span>, in your current working
directory. Some people will be able to execute the program this way:
<div class="programlisting">
yourProgram
</div>
while others will have to do it like this:
<div class="programlisting">
./yourProgram
</div>
The difference stems from whether your account has been set up so that
your working directory (<span class="code">.</span>) is in your <span class="code">$PATH</span>. If it is, then
you can use the first form. If it is not, you must use the second
form.<a onmouseover="DBshowBriefly('fn_fref50_live')" name="fn_fref50" id="fn_fref50" class="footnotemark" href="#fn_fnote50">50</a><div class="footnote_live" id="fn_fref50_live">Some people consider it a bit of a security risk to
have <span class="code">.</span> in your <span class="code">$PATH</span>, arguing that you could get spoofed
into doing some very strange things if someone had deposited some
malicious programs into your working directory under innocuous names
like <span class="quote">
      &#8220;<span class="code">ls</span>&#8221;
    </span> or <span class="quote">
      &#8220;<span class="code">cp</span>&#8221;
    </span>. My own feeling is that the threat
here is pretty small.</div> To see your path, just give the command
<div class="programlisting">
echo $PATH
</div>
to print it, jsut as you would print any environment variable.</p><p class="para">Adding additional directories to your <span class="code">$PATH</span> is one of the more
common <a href="../custom/">customizations</a> that people make to their Unix
environments.</p><p class="para">To see some of the other environment variables that are already
defined for you, try giving the command <span class="code">env</span>.</p><p class="para">A final caution: when writing commands that involve environment
variables, it helps to keep in mind the <a url="../typing/#quoting" href="../typing/#quoting">different forms of quoting</a> in Unix shells,
especially the difference between 'single quotes' and "double
quotes".</p><p class="para">Sooner or later, you're going to decide that you don't like some of
the default behaviors of your favorite Unix programs. When that
happens, you will be pleased to learn that there's are great deal you
can do to modify your Unix environment.</p><div class="sect3" id="loginCustom"><div class="info_sect3"><div class="title_sect4">8.1.1. Startup Customizations</div></div>
    
    <p class="para">When a C-shell or TC-shell is started up (e.g., whenever you log in,
or spawn off a new <span class="code">xterm</span>), it executes the commands in a file called
<span class="code">~/.cshrc</span> This gives you an opportunity to customize your
Unix environment.<a onmouseover="DBshowBriefly('fn_fref51_live')" name="fn_fref51" id="fn_fref51" class="footnotemark" href="#fn_fnote51">51</a><div class="footnote_live" id="fn_fref51_live">A related file is
<span class="code">~/.login</span>, which is only run when you first log in to the
system. This can also be customized, but, on the whole, <span class="code">~/.cshrc</span> is probably more useful.</div></p>
    <p class="para">You may or may not already have a <span class="code">.cshrc</span> file.<a onmouseover="DBshowBriefly('fn_fref52_live')" name="fn_fref52" id="fn_fref52" class="footnotemark" href="#fn_fnote52">52</a><div class="footnote_live" id="fn_fref52_live">Note that because this
filename starts with a <span class="quote">
      &#8220;.&#8221;
    </span>, you won't see it with an
<span class="code">ls</span> command unless you use the <a href="../basicCommands/#lsa"><span class="code">-a</span>
option</a></div>.
You can check by giving the command
<div class="programlisting">
   ls -a ~
</div></p>
    <p class="para">If you don't have a <span class="code">.cshrc</span> file, you should make one. If you do,
consider changing it as described here.
Edit your <span class="code">.cshrc</span> file and insert the following:
<div class="programlisting">
   setenv EDITOR emacs
   umask 002
   limit coredumpsize 0
   #
   #   skip remaining setup if not an interactive shell
   #
   if ($?USER == 0 || $?prompt == 0) exit
   set history=40
   set ignoreeof 
   set prompt="`hostname`: " 
   alias cp            'cp -i' 
   alias mv            'mv -i' 
   alias rm            'rm -i' 
   alias ls            'ls -F' 
   alias ff           'find . -name \!* -print' 
</div></p>
    <p class="para">The <span class="code">setenv</span> line indicates that <span class="code">emacs</span> is your editor of
choice. Some programs, including many <a url="../mail/" href="../mail/">e-mail
programs</a>, will use this information to load an editor when you have
large amounts of text to enter/alter.</p>
    <p class="para">The <span class="code">umask</span> command sets your default file protections. See
<a url="../protection/#umask" href="../protection/#umask">this discussion</a> for details.</p>
    <p class="para">Of the remaining lines, the most interesting are the <span class="code">alias</span>
commands. These set up <span class="quote">
      &#8220;abbreviations&#8221;
    </span> for commands. In this case,
we are mainly adding options to familiar commands. The first three
aliases add a <span class="code">-i</span> option to the <span class="code">cp</span>, <span class="code">mv</span>, and
<span class="code">rm</span> commands. This option causes each command to prompt for a
confirmation whenever its action would result in a file being deleted.
The fourth alias adds the <a href="../basicCommands/#lsF"><span class="code">-F</span> option</a> to all
<span class="code">ls</span> commands,
making it easier to tell the difference between ordinary files,
directories, and executable programs. The final alias sets up a
<span class="quote">
      &#8220;find-file&#8221;
    </span> command, <span class="code">ff</span>. This will search the current
directory and all subdirectories within it for a file matching a
given pattern. For example the command sequence
<div class="programlisting">
   cd ~
   ff '*.txt'
</div>
will list all of your files with the <span class="code">.txt</span> extension.</p>
    <p class="para">After you have checked this file and saved it, try invoking a new
copy of the shell
<div class="programlisting">
tcsh
</div>
to test out the changes in behavior.</p>
    <p class="para">Another change worth considering in a <span class="code">.cshrc</span> file is adding
additional directories to your <span class="code">PATH</span>. For example, if you want to
be sure that <span class="code">xterm</span> and other <span class="code">X</span> client programs are readily
available whenever you are logged in, you would want to make sure that
/cd{/usr/local/X11R6/bin} is in your <span class="code">$PATH</span>. You can do this by
adding the command
<div class="programlisting">
set path = (/usr/local/X11R6/bin $path)
</div>
to your <span class="code">.cshrc</span> file.</p>
  <div name="fn_fnote51" id="fn_fnote51" class="footnote">51. A related file is
<span class="code">~/.login</span>, which is only run when you first log in to the
system. This can also be customized, but, on the whole, <span class="code">~/.cshrc</span> is probably more useful. (<a href="#fn_fref51">back</a>)
    </div><div name="fn_fnote52" id="fn_fnote52" class="footnote">52. Note that because this
filename starts with a <span class="quote">
      &#8220;.&#8221;
    </span>, you won't see it with an
<span class="code">ls</span> command unless you use the <a href="../basicCommands/#lsa"><span class="code">-a</span>
option</a> (<a href="#fn_fref52">back</a>)
    </div></div><div class="sect3" id="xCustom"><div class="info_sect3"><div class="title_sect4">8.1.2. Customizing X Application Appearance</div></div>
    
    <p class="para">
  When an X application is started, it looks for instructions in a
<span class="code">~/.Xdefaults</span> file. These instructions can be used to
control the appearance and, to a lesser degree, the behavior, of most
X applications.
</p>
    <p class="para">
Each line in a <span class="code">.Xdefaults</span> file has the form
<div class="screen"><span class="emphasis-italic" role="italic">programName</span>*<span class="emphasis-italic" role="italic">resourceName</span>: <span class="emphasis-italic" role="italic">value</span></div> The
<span class="emphasis-italic" role="italic">programName</span> is the name of the program to which this directive
applies. Examples would be <span class="quote">
      &#8220;xterm&#8221;
    </span> or
<span class="quote">
      &#8220;emacs&#8221;
    </span>.  The <span class="emphasis-italic" role="italic">resourceName</span> is the name of some
customizable property of that program. The <span class="emphasis-italic" role="italic">value</span> is the setting
you want for that property.  Exactly what resources can be customized
and what the allowable values are likely to be will vary considerably
from one program to another. You can usually find the list by issuing
the <span class="code">man</span> command to read the manual page for that program.
Almost all programs will support a <span class="code">geometry</span> resource to
indicate how large a window to open and/or where to place it on the
screen. Many support <span class="code">foreground</span> and
<span class="code">background</span> resources to set text and background
colors. Another common resource is <span class="code">font</span>, for designating
the main text font.
</p>
    <p class="para">
For example, try putting the following into your own
<span class="code">~/.Xdefaults</span> file (on the Unix system):
<div class="screen">
!
! My xterm settings: I like a heavy font and always want a scrollbar
!
xterm*Font:     -*-lucidatypewriter-bold-r-*-*-12-*-*-*-*-*-*-*
xterm*Geometry: 80x36
xterm*foreground:       midnight blue
xterm*background:       white
xterm*scrollBar:        true
!
! A light-text-on-dark background version
dark*Font:  -*-courier-medium-r-*-*-14-*-*-*-*-*-*-*
dark*Geometry:      60x24
dark*foreground:    grey
dark*background:    black
</div>
then launch a new xterm the "normal" way:
<div class="screen"><span class="userinput">
  xterm &amp;
</span></div>
and also like this:
<div class="screen"><span class="userinput">
  xterm -name dark &amp;
</span></div>
You can see the effects of changing the geometry and color resources.
</p>
    <p class="para">By the way, <span class="code">emacs</span> offers a nice way to see the range
of available color names. Running emacs under X, try giving the
command <span class="code">M-x list-colors-display</span>. It's better than the
giant-size box of Crayolas!
</p>
    <p class="para">The nastiest part of customizing X is dealing with fonts. As you
can see from the above example, font names tend to be long and
complicated. The command <span class="code">xlsfonts</span> will list all the fonts
know to your remote Unix client machine. But that list is unlikely to be
helpful, partly because it's so long and partly because the 
X windows server program running on your local PC may not know how to
display most of those fonts. A more helpful program is called
<span class="code">xfontsel</span>. You can use it to sample all the available
fonts, seeing how the entire character set will look on your machine.
</p>
  </div><div class="sect3" id="programCustom"><div class="info_sect3"><div class="title_sect4">8.1.3. Program Customizations</div></div>
    
    <p class="para">Many programs have their own mechanisms for customizing their
appearance and behavior.  Typically, these are stored in your home
directory, but with file names beginning with <span class="quote">
      &#8220;.&#8221;
    </span>, making
them invisible to your usual <span class="code">ls</span> command unless you add
the <span class="code">-a</span> option.  (Try doing a <span class="code">ls -a ~</span> right
now - you might be surprised at how many things are already stored
there.) The <span class="code">.login</span> and <span class="code">.cshrc</span> files
discussed earlier are simply one example of this more general
convention in Unix.
</p>
    <p class="para">In many cases, these files represent information stored after you
worked with a program and/or used menu settings to establish your
preferences. For example, once you have used the <span class="code">insight</span>
X window interface to the <span class="code">gdb</span> debugger, you will
afterwards have a file <span class="code">~/.gdbtkinit</span> that records the
breakpoints you had set in your last debugging session and which of
the optional <span class="quote">
      &#8220;view&#8221;
    </span> windows were open. Under normal
circumstances, you would never alter this file directly.
</p>
    <p class="para">On the other hand, some of these files are intended for you to edit
directly. For example, we have already discussed altering your
<span class="code">.cshrc</span> and <span class="code">.Xdefaults</span> files. Another worth
mentioning is the file <span class="code">~/.emacs</span>, which controls the
behavior of the <span class="code">emacs</span> editor.</p>
    <p class="para"><span class="code">emacs</span> may be
the most customizable program ever written, and the range of things
you can put into a <span class="code">.emacs</span> file is well beyond the scope
of this course. The best way for most people to get started in emacs
customization is to look at other people's <span class="code">.emacs</span> files,
such as <a url="http://www.cs.odu.edu/~zeil/software/.emacs" href="http://www.cs.odu.edu/~zeil/software/.emacs">mine</a>
and to read the <a url="http://www.gnu.org/software/emacs/manual/html_chapter/emacs_33.html#SEC505" href="http://www.gnu.org/software/emacs/manual/html_chapter/emacs_33.html#SEC505">emacs
documentation</a>, particularly examples of some common things to put
into a <span class="code">.emacs</span> file.
</p>
  </div><div name="fn_fnote50" id="fn_fnote50" class="footnote">50. Some people consider it a bit of a security risk to
have <span class="code">.</span> in your <span class="code">$PATH</span>, arguing that you could get spoofed
into doing some very strange things if someone had deposited some
malicious programs into your working directory under innocuous names
like <span class="quote">
      &#8220;<span class="code">ls</span>&#8221;
    </span> or <span class="quote">
      &#8220;<span class="code">cp</span>&#8221;
    </span>. My own feeling is that the threat
here is pretty small. (<a href="#fn_fref50">back</a>)
    </div></div><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.1','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('controlflow','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref53','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref53_live','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote53','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.3','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.4','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.4.1','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.4.2','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('scriptDebugging','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.5.1','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.5.2','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('tracing','section-8.2');
</script></div><br/><table width="100%" class="navigationBar"><tr class="navigationBar"><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="First" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html"><img class="navigationBar" src="_axle/first.gif" alt="First"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Prev" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-7.2.html"><img class="navigationBar" src="_axle/prev.gif" alt="Prev"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Up" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html"><img class="navigationBar" src="_axle/up.gif" alt="Up"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Next" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html"><img class="navigationBar" src="_axle/next.gif" alt="Next"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Last" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html"><img class="navigationBar" src="_axle/last.gif" alt="Last"/></a></td><td class="navigationBar"/><td width="5%" class="navigationBar"><a class="navigationBar" title="CS252 Home" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/directory/announcements.html"><img class="navigationBar" src="_axle/home.gif" alt="CS252 Home"/></a></td><td width="5%" class="navigationBar"><a class="navigationBar" title="discuss this page" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/forum/getXPath/open/unix/section-8.html"><img class="navigationBar" src="_axle/forum.gif" alt="discuss this page"/></a></td></tr></table></body></html>