source: postlfs/config/profile.xml@ 683e848a

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 12.2 6.1 6.2 6.2.0 6.2.0-rc1 6.2.0-rc2 6.3 6.3-rc1 6.3-rc2 6.3-rc3 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gimp3 gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/for-12.3 xry111/intltool xry111/llvm18 xry111/soup3 xry111/spidermonkey128 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 683e848a was 683e848a, checked in by Bruce Dubbs <bdubbs@…>, 19 years ago

Fixed startup scripts; removed xterm-title.sh and added extra-prompt.sh

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@4587 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 21.7 KB
RevLine 
[f8d632ac]1<?xml version="1.0" encoding="ISO-8859-1"?>
[ff769b8c]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
[f8d632ac]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
[78b3cd61]8<sect1 id="postlfs-config-profile" xreflabel="The Bash Shell Startup Files">
[2753b70b]9 <?dbhtml filename="profile.html"?>
10
11 <sect1info>
12 <othername>$LastChangedBy$</othername>
13 <date>$Date$</date>
14 </sect1info>
15
16 <title>The Bash Shell Startup Files</title>
17
18 <para>The shell program <filename>/bin/bash</filename> (hereafter
19 referred to as just "the shell") uses a collection of startup files to
20 help create an environment. Each file has a specific use and
21 may affect login and interactive environments differently. The files in
[384039a]22 the <filename class="directory">/etc</filename> directory generally provide
[2753b70b]23 global settings. If an equivalent file exists in your home directory it may
24 override the global settings.</para>
25
26 <para>An interactive login shell is started after a successful login, using
[384039a]27 <filename>/bin/login</filename>, by reading the <filename>/etc/passwd</filename>
28 file. This shell invocation normally reads <filename>/etc/profile</filename>
29 and its private equivalent <filename>~/.bash_profile</filename> upon
[2753b70b]30 startup.</para>
31
32 <para>An interactive non-login shell is normally started at the command-line
33 (e.g., <prompt>[prompt]$</prompt><command>/bin/bash</command>) or by the
34 <command>/bin/su</command> command. An interactive non-login shell is also
35 started with a terminal program such as <command>xterm</command> or
36 <command>konsole</command> from within a graphical environment. This type of
37 shell invocation normally copies the parent environment and then reads the
38 user's <filename>~/.bashrc</filename> file for additional startup configuration
39 instructions.</para>
40
41 <para>A non-interactive shell is usually present when a shell script is
42 running. It is non-interactive because it is processing a script and not
43 waiting for user input between commands. For these shell invocations, only
44 the environment inherited from the parent shell is used.</para>
45
46 <para> The file <filename>~/.bash_logout</filename> is not used for an
47 invocation of the shell. It is read and executed when a user exits from an
48 interactive login shell.</para>
49
[384039a]50 <para>To the standard files, <filename>/etc/bashrc</filename> is called from
51 the user's <filename>~/.bashrc</filename> for system wide initialization of
[2753b70b]52 non-login shells.</para>
53
[384039a]54 <para>For more information see <command>info bash</command> --
[2753b70b]55 <emphasis role="strong">Nodes: Bash Startup Files and Interactive
56 Shells.</emphasis></para>
57
58 <sect2 id="etc-profile-profile">
59 <title>/etc/profile</title>
60
61 <indexterm zone="postlfs-config-profile etc-profile-profile">
62 <primary sortas="e-etc-profile">/etc/profile</primary>
63 </indexterm>
64
65 <para>Here is a base <filename>/etc/profile</filename>. This file starts by
66 setting up some helper functions and some basic parameters. It specifies some
67 <filename>bash</filename> history parameters and, for security purposes,
[384039a]68 disables keeping a permanent history file for the <systemitem
[2753b70b]69 class="username">root</systemitem> user. It also sets a
70 default user prompt. It then calls small, single purpose scripts in the
71 <filename class='directory'>/etc/profile.d</filename> directory to provide most
72 initialization. </para>
73
74 <para>For more information on the escape sequences you can use for your prompt
75 (e.g., the <envar>PS1</envar> environment variable) see <command>info
76 bash</command> -- <emphasis role="strong">Node: Printing a
77 Prompt.</emphasis></para>
78
79<screen role="root"><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
80<literal># Begin /etc/profile
[b554263]81# Written for Beyond Linux From Scratch
82# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[1a396398]83# modifications by Dagmar d'Surreal &lt;rivyqntzne@pbzpnfg.arg&gt;
[384039a]84
[b554263]85# System wide environment variables and startup programs.
[384039a]86
[b554263]87# System wide aliases and functions should go in /etc/bashrc. Personal
88# environment variables and startup programs should go into
89# ~/.bash_profile. Personal aliases and functions should go into
90# ~/.bashrc.
[384039a]91
[1a396398]92# Functions to help us manage paths. Second argument is the name of the
93# path variable to be modified (default: PATH)
94pathremove () {
95 local IFS=':'
96 local NEWPATH
97 local DIR
98 local PATHVARIABLE=${2:-PATH}
99 for DIR in ${!PATHVARIABLE} ; do
100 if [ "$DIR" != "$1" ] ; then
101 NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
102 fi
103 done
104 export $PATHVARIABLE="$NEWPATH"
[b554263]105}
[384039a]106
[1a396398]107pathprepend () {
108 pathremove $1 $2
109 local PATHVARIABLE=${2:-PATH}
110 export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
111}
[384039a]112
[1a396398]113pathappend () {
114 pathremove $1 $2
115 local PATHVARIABLE=${2:-PATH}
116 export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
117}
[384039a]118
[e9ef7b5e]119
120# Set the initial path
121export PATH=/bin:/usr/bin
122
[1a396398]123if [ $EUID -eq 0 ] ; then
[e9ef7b5e]124 pathappend /sbin:/usr/sbin
[1a396398]125 unset HISTFILE
[b554263]126fi
[384039a]127
[1a396398]128# Setup some environment variables.
129export HISTSIZE=1000
130export HISTIGNORE="&amp;:[bf]g:exit"
131#export PS1="[\u@\h \w]\\$ "
132export PS1='\u@\h:\w\$ '
[384039a]133
[1a396398]134for script in /etc/profile.d/*.sh ; do
[d3880c0]135 if [ -r $script ] ; then
[1a396398]136 . $script
137 fi
138done
[384039a]139
[99e8a229]140# Now to clean up
[384039a]141unset pathremove pathprepend pathappend
[1a396398]142
[2753b70b]143# End /etc/profile</literal>
144EOF</userinput></screen>
[1a396398]145
[2753b70b]146 <sect3 id="etc-profile.d">
147 <title>The /etc/profile.d Directory</title>
[99e8a229]148
[2753b70b]149 <indexterm zone="postlfs-config-profile etc-profile.d">
150 <primary sortas="e-etc-profile.d">/etc/profile.d</primary>
151 </indexterm>
[1a396398]152
[384039a]153 <para>Now create the <filename class='directory'>/etc/profile.d</filename>
[2753b70b]154 directory, where the individual initialization scripts are placed.</para>
[1a396398]155
[2753b70b]156<screen role="root"><userinput>install --directory --mode=0755 --owner=root --group=root /etc/profile.d</userinput></screen>
[1a396398]157
[2753b70b]158 </sect3>
[1a396398]159
[2753b70b]160 <sect3 id="etc-profile.d-dircolors.sh">
161 <title>/etc/profile.d/dircolors.sh</title>
162
163 <indexterm zone="postlfs-config-profile etc-profile.d-dircolors.sh">
164 <primary sortas="e-etc-profile.d-dircolors.sh">/etc/profile.d/dircolors.sh</primary>
165 </indexterm>
166
167 <para>This script uses the <filename>~/.dircolors</filename> and
168 <filename>/etc/dircolors</filename> files to control the colors of file names in a
169 directory listing. They control colorized output of things like <command>ls
170 --color</command>. The explaination of how to initialize these files is at the
171 end of this section.</para>
172
173<screen role="root"><userinput>cat &gt; /etc/profile.d/dircolors.sh &lt;&lt; "EOF"
174<literal># Setup for /bin/ls to support color, the alias is in /etc/bashrc.
[1a396398]175if [ -f "/etc/dircolors" ] ; then
176 eval $(dircolors -b /etc/dircolors)
[384039a]177
[1a396398]178 if [ -f "$HOME/.dircolors" ] ; then
179 eval $(dircolors -b $HOME/.dircolors)
180 fi
[b554263]181fi
[2753b70b]182alias ls='ls --color=auto'</literal>
183EOF</userinput></screen>
184
185 </sect3>
186
187 <sect3 id="extrapaths.sh">
188 <title>/etc/profile.d/extrapaths.sh</title>
189
190 <indexterm zone="postlfs-config-profile extrapaths.sh">
191 <primary sortas="e-etc-profile.d-extrapaths.sh">/etc/profile.d/extrapaths.sh</primary>
192 </indexterm>
193
194 <para>This script adds several useful paths to the <envar>PATH</envar> and
[384039a]195 <envar>PKG_CONFIG_PATH</envar> environment variables. If you want, you
196 can uncomment the last section to put a dot at the end of your path. This will
197 allow executables in the current working directory to be executed without
198 specifiying a ./, however you are warned that this is generally considered a
[2753b70b]199 security hazard.</para>
[384039a]200
[2753b70b]201<screen role="root"><userinput>cat &gt; /etc/profile.d/extrapaths.sh &lt;&lt; "EOF"
202<literal>if [ -d /usr/local/lib/pkgconfig ] ; then
[1a396398]203 pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH
204fi
205if [ -d /usr/local/bin ]; then
206 pathprepend /usr/local/bin
[b554263]207fi
[1a396398]208if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then
209 pathprepend /usr/local/sbin
210fi
[d3880c0]211for directory in $(find /opt/*/lib/pkgconfig -type d 2>/dev/null); do
[1a396398]212 pathappend $directory PKG_CONFIG_PATH
213done
[d3880c0]214for directory in $(find /opt/*/bin -type d 2>/dev/null); do
[1a396398]215 pathappend $directory
216done
217if [ -d ~/bin ]; then
218 pathprepend ~/bin
219fi
220#if [ $EUID -gt 99 ]; then
221# pathappend .
[2753b70b]222#fi</literal>
223EOF</userinput></screen>
224
225 </sect3>
226
227 <sect3 id="readline.sh">
228 <title>/etc/profile.d/readline.sh</title>
229
230 <indexterm zone="postlfs-config-profile readline.sh">
231 <primary sortas="e-etc-profile.d-readline.sh">/etc/profile.d/readline.sh</primary>
232 </indexterm>
233
[384039a]234 <para>This script sets up the default <filename>inputrc</filename>
235 configuration file. If the user does not have individual settings, it uses the
[2753b70b]236 global file.</para>
237
238<screen role="root"><userinput>cat &gt; /etc/profile.d/readline.sh &lt;&lt; "EOF"
239<literal># Setup the INPUTRC environment variable.
[b554263]240if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
[1a396398]241 INPUTRC=/etc/inputrc
[b554263]242fi
[2753b70b]243export INPUTRC</literal>
244EOF</userinput></screen>
245
246 </sect3>
247
248 <sect3 id="tinker-term.sh">
249 <title>/etc/profile.d/tinker-term.sh</title>
250
251 <indexterm zone="postlfs-config-profile tinker-term.sh">
252 <primary sortas="e-etc-profile.d-tinker-term.sh">/etc/profile.d/tinker-term.sh</primary>
253 </indexterm>
254
[384039a]255 <para>Some applications need a specific <envar>TERM</envar> setting to
[2753b70b]256 support color.</para>
257
258<screen role="root"><userinput>cat &gt; /etc/profile.d/tinker-term.sh &lt;&lt; "EOF"
[384039a]259<literal># This will tinker with the value of TERM in order to convince certain
[dd362e5]260# apps that we can, indeed, display color in their window.
[384039a]261
[1a396398]262if [ -n "$COLORTERM" ]; then
263 export TERM=xterm-color
264fi
[384039a]265
[1a396398]266if [ "$TERM" = "xterm" ]; then
267 export TERM=xterm-color
[2753b70b]268fi</literal>
269EOF</userinput></screen>
270
271 </sect3>
272
273 <sect3 id="umask.sh">
274 <title>/etc/profile.d/umask.sh</title>
275
276 <indexterm zone="postlfs-config-profile umask.sh">
277 <primary sortas="e-etc-profile.d-umask.sh">/etc/profile.d/umask.sh</primary>
278 </indexterm>
[384039a]279
280 <para>Setting the <command>umask</command> value is important for security.
281 Here the default group write permissions are turned off for system users and when
[2753b70b]282 the user name and group name are not the same.</para>
[b554263]283
[2753b70b]284<screen role="root"><userinput>cat &gt; /etc/profile.d/umask.sh &lt;&lt; "EOF"
285<literal># By default we want the umask to get set.
[1a396398]286if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then
287 umask 002
288else
289 umask 022
[2753b70b]290fi</literal>
291EOF</userinput></screen>
292
293 </sect3>
294
295 <sect3 id="X.sh">
296 <title>/etc/profile.d/X.sh</title>
[1a396398]297
[2753b70b]298 <indexterm zone="postlfs-config-profile X.sh">
299 <primary sortas="e-etc-profile.d-X.sh">/etc/profile.d/X.sh</primary>
300 </indexterm>
[1a396398]301
[384039a]302 <para>If <application>X</application> is installed, the <envar>PATH</envar>
[2753b70b]303 and <envar>PKG_CONFIG_PATH</envar> variables are also updated.</para>
[1a396398]304
[2753b70b]305<screen role="root"><userinput>cat &gt; /etc/profile.d/X.sh &lt;&lt; "EOF"
306<literal>if [ -x /usr/X11R6/bin/X ]; then
[1a396398]307 pathappend /usr/X11R6/bin
308fi
309if [ -d /usr/X11R6/lib/pkgconfig ] ; then
310 pathappend /usr/X11R6/lib/pkgconfig PKG_CONFIG_PATH
[2753b70b]311fi</literal>
312EOF</userinput></screen>
313
314 </sect3>
315
[683e848a]316 <sect3 id="extra-prompt.sh">
317 <title>/etc/profile.d/extra-prompt.sh</title>
[2753b70b]318
[683e848a]319 <indexterm zone="postlfs-config-profile extra-prompt.sh">
320 <primary sortas="e-etc-profile.d-prompt.sh">/etc/profile.d/extra-prompt.sh</primary>
[2753b70b]321 </indexterm>
322
[683e848a]323 <para>This script shows an example of a different way of setting the
324 prompt. The normal variable, <envar>PS1</envar>, is supplemented by
[384039a]325 <envar>PROMPT_COMMAND</envar>. If set, the value of
[683e848a]326 <envar>PROMPT_COMMAND</envar> is executed as a command prior to issuing
327 each primary prompt. The sequence \e is an ESC character. \a is a
328 BEL character. For a reference on xterm escape sequences, see <ulink
329 url="http://rtfm.etla.org/xterm/ctlseq.html"/></para>
330
331<screen role="root"><userinput>cat &gt; /etc/profile.d/extra-prompt.sh &lt;&lt; "EOF"
332<literal>PROMPT_COMMAND="echo -ne '\e[1m${USER}@${HOSTNAME} : ${PWD}\e[0m\a'"
333export PROMPT_COMMAND</literal>
[2753b70b]334EOF</userinput></screen>
335
[683e848a]336 <para>The escape sequences above are BOLD, NORMAL, and BEL.</para>
337
[2753b70b]338 </sect3>
339
340 <sect3 id="i18n.sh">
[384039a]341 <title>'/etc/profile.d/i18n.sh'</title>
[2753b70b]342
343 <indexterm zone="postlfs-config-profile i18n.sh">
344 <primary sortas="e-etc-profile.d-i18n.sh">/etc/profile.d/i18n.sh</primary>
345 </indexterm>
346
[384039a]347 <para>This script shows how to set some environment variables necessary for
348 native language support. Setting these variables properly gives you:</para>
[2753b70b]349
350 <itemizedlist>
351 <listitem>
352 <para>the output of programs translated into your native language</para>
353 </listitem>
354 <listitem>
[384039a]355 <para>correct classification of characters into letters, digits and
356 other classes &ndash; this is necessary for <application>Bash</application>
[2753b70b]357 to accept keystrokes properly in non-English locales</para>
358 </listitem>
359 <listitem>
360 <para>the alphabetical sorting order correct for your country</para>
361 </listitem>
362 <listitem>
363 <para>proper default paper size</para>
364 </listitem>
365 <listitem>
366 <para>correct formatting of monetary, time and date values</para>
367 </listitem>
368 </itemizedlist>
369
[384039a]370 <para>Replace <replaceable>[ll]</replaceable> with the two-letter code for
371 your language (e.g., <quote>en</quote>) and
372 <replaceable>[CC]</replaceable> with the two-letter code for your country
373 (e.g., <quote>GB</quote>). Also you may need to specify (and this is actually
374 the preferred form) your character encoding (e.g., <quote>iso8859-1</quote>)
375 after a dot (so that the result is <quote>en_GB.iso8859-1</quote>). Issue the
[2753b70b]376 following command for more information:</para>
377
378<screen><userinput>man 3 setlocale</userinput></screen>
379
[384039a]380 <para>The list of all locales supported by <application>Glibc</application>
[2753b70b]381 can be obtained by running the following command:</para>
382
[384039a]383<screen><userinput>locale -a</userinput></screen>
384
385 <para>After you are sure about your locale settings, create the
386 <filename>/etc/profile.d/i18n.sh</filename> file:</para>
[2753b70b]387
388<screen role="root"><userinput>cat &gt; /etc/profile.d/i18n.sh &lt;&lt; "EOF"
389<literal># Set up i18n variables
[d295e92]390export LC_ALL=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>
391export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>
[2753b70b]392export G_FILENAME_ENCODING=@locale</literal>
393EOF</userinput></screen>
394
[384039a]395 <para>The <envar>LC_ALL</envar> variable sets the same value for all locale
396 categories. For better control, you may prefer to set values individually for
397 all categories listed in the output of the <command>locale</command>
[2753b70b]398 command.</para>
399
400 <para>The <envar>G_FILENAME_ENCODING</envar> variable tells applications
[384039a]401 such as <application>Glib</application> and <application>GTK+</application>
[2753b70b]402 that filenames are in the default locale encoding and not in UTF-8 as
403 assumed by default.</para>
404
405 </sect3>
406
407 <sect3>
408 <title>Other Initialization Values</title>
409
[384039a]410 <para>Other initialization can easily be added to the
411 <filename>profile</filename> by adding additional scripts to the
[2753b70b]412 <filename class='directory'>/etc/profile.d</filename> directory.</para>
413
414 </sect3>
415
416 </sect2>
417
418 <sect2 id="etc-bashrc-profile">
419 <title>/etc/bashrc</title>
420
421 <indexterm zone="postlfs-config-profile etc-bashrc-profile">
422 <primary sortas="e-etc-bashrc">/etc/bashrc</primary>
423 </indexterm>
424
425 <para>Here is a base <filename>/etc/bashrc</filename>. Comments in the
426 file should explain everything you need.</para>
427
428<screen role="root"><userinput>cat &gt; /etc/bashrc &lt;&lt; "EOF"
[384039a]429<literal># Begin /etc/bashrc
430# Written for Beyond Linux From Scratch
[b554263]431# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[ad33bab6]432# updated by Bruce Dubbs &lt;bdubbs@linuxfromscratch.org&gt;
433
434# Make sure that the terminal is set up properly for each shell
435
436if [ -f /etc/profile.d/tinker-term.sh ]; then
437 source /etc/profile.d/tinker-term.sh
438fi
439
[b554263]440# System wide aliases and functions.
441
442# System wide environment variables and startup programs should go into
443# /etc/profile. Personal environment variables and startup programs
444# should go into ~/.bash_profile. Personal aliases and functions should
445# go into ~/.bashrc
446
447# Provides a colored /bin/ls command. Used in conjunction with code in
448# /etc/profile.
[1a396398]449
[b554263]450alias ls='ls --color=auto'
451
[1a396398]452# Provides prompt for non-login shells, specifically shells started
[2753b70b]453# in the X environment. [Review the LFS archive thread titled
[384039a]454# PS1 Environment Variable for a great case study behind this script
[dd362e5]455# addendum.]
[1a396398]456
[3383489]457#export PS1="[\u@\h \w]\\$ "
458export PS1='\u@\h:\w\$ '
[28a9992]459
[2753b70b]460# End /etc/bashrc</literal>
461EOF</userinput></screen>
462
463 </sect2>
464
465 <sect2 id="bash_profile-profile">
466 <title>~/.bash_profile</title>
467
468 <indexterm zone="postlfs-config-profile bash_profile-profile">
469 <primary sortas="e-AA.bash_profile">~/.bash_profile</primary>
470 </indexterm>
471
472 <para>Here is a base <filename>~/.bash_profile</filename>. If you want each
473 new user to have this file automatically, just change the output of
474 the command to <filename>/etc/skel/.bash_profile</filename> and check the
475 permissions after the command is run. You can then copy
476 <filename>/etc/skel/.bash_profile</filename> to the home directories of already
[384039a]477 existing users, including <systemitem class="username">root</systemitem>,
[2753b70b]478 and set the owner and group appropriately.</para>
479
480<screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
481<literal># Begin ~/.bash_profile
[b554263]482# Written for Beyond Linux From Scratch
483# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[1a396398]484# updated by Bruce Dubbs &lt;bdubbs@linuxfromscratch.org&gt;
[b554263]485
[64d97b7c]486# Personal environment variables and startup programs.
[b554263]487
488# Personal aliases and functions should go in ~/.bashrc. System wide
489# environment variables and startup programs are in /etc/profile.
490# System wide aliases and functions are in /etc/bashrc.
491
[1a396398]492append () {
493 # First remove the directory
494 local IFS=':'
495 local NEWPATH
496 for DIR in $PATH; do
497 if [ "$DIR" != "$1" ]; then
[3f1b51a]498 NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
[384039a]499 fi
[1a396398]500 done
[384039a]501
[1a396398]502 # Then append the directory
503 export PATH=$NEWPATH:$1
504}
505
[b554263]506if [ -f "$HOME/.bashrc" ] ; then
[7008de1]507 source $HOME/.bashrc
[b554263]508fi
509
510if [ -d "$HOME/bin" ] ; then
[384039a]511 append $HOME/bin
[b554263]512fi
513
[1a396398]514unset append
[b554263]515
[2753b70b]516# End ~/.bash_profile</literal>
517EOF</userinput></screen>
518
519 </sect2>
[384039a]520
[2753b70b]521 <sect2 id="bashrc-profile">
522 <title>~/.bashrc</title>
523
524 <indexterm zone="postlfs-config-profile bashrc-profile">
525 <primary sortas="e-AA.bashrc">~/.bashrc</primary>
526 </indexterm>
527
528 <para>Here is a base <filename>~/.bashrc</filename>. The comments and
529 instructions for using <filename class="directory">/etc/skel</filename> for
530 <filename>.bash_profile</filename> above also apply here. Only the target file
531 names are different.</para>
532
533<screen><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
534<literal># Begin ~/.bashrc
[b554263]535# Written for Beyond Linux From Scratch
536# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
537
538# Personal aliases and functions.
539
540# Personal environment variables and startup programs should go in
[64d97b7c]541# ~/.bash_profile. System wide environment variables and startup
[b554263]542# programs are in /etc/profile. System wide aliases and functions are
[384039a]543# in /etc/bashrc.
[b554263]544
545if [ -f "/etc/bashrc" ] ; then
[7008de1]546 source /etc/bashrc
[b554263]547fi
548
[2753b70b]549# End ~/.bashrc</literal>
550EOF</userinput></screen>
551
552 </sect2>
[384039a]553
554
[2753b70b]555 <sect2 id="bash_logout-profile">
556 <title>~/.bash_logout</title>
557
558 <indexterm zone="postlfs-config-profile bash_logout-profile">
559 <primary sortas="e-AA.bash_logout">~/.bash_logout</primary>
560 </indexterm>
561
562 <para>This is an empty <filename>~/.bash_logout</filename> that can be used as
563 a template. You will notice that the base <filename>~/.bash_logout</filename>
564 does not include a <userinput>clear</userinput> command. This is because the
565 clear is handled in the <filename>/etc/issue</filename> file.</para>
566
567<screen><userinput>cat &gt; ~/.bash_logout &lt;&lt; "EOF"
568<literal># Begin ~/.bash_logout
[b554263]569# Written for Beyond Linux From Scratch
570# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
571
572# Personal items to perform on logout.
573
[2753b70b]574# End ~/.bash_logout</literal>
575EOF</userinput></screen>
576
577 </sect2>
[384039a]578
579
[2753b70b]580 <sect2 id="etc-dircolors-profile">
581 <title>/etc/dircolors</title>
582
583 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
584 <primary sortas="e-etc-dircolors">/etc/dircolors</primary>
585 </indexterm>
586
587 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
588 <primary sortas="e-AA.dircolors">~/.dircolors</primary>
589 </indexterm>
590
591 <para> If you want to use the <filename>dircolors</filename> capability, then
592 run the following command. The <filename class="directory">/etc/skel</filename>
593 setup steps seen above also can be used here to provide a
[384039a]594 <filename>~/.dircolors</filename> file when a new user is set up. As before,
[2753b70b]595 just change the output file name on the following command and assure the
[384039a]596 permissions, owner, and group are correct on the files created and/or
[2753b70b]597 copied.</para>
598
599<screen role="root"><userinput>dircolors -p > /etc/dircolors</userinput></screen>
600
601 <para>If you wish to customize the colors used for different file types, you can
[384039a]602 edit the <filename>/etc/dircolors</filename> file. The instructions for setting
[2753b70b]603 the colors are embedded in the file.</para>
604
605
606 <para>Finally, Ian Macdonald has written an excellent collection of tips and
607 tricks to enhance your shell environment. You can read it online at
608 <ulink url="http://www.caliban.org/bash/index.shtml">
609 http://www.caliban.org/bash/index.shtml</ulink>.</para>
610
611 </sect2>
612
[b554263]613</sect1>
Note: See TracBrowser for help on using the repository browser.