<p>Please refer to the topic on <ahref="../bash-scripting.html">Scripting</a> for a few links to online tutorials on working in the shell and also have a look at <ahref="cli-apps.html">Haiku's commandline applications</a>. Here, we'll concentrate on the Terminal application itself.</p>
<aid="windows-tabs"name="windows-tabs">Windows and tabs</a></h2>
<p>You can open as many Terminals as needed, either each in it's own window by simply launching more Terminals or with <spanclass="key">ALT</span><spanclass="key">N</span> from an already running Terminal. Or you use Terminal's tabbed view and open more tabs with <spanclass="key">ALT</span><spanclass="key">T</span>.</p>
<p>Double-clicking into the emtpy part of the tab bar opens a new tab; onto a tab opens a dialog to rename its title. There are several %-designated variables that are explained with a tooltip when you hover the mouse over the text field.<br/>
By default, <tt>%1d: %p</tt>, a tab shows the current directory and, separated by a <tt>:</tt>, the name of the currently running process (or <tt>--</tt> if it's just bash running, probably idling). The screenshot above shows the first tab with a FTP session in the <spanclass="path">Desktop</span> folder and a second tab idling at <spanclass="path">home</span>.<br/>
<p>Right-clicking a tab shows a context menu to <spanclass="menu">Close tab</span>, <spanclass="menu">Close other tabs</span> or, like double-clicking, <spanclass="menu">Edit tab title...</span>.</p>
<p>A Terminal window can be resized like any other window or you use the presets from the <spanclass="menu">Settings | Window size</span> menu. <spanclass="key">ALT</span><spanclass="key">ENTER</span> toggles fullscreen mode.</p>
<p>All the settings you change directly through the <spanclass="menu">Settings</span> menu, like <spanclass="menu">Window title</span>, <spanclass="menu">Window size</span>, <spanclass="menu">Text encoding</span> or <spanclass="menu">Font size</span> are only kept for the current session. If you want to make permanent changes, you have to apply them in the <spanclass="menu">Settings...</span> panel.</p>
<p>Most of the offered settings speak for themselves.<br/>
Hover your mouse over the "formulas" for naming tab and window titles to get tooltips for the available variables. <br/>
You can choose pre-defined color schema like <spanclass="menu">Midnight</span> or <spanclass="menu">Retro</span> or create a <spanclass="menu">Custom</span> one by selecting which color you want to change (<spanclass="menu">Text</span>, <spanclass="menu">Background</span>, <spanclass="menu">Cursor</span> etc.) and then use the color picker below.</p>
<p>A few more options follow: you can have a <spanclass="menu">Blinking cursor</span> and choose to <spanclass="menu">Use bright instead of bold text</span>. The latter setting avoids the sometimes rather unsightly rendering of bold fonts in the Terminal.<br/>
Activate the checkbox to <spanclass="menu">Confirm exit if active programs exist</span> and you'll be warned when trying to close a Terminal window while an app is still being executed.</p>
<tr><tdclass="onelinetop"><spanclass="button">Save to file...</span></td><tdwidth="10"></td><td>let's you save different settings as separate profiles, which on double-click open an accordingly configured Terminal.</td></tr>
<tr><td><spanclass="button">Revert</span></td><td></td><td>brings back the settings that were active when you opened the settings panel.</td></tr>
<tr><td><spanclass="button">Defaults</span></td><td></td><td>resets everything to default values.</td></tr>
<p>Another nice feature that is more a key & mouse combination: When holding <spanclass="key">ALT</span> a path or URL under the mouse pointer gets highlighted. A left-click opens the file/folder or website. A right-click opens a context menu to either <spanclass="menu">Copy path</span> or <spanclass="menu">Copy absolute path</span>. Imagine you're in <spanclass="path">/MyData/source/haiku/</span> and have the path <spanclass="path">generated/objects/haiku/x86_gcc2/release/apps/stylededit/StyledEdit</span> under the mouse pointer, the latter menu item will result in the combined, absolute path <<i>deep breath</i>>:<br/><spanclass="path">/MyData/source/haiku/generated/objects/haiku/x86_gcc2/release/apps/stylededit/StyledEdit</span>.</p>
<p>If you hold down <spanclass="key">ALT</span><spanclass="key">SHIFT</span>, only the path from beginning to where your mouse pointer sits will be highlighted.</p>
<p>By the way, right-clicking into the Terminal window will insert the clipboard. In combination with copying parts of highlighted paths, this can be used for speedy navigation of deep folder hierarchies.</p>
<p>Coming from Unix, there are countless possibilities to customize the bash itself. There are two files that are especially important to the user: <spanclass="cli">.profile</span> and <spanclass="cli">.inputrc</span><br/>
Both files can be created in the <spanclass="path">home/</span> folder and add or override the system defaults that are defined in <spanclass="path">/boot/system/settings/etc/</span>.</p>
<p>The <spanclass="cli">.profile</span> is loaded every time you open a new Terminal. It sets all kinds of aliases and variables that will affect bash's behavior and appearance. You'll find many online resources that will detail all possibilities.</p>
<p>The Haiku/BeOS Tip Server has quite a few tips to get you started, for example:</p>
<ul>
<li><ahref="http://betips.net/1997/09/09/customize-your-terminal-prompt/">Customize your Terminal prompt</a></li>
<p>The <spanclass="cli">.inputrc</span> deals with keybindings. Since Haiku provides useful defaults, you probably don't have to mess with these more involved settings. If you do have special needs here, consult one of the many online resources, e.g. <ahref="http://tiswww.case.edu/php/chet/readline/rluserman.html">The GNU Readline Library</a>.</p>
<ul><li><p>Dragging a file or folder from a Tracker window into the Terminal will insert its path at the location of the cursor. Dragging with the right mouse button offers additional actions in a context menu:</p>
<tr><td><spanclass="menu">Insert path</span></td><td></td><td>Inserts the location of the file, same as drag&dropping with the left mouse button.</td></tr>
<tr><td><spanclass="menu">Change directory</span></td><td></td><td>Changes to the folder of the dragged file.</td></tr>
<tr><td><spanclass="menu">Create link here</span></td><td></td><td>Creates a link to the dragged file in the current working directory of the Terminal.</td></tr>
<tr><td><spanclass="menu">Move here</span></td><td></td><td>Moves the dragged file into the current working directory of the Terminal.</td></tr>
<tr><td><spanclass="menu">Copy here</span></td><td></td><td>Copies the dragged file into the current working directory of the Terminal.</td></tr>
<li><p>You can open any file with its preferred application with the command <spanclass="cli">open <i>[filename]</i></span>. This also works with the representation of the current ("<spanclass="cli">.</span>") and parent ("<spanclass="cli">..</span>") folder which then open in a Tracker window. So, to open the current working directory, you type:</p>