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