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