<othercredit role="translator"><firstname>John</firstname><surname>Knight</surname><affiliation><address><email>anarchist_tomato@herzeleid.net</email></address></affiliation><contrib>Conversion to British English</contrib></othercredit>
<title>What is a terminal?</title> <para>&UNIX; operating systems were originally designed as text-only systems, controlled by keyboard commands -- what is known as a command-line interface (<acronym>CLI</acronym>). The &X-Window; and &kde; and other projects have since added the graphical interface you are now using. However, the underlying <acronym>CLI</acronym> system is still there, and is frequently the easiest, fastest and most powerful way to perform many tasks.</para> <para>&konsole; is what is known as an X terminal emulator, often referred to as a terminal or a shell. It gives you the equivalent of an old-fashioned text screen on your desktop, but one which can easily share the screen with your graphical applications. Windows users may be familiar with the <application> MS-DOS Prompt</application> utility, which has the analogous function of offering a <trademark>DOS</trademark> command-line under &Windows;. (Although the &UNIX; <acronym>CLI</acronym>s offer far more power and ease of use than does <acronym>DOS</acronym>!)</para>
<para>Explaining the use of the &UNIX; <acronym>CLI</acronym> is beyond the scope of this document, as it would require a lengthy book. Fortunately, many such books are available in every language in any good bookstore or library. There are also tutorials available on the Internet. Enjoy &kde;, but don't be shy about learning to use the command-line! You will find that even learning just the basics will make your computer use much more efficient and enjoyable.</para>
<title>What makes &konsole; special?</title> <para>&konsole;'s advanced features include simple configuration and the ability to use multiple terminal shells in a single window, making for a less cluttered desktop.</para>
<para>These sessions can be renamed to help you keep track of all your shells, or signalled (<errorcode>STOP</errorcode>, <errorcode>CONT</errorcode>, <errorcode>HUP</errorcode>, <errorcode>INT</errorcode>, <errorcode>TERM</errorcode>, <errorcode>KILL</errorcode>).</para>
<para>For more control over &konsole;, a user can:</para>
<para>All chosen settings can be made the default for forthcoming sessions by saving them. </para>
<para>For those with a deep interest in the taxonomy of free X terminals, there are two others of this kind: <application>xterm</application>, the original, written even before X itself (a month or two), and <application>xvt</application>, a lightweight <application>xterm</application> clone, on which most other currently available derivatives (notably <application>eterm</application>) are based.</para>
<para>After a decade, &konsole; is the first rewrite from the ground up. While <application>xterm</application> has definitely been hacked to death (its <filename>README</filename> begins with the words <quote>Abandon All Hope, Ye Who Enter Here</quote>), &konsole; offers a fresh start using contemporary technologies and understanding of X.</para>
<para>A <quote>Tip of the Day</quote> window may also appear on startup, offering hints on the use of &konsole;. If you do not wish to receive tips, uncheck the <guilabel>Show tips on startup</guilabel> box.</para>
<para>As lines scroll off the top of the screen, they can be reviewed by moving the scroll bar upwards, scrolling with a mouse wheel or through the use of the <keycombo action="simul">&Shift;<keycap>Page Up</keycap></keycombo> (to move back a page), <keycombo action="simul">&Shift;<keycap>Page Down</keycap></keycombo> (to move forward a page), <keycombo action="simul">&Shift;<keycap>Up</keycap></keycombo> (to move up a line) and <keycombo action="simul">&Shift;<keycap>Down</keycap></keycombo> (to move down a line) keys (provided the <link linkend="settings-menu">History</link> option is on).</para>
<para>In addition, &konsole; mimics the FreeBSD console when <keycap>scroll lock</keycap> is pressed. When scroll lock is on, ordinary in- and output from the shell is suspended, and you can scroll through the history with <keycap>Page Up</keycap>, <keycap>Page down</keycap>, and <keycap>Up Arrow</keycap> and <keycap>Down Arrow</keycap>.</para>
<para>If you often have to log into remote machines, or always run a similar set of terminal applications, you can use &konsole;'s <quote>Session</quote> feature along with &kde;'s session management to automate a lot of this for you. Let's take the following example: You often have open an <application>ssh</application> session to the machine <replaceable>administration</replaceable> ready for generic administration tasks. You may have noticed the <guibutton>New</guibutton> button on &konsole;'s tab bar contains a menu if you click and hold on it, and you can choose new session types here. We are going to add new entries to this menu. <orderedlist>
<listitem><para>Click on the menu entry <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure Konsole</guimenuitem> </menuchoice></para></listitem>
<listitem><para>Choose the <guilabel>Session</guilabel> tab.</para>
</listitem>
<listitem><para>Fill in the first entry with a name. This is the name that will show in the menu, and will be the default label instead of <guilabel>Shell</guilabel> when you start a session of this type. </para></listitem>
<listitem><para>Enter a command just as you normally would if you opened a new shell and were going to issue that command. For our first example above, you might type <userinput><command>ssh</command> <replaceable>administration</replaceable></userinput>.</para></listitem>
<listitem><para>On the lower part of the panel, configure this session's appearance. You can have a different font, colour scheme, and $<envar>TERM</envar> type for each session.</para></listitem>
<listitem><para>Press the <guibutton>Save Session...</guibutton> button. A dialogue will ask you to confirm the filename. </para></listitem>
<para>You should now be able to press and hold the <guibutton>New</guibutton> button on the tab bar, and select your new session type from the list. A new shell session will open within the &konsole; window, with the result of your executed command. In our example, you will be at an <application>ssh</application> passphrase prompt, and when you provide your passphrase, you will be logged into the remote machine. <footnote id="use-ssh-agent"><para>You can avoid this step also, by using ssh-agent, but that is a topic for another goodie.</para></footnote> Perhaps you want to remotely tail your <acronym>http</acronym> error logs on a webserver, you could use a commandline something like <userinput><command>ssh</command> <option>-f</option> <replaceable>webserver</replaceable> <command>tail</command> <option>-f</option> <filename><replaceable>/var/log/httpd-error.log</replaceable></filename></userinput>. </para>
<para>You can use this to execute local commands as well. Try creating a session where the command is <userinput><command>tail</command> <option>-f</option> <filename><replaceable>/var/log/messages</replaceable></filename></userinput>. In this case, exiting the running application will close the shell session as well. </para>
<para>One really nice use of this feature is if you find you always have the same set of open sessions, &kde; can open them all for you automatically when you start a new &kde; session. Simply have them open as you like when you exit &kde;, and they will be saved with your &kde; session, and restored just like any other application when you restart &kde;. </para>
<listitem><para>Clicking the <mousebutton>left</mousebutton> button is passed as an event to the application running in the emulation, if it is mouse-aware. If a program will react on mouse clicks, &konsole; indicates this by showing an arrow cursor. If not, an I-beam (bar) cursor is shown.</para>
<para>Holding the <mousebutton>left</mousebutton> button down and dragging the mouse over the screen with a mouse-unaware application running will mark a region of the text. While dragging, the marked text is displayed reversed for visual feedback. Select <guimenuitem>Copy</guimenuitem> from the <guimenu>Edit</guimenu> menu to copy the marked text to the clipboard for further use within &konsole; or another application. The selected text can also be dragged and dropped into compatible applications. Click on the selected text and drag it to the desired location. (Depending on your &kde; settings, you may need to hold the &Ctrl; key while dragging.</para>
<para>Normally, new-line characters are inserted at the end of each line selected. This is best for cut and paste of source code, or the output of a particular command. For ordinary text, the line breaks are often not important. One might prefer, however, for the text to be a stream of characters that will be automatically re-formatted when pasted into another application. To select in text-stream mode, hold down the &Ctrl; key while selecting normally.</para>
<para>If the upper or lower edge of the text area is touched while marking, &konsole; scrolls up or down, eventually exposing text within the history buffer. The scrolling stops when the mouse stops moving.</para>
<para>After the mouse is released, &konsole; attempts to keep the text in the clipboard visible by holding the marked area reversed. The marked area reverts back to normal as soon as the contents of the clipboard change, the text within the marked area is altered or the <mousebutton>left</mousebutton> mouse button is clicked.</para>
<listitem><para>Pressing the <mousebutton>middle</mousebutton> button pastes text currently in the clipboard. Holding down the &Ctrl; key as you press the <mousebutton>middle</mousebutton> button pastes the text and sends it to &konsole;.</para>
<note><para>If you have a mouse with only two buttons, pressing both the <mousebutton>left</mousebutton> and <mousebutton>right</mousebutton> buttons together emulates the <mousebutton>middle</mousebutton> button of a three button mouse.</para></note>
<para>The <mousebutton>right</mousebutton> button brings up a menu with the <guimenuitem>Show Menubar</guimenuitem>, <guimenuitem>Copy</guimenuitem>, <guimenuitem>Paste</guimenuitem>, <guimenuitem>Send Signal</guimenuitem>, <guimenuitem>Detach (or Attach) Session</guimenuitem>, <guimenuitem>Rename Session...</guimenuitem>, <guimenuitem>Bookmarks</guimenuitem> <guimenuitem>Settings</guimenuitem> and <guimenuitem>Close Session</guimenuitem> menu items. The <keycombo action="simul">&Ctrl; <mousebutton>right</mousebutton></keycombo> button brings up the <guimenu>Session</guimenu> menu. </para>
<para>The menubar is at the top of the &konsole; window. It can be hidden and restored by toggling <guimenuitem>Show Menubar</guimenuitem> in the <guimenu>Settings</guimenu> menu. When the menubar is hidden, <guimenuitem>Show Menubar</guimenuitem> can be reached by <mousebutton>right</mousebutton> clicking in the window or by <keycombo action="simul">&Alt;&Ctrl;<keycap>M</keycap> </keycombo>.</para>
<listitem><para><action>Open a new session</action> with a terminal shell. <keycombo action="simul">&Alt;&Ctrl;<keycap>N</keycap> </keycombo> can also be used, as described in more detail below. </para></listitem></varlistentry>
<varlistentry>
<term><menuchoice><guimenu>Session</guimenu><guimenuitem>New Linux Console</guimenuitem></menuchoice></term>
<listitem><para><action>Open a new session emulating a text-only &Linux; system.</action></para>
<note><para>See the file <filename>README.linux.console</filename> in the &konsole; source package for detailed information on how the &Linux; console differs from a typical &UNIX; console. If this doesn't mean anything to you, you almost certainly don't need to worry about it.</para></note>
<para><action>Open a new session with a terminal shell</action>, as the <systemitem class="username">root</systemitem> user. </para>
<para>After being prompted for the <systemitem class="username">root</systemitem> password, the <prompt>#</prompt> prompt appears, indicating that the user is working with <systemitem class="username">root</systemitem> privileges. This is frequently necessary for installing new software and other system maintenance, but care should be taken to avoid accidental damage. </para>
<para><action>Open a new session</action> with the <application>Midnight Commander</application> file browser, as the <systemitem class="username">root</systemitem> user. </para>
<para>After being prompted for the <systemitem class="username">root</systemitem> password, the <prompt>#</prompt> prompt appears under the browser window, indicating that the user is working with <systemitem class="username">root</systemitem> privileges. Again, working as <systemitem class="username">root</systemitem> is frequently necessary but care should be taken to avoid accidental damage. </para>
<listitem><para><action>Open a new session</action> with the <application>Screen</application> virtual terminal manager. See <userinput><command>man</command> <option>screen</option> </userinput>for more information. </para></listitem></varlistentry>
<varlistentry>
<term><menuchoice><guimenu>Session</guimenu> <guimenuitem>New Shell at Bookmark</guimenuitem></menuchoice></term>
<listitem><para><action>Start</action> a new terminal shell, in a folder chosen from the bookmark list.</para></listitem>
<para>You can also open a new session with a key shortcut. By default, <keycombo action="simul">&Alt;&Ctrl;<keycap>N</keycap> </keycombo> is used. You can also define your own key shortcuts through the <menuchoice><guimenu>Settings</guimenu> <guimenuitem>Configure Shortcuts...</guimenuitem></menuchoice> menu command.</para>
<para>The files with a <literal role="extension">*.keytab</literal> extension in <filename class="directory">$<envar>TDEDIR</envar>/share/apps/konsole</filename> also define keyboard shortcuts. Use the <menuchoice><guimenu>Settings</guimenu> <guimenuitem>Keyboard</guimenuitem></menuchoice> menu command to choose a keytab file. The file <filename>README.KeyTab</filename> contains more information on defining shortcuts. </para>
<para>The list of available sessions may differ from those listed here. &konsole; detects your installed programs and customises the list to reflect the available options.</para>
<para>Finally, note that the session types can be modified, and new types created, by using the configuration dialogue, reached from the <menuchoice><guimenu>Settings</guimenu> <guimenuitem>Configure Konsole...</guimenuitem></menuchoice> menu entry.</para>
<listitem><para><action>Send Signal - Send the specified signal to the shell process, or other process, that was launched when the new session was started.</action></para><para>Currently available signals are:</para>
<para>Refer to your system manual pages for further details by giving the command <userinput><command>man</command> <option>7 signal</option></userinput>.</para></listitem>
<listitem><para><action>Clear all text from the session window.</action>.</para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice><guimenu>Edit</guimenu><guimenuitem>Reset and Clear Terminal</guimenuitem></menuchoice></term>
<listitem><para><action>Start a new session in the window.</action>.</para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice><guimenu>Edit</guimenu><guimenuitem>Find in History...</guimenuitem></menuchoice></term>
<listitem><para><action>Find a word or string of text</action> in the current history. Options allow case sensitive or backwards searches, and the use of regular expressions in searches. Press the <guibutton>Edit</guibutton> button to use the &kde; graphical editor to create a regular expression.</para></listitem>
<listitem><para><action>Open the current session in a separate window.</action> The name of the session is displayed on the titlebar of the new window. Close the new window to restore the session to its original place, or <mousebutton>right</mousebutton>-click on the new window and select <guimenuitem>Attach Session</guimenuitem>. Note that if the main window is closed, any detached sessions will be closed with it. </para></listitem>
<listitem><para><action>Open a dialogue box allowing you to change the name of the current session.</action> The name is displayed on the session tab. <keycombo action="simul">&Alt;&Ctrl;<keycap>S</keycap> </keycombo> can also be used.</para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice><guimenu>View</guimenu><guimenuitem>Monitor for Activity</guimenuitem></menuchoice></term>
<listitem><para><action>Flag the current session so it will show an alert if activity occurs.</action> An icon of a lit light bulb will appear in the session's tab. Use this to alert you if something happens while you are working in another session. The time before an alert can be modified in the &konsole; preferences.</para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice><guimenu>View</guimenu><guimenuitem>Monitor for Silence</guimenuitem></menuchoice></term>
<listitem><para><action>Flag the current session so it will show an alert if no activity occurs for 10 seconds.</action> An icon of a dark light bulb will appear in the session's tab. Use this to alert you if a task stops while you are working in another session. The time before an alert can be modified in the &konsole; preferences.</para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice><guimenu>View</guimenu><guimenuitem>Send Input to All Sessions</guimenuitem></menuchoice></term>
<listitem><para><action>Flag the current session so any commands entered into it will be sent to all sessions.</action> The session will have a small icon in its tab to remind you to be careful of what you enter! <userinput><command>rm </command><parameter>-rf *</parameter></userinput>, for instance, is probably not a good idea.</para></listitem>
<listitem><para><action>Move the tab of the current session one tab to the right.</action></para>
<para><keycombo action="simul">&Shift; <keycap>Left</keycap></keycombo> and <keycombo action="simul">&Shift; <keycap>Right</keycap></keycombo> can be also be used to move between sessions.</para></listitem></varlistentry>
<listitem><para>At the bottom of the menu is a list of the available sessions. Selecting one makes that session active.</para><para>You can also use the <keycombo action="simul">&Shift;<keycap>Left</keycap></keycombo>/<keycombo action="simul">&Shift;<keycap>Right</keycap></keycombo> keys to cycle through the available sessions.</para>
<listitem><para><action>Control location of scrollbar</action>: <guimenuitem>none</guimenuitem>, <guimenuitem>left</guimenuitem>, or <guimenuitem>right</guimenuitem>.</para></listitem>
<listitem><para><action>Set font and font size</action></para>
<para>Select the <guimenuitem>Custom</guimenuitem> option to use any combination of font, size and style. The <filename>README.fonts</filename> file in the &konsole; source package gives tips on which fonts will work well.</para></listitem>
<para>The list of these keymappings is taken from <filename>$TDEDIR/share/apps/konsole/*.keytab</filename>. The file <filename>$TDEDIR/share/apps/konsole/README.KeyTab</filename> describes the keytab format in more detail. Add to or modify these files to match your needs.</para></listitem>
<listitem><para><action>Set colours of text and background.</action></para>
<para>The list of these schemata is taken from <filename>$TDEDIR/share/apps/konsole/*.schema</filename>. The file <filename>$TDEDIR/share/apps/konsole/README.Schema</filename> describes the schema format in more detail. Add to or modify these files to match your needs. You can also create custom schema through the preferences dialogue at <menuchoice><guisubmenu>Settings</guisubmenu> <guimenuitem>Configure Konsole...</guimenuitem></menuchoice>. </para>
<listitem><para><anchor id="configure-history"/><action>Open a dialogue where you can configure the history.</action> The <guilabel>Enable</guilabel> checkbox toggles saving of lines that have scrolled off the top of the window. You can enter the <guilabel>Number of lines</guilabel> to remember in the text field, or use the spinner buttons to increase or decrease the number in steps of 100 lines. The <guibutton>Defaults</guibutton> button will reset the history to 1000 lines. Setting this value to 0 will cause all history to be saved. Press <guibutton>OK</guibutton> to save your changes, or <guibutton>Cancel</guibutton> to close the dialogue without saving your settings. The <guibutton>Help</guibutton> button will open this manual, and display the text you're reading right now.</para></listitem>
<listitem><para><action>Save the current set of sessions </action>under a name you choose. The profile can then be used by starting &konsole; from the command-line with the <parameter>--profile</parameter> and the name of the profile.</para>
<listitem><para><action>Open the &kcontrolcenter; module, allowing many additional changes to &konsole;'s interface and behaviour, including the creation of custom schemas and modification of the available sessions.</action></para>
<listitem><para><action>Open the table of contents of this document.</action></para></listitem>
</varlistentry>
<varlistentry>
<term><menuchoice><guimenu>Help</guimenu> <guimenuitem>Tip of the Day...</guimenuitem></menuchoice></term>
<listitem><para><action>Display a helpful tip about the use of &konsole;. </action>Check the <guilabel>Show on start</guilabel> box to display a tip each time &konsole; is started.</para></listitem>
<para>The toolbar is at the bottom of the &konsole; window.</para>
<para>It can be hidden and restored by toggling <guimenuitem>Show Toolbar</guimenuitem> in the <guimenu>Settings</guimenu> menu or by clicking the textured <quote>handle</quote> at the side of the bar. The bar contains a <guiicon>New</guiicon> icon and icons for the current sessions. Clicking <guiicon>New</guiicon> opens a new <quote>Shell</quote> session.</para>
<para>Double-clicking a session tab opens a dialogue box enabling you to change the name of that session. <keycombo action="simul">&Alt;&Ctrl;<keycap>S</keycap> </keycombo> can also be used to rename the active session.</para>
<para>Clicking an existing session's icon makes that session active.</para> <para>When the toolbar is hidden, <keycombo action="simul">&Shift; <keycap>Left</keycap></keycombo> and <keycombo action="simul">&Shift; <keycap>Right</keycap></keycombo> can be used to move between sessions.</para>
<listitem><para><action>Set the name that appears in the titlebar</action></para></listitem>
</varlistentry>
<varlistentry>
<term><option>--ls</option></term>
<listitem><para><action>Start with a login shell environment.</action> What that does varies depending on your system, but generally it means that files such as <filename>~/.profile</filename> or <filename>~/.bash_profile</filename> will be read. (If that doesn't mean anything to you, don't worry about it, but keep in the back of your mind for when you realise you need it.)</para></listitem>
<listitem><para><action>Sets the environment variable TERM to the specified value.</action> Read <userinput><command>man</command> <option>xterm</option> </userinput> for more information on TERM.</para></listitem>
<listitem><para><action>Prevent &konsole; from closing</action> when an <userinput><command>exit</command></userinput> command is issued in the only session window.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--nohist</option></term>
<listitem><para><action>Disable the saving of lines that scroll off the top of the window</action></para></listitem>
</varlistentry>
<varlistentry>
<term><option>--nomenubar</option></term>
<listitem><para><action>Start &konsole; without a menubar</action></para></listitem>
</varlistentry>
<varlistentry>
<term><option>--notoolbar</option></term>
<listitem><para><action>Start &konsole; without a toolbar</action></para></listitem>
</varlistentry>
<varlistentry>
<term><option>--noframe</option></term>
<listitem><para><action>Start &konsole; without a frame</action></para></listitem>
</varlistentry>
<varlistentry>
<term><option>--noscrollbar</option></term>
<listitem><para><action>Start &konsole; without a scrollbar</action></para></listitem>
</varlistentry>
<varlistentry>
<term><option>--noxft</option></term>
<listitem><para><action>Start &konsole; without Xft antialiasing.</action> Antialiasing of a small font may be difficult to read.</para></listitem>
<para>Information on building &konsole; on platforms other than &Linux; is available in the <filename>README.ports</filename> file in the &konsole; source package. It provides a list of experts for certain platforms (Tru64, &Solaris;, OpenBSD) and requests volunteers from other &UNIX; platforms.</para>