[b32e803] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[1770019] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[b32e803] | 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 | <sect1 id="ch-scripts-inputrc">
|
---|
[bce08ef] | 7 | <title>Creating the /etc/inputrc File</title>
|
---|
[b32e803] | 8 | <?dbhtml filename="inputrc.html"?>
|
---|
| 9 |
|
---|
[81fd230] | 10 | <indexterm zone="ch-scripts-inputrc"><primary sortas="e-/etc/inputrc">/etc/inputrc</primary></indexterm>
|
---|
| 11 |
|
---|
| 12 | <para>The <filename>/etc/inputrc</filename> file deals with mapping
|
---|
| 13 | the keyboard for specific situations. This file is the start-up file
|
---|
| 14 | used by <application>Readline</application>, the input-related
|
---|
| 15 | library used by <application>Bash</application> and most other
|
---|
| 16 | shells.</para>
|
---|
| 17 |
|
---|
[4ccba55] | 18 | <para>For more information, see the <command>bash</command> info page, section
|
---|
| 19 | <emphasis>Readline Init File</emphasis>. The
|
---|
| 20 | <filename class="libraryfile">readline</filename> info page is
|
---|
[81fd230] | 21 | also a good source of information.</para>
|
---|
| 22 |
|
---|
| 23 | <para>Global values are set in <filename>/etc/inputrc</filename>.
|
---|
| 24 | Personal user values are set in <filename>~/.inputrc</filename>. The
|
---|
| 25 | <filename>~/.inputrc</filename> file will override the global settings
|
---|
| 26 | file. A later page sets up Bash to use
|
---|
| 27 | <filename>/etc/inputrc</filename> if there is no
|
---|
| 28 | <filename>.inputrc</filename> for a user when
|
---|
| 29 | <filename>/etc/profile</filename> is read (usually at login). To make
|
---|
| 30 | the system use both, or to negate global keyboard handling, it is a
|
---|
| 31 | good idea to place a default <filename>.inputrc</filename> into the
|
---|
| 32 | <filename class="directory">/etc/skel</filename> directory for use
|
---|
| 33 | with new users.</para>
|
---|
| 34 |
|
---|
| 35 | <para>Below is a base <filename>/etc/inputrc</filename>, along with
|
---|
| 36 | comments to explain what the various options do. Note that comments
|
---|
| 37 | cannot be on the same line as commands.</para>
|
---|
| 38 |
|
---|
| 39 | <para>To create the <filename>.inputrc</filename> in <filename
|
---|
| 40 | class="directory">/etc/skel</filename> using the command below, change
|
---|
| 41 | the command's output to <filename
|
---|
| 42 | class="directory">/etc/skel/.inputrc</filename> and be sure to
|
---|
| 43 | check/set permissions afterward. Copy that file to
|
---|
| 44 | <filename>/etc/inputrc</filename> and the home directory of any user
|
---|
| 45 | already existing on the system, including <emphasis>root</emphasis>,
|
---|
| 46 | that needs a private version of the file. Be certain to use the
|
---|
| 47 | <parameter>-p</parameter> parameter of <command>cp</command> to
|
---|
| 48 | maintain permissions and be sure to change owner and group
|
---|
| 49 | appropriately.</para>
|
---|
[f67f5cf] | 50 |
|
---|
| 51 | <screen><userinput>cat > /etc/inputrc << "EOF"
|
---|
[d72e04a] | 52 | <literal># Begin /etc/inputrc
|
---|
| 53 | # Modified by Chris Lynn <roryo@roryo.dynup.net>
|
---|
[b32e803] | 54 |
|
---|
| 55 | # Make sure we don't output everything on the 1 line
|
---|
| 56 | set horizontal-scroll-mode Off
|
---|
| 57 |
|
---|
| 58 | # Enable 8bit input
|
---|
| 59 | set meta-flag On
|
---|
| 60 | set input-meta On
|
---|
| 61 |
|
---|
| 62 | # Turns off 8th bit stripping
|
---|
| 63 | set convert-meta Off
|
---|
| 64 |
|
---|
| 65 | # Keep the 8th bit for display
|
---|
| 66 | set output-meta On
|
---|
| 67 |
|
---|
| 68 | # none, visible or audible
|
---|
| 69 | set bell-style none
|
---|
| 70 |
|
---|
| 71 | # All of the following map the escape sequence of the
|
---|
| 72 | # value contained inside the 1st argument to the
|
---|
| 73 | # readline specific functions
|
---|
| 74 |
|
---|
| 75 | "\eOd": backward-word
|
---|
| 76 | "\eOc": forward-word
|
---|
| 77 |
|
---|
| 78 | # for linux console
|
---|
| 79 | "\e[1~": beginning-of-line
|
---|
| 80 | "\e[4~": end-of-line
|
---|
| 81 | "\e[5~": beginning-of-history
|
---|
| 82 | "\e[6~": end-of-history
|
---|
| 83 | "\e[3~": delete-char
|
---|
| 84 | "\e[2~": quoted-insert
|
---|
| 85 |
|
---|
| 86 | # for xterm
|
---|
| 87 | "\eOH": beginning-of-line
|
---|
| 88 | "\eOF": end-of-line
|
---|
| 89 |
|
---|
| 90 | # for Konsole
|
---|
| 91 | "\e[H": beginning-of-line
|
---|
| 92 | "\e[F": end-of-line
|
---|
| 93 |
|
---|
[d72e04a] | 94 | # End /etc/inputrc</literal>
|
---|
[f67f5cf] | 95 | EOF</userinput></screen>
|
---|
[b32e803] | 96 |
|
---|
| 97 | </sect1>
|
---|
[81fd230] | 98 |
|
---|