<p>I spend most of my day in the terminal doing one thing or another.  While the default setting work pretty well on the Mac, it&#8217;s lacking while connecting to a remote system.  Here are some of the tweaks I&#8217;ve made to make the terminal app more useful for me.</p>
<p>Not all systems know how to handle a terminal type of xterm-color.  I did find a terminal definition for xterm-color and successfully applied it to AIX, but I&#8217;d rather not do that to all my systems.  So, you can change the terminal type to xterm by default.  Under Terminal Preferences -> Settings -> Advanced, change the &#8220;Declare terminal as&#8221; to xterm.  You can also select dtterm (not as well supported on AIX, and not color) or several flavors of vtterm.  </p>
<p>For some reason, Apple thinks the page-up and page-down keys should scroll the buffer back.  I&#8217;d rather actually use page-up and page-down in my terminal than just using it to scroll back.  You can adjust the key codes under Terminal Preferences -> Settings -> Keyboard.  Then, edit the keys and set them as:</p>
<p>page down: \033[6~<br />
page up: \033[5~</p>
<p>You can also try:<br />
Home: \001 or \033[7~<br />
End: \005 or \033[4~</p>
<p>It also bugs me that the terminal doesn&#8217;t exit when I logout.  I then end up going to the mouse and closing the window or hitting Command-W.  You can make the terminal close, only if the program it&#8217;s running exits with a 0 return code.  Go to Terminal Preferences -> Settings -> Shell, and change &#8220;When the shell exits&#8221; to &#8220;Close if the shell exited cleanly&#8221;.</p>
<p>I&#8217;d like it if the terminal name changed to the system I&#8217;m connected to, but I haven&#8217;t found how to do that yet.  I have made the terminal window bar a little more useful.  Under Terminal Preferences -> Settings -> Window, I have &#8220;Active process name&#8221;, &#8220;Dimensions&#8221;,  and &#8220;Command key&#8221; checked.  That gives me a window bar something like: Terminal &#8211; ssh &#8211; 80&#215;24 &#8211; CMD4</p>
<p>I don&#8217;t care for the block cursor either.  It tends to hide the character under the cursor in vi.  So, I changed the cursor to a pipe.  Under Terminal Preferences -> Settings -> Text, change the Cursor radio button to &#8220;| vertical bar&#8221;.  You can also change it to an underscore.  </p>
<p>While you&#8217;re in here, check out the different window themes.  I&#8217;m using Homebrew now.  It&#8217;s a nice green on black theme with just a little transparency.  You can change your default new terminal session theme under Terminal Preferences -> Startup if you find one you like better.</p>
{"id":492,"date":"2010-08-05T09:24:38","date_gmt":"2010-08-05T13:24:38","guid":{"rendered":"http:\/\/patrickv.info\/wordpress\/?p=492"},"modified":"2010-08-05T09:24:38","modified_gmt":"2010-08-05T13:24:38","slug":"mac-terminal-tweaks","status":"publish","type":"post","link":"https:\/\/rootuser.ninja\/index.php\/2010\/08\/05\/mac-terminal-tweaks\/","title":{"rendered":"Mac Terminal Tweaks"},"content":{"rendered":"<p>I spend most of my day in the terminal doing one thing or another.  While the default setting work pretty well on the Mac, it&#8217;s lacking while connecting to a remote system.  Here are some of the tweaks I&#8217;ve made to make the terminal app more useful for me.<\/p>\n<p>Not all systems know how to handle a terminal type of xterm-color.  I did find a terminal definition for xterm-color and successfully applied it to AIX, but I&#8217;d rather not do that to all my systems.  So, you can change the terminal type to xterm by default.  Under Terminal Preferences -> Settings -> Advanced, change the &#8220;Declare terminal as&#8221; to xterm.  You can also select dtterm (not as well supported on AIX, and not color) or several flavors of vtterm.  <\/p>\n<p>For some reason, Apple thinks the page-up and page-down keys should scroll the buffer back.  I&#8217;d rather actually use page-up and page-down in my terminal than just using it to scroll back.  You can adjust the key codes under Terminal Preferences -> Settings -> Keyboard.  Then, edit the keys and set them as:<\/p>\n<p>page down: \\033[6~<br \/>\npage up: \\033[5~<\/p>\n<p>You can also try:<br \/>\nHome: \\001 or \\033[7~<br \/>\nEnd: \\005 or \\033[4~<\/p>\n<p>It also bugs me that the terminal doesn&#8217;t exit when I logout.  I then end up going to the mouse and closing the window or hitting Command-W.  You can make the terminal close, only if the program it&#8217;s running exits with a 0 return code.  Go to Terminal Preferences -> Settings -> Shell, and change &#8220;When the shell exits&#8221; to &#8220;Close if the shell exited cleanly&#8221;.<\/p>\n<p>I&#8217;d like it if the terminal name changed to the system I&#8217;m connected to, but I haven&#8217;t found how to do that yet.  I have made the terminal window bar a little more useful.  Under Terminal Preferences -> Settings -> Window, I have &#8220;Active process name&#8221;, &#8220;Dimensions&#8221;,  and &#8220;Command key&#8221; checked.  That gives me a window bar something like: Terminal &#8211; ssh &#8211; 80&#215;24 &#8211; CMD4<\/p>\n<p>I don&#8217;t care for the block cursor either.  It tends to hide the character under the cursor in vi.  So, I changed the cursor to a pipe.  Under Terminal Preferences -> Settings -> Text, change the Cursor radio button to &#8220;| vertical bar&#8221;.  You can also change it to an underscore.  <\/p>\n<p>While you&#8217;re in here, check out the different window themes.  I&#8217;m using Homebrew now.  It&#8217;s a nice green on black theme with just a little transparency.  You can change your default new terminal session theme under Terminal Preferences -> Startup if you find one you like better.<\/p>\n","protected":false},"excerpt":{"rendered":null,"protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1],"tags":[],"class_list":["post-492","post","type-post","status-publish","format-standard","hentry","category-mac","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/posts\/492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/comments?post=492"}],"version-history":[{"count":0,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/posts\/492\/revisions"}],"wp:attachment":[{"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/media?parent=492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/categories?post=492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rootuser.ninja\/index.php\/wp-json\/wp\/v2\/tags?post=492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}