source: postlfs/config/profile.xml@ eeb1e577

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 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 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/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since eeb1e577 was 384039a, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Removed remaining inline tags into titles.

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

  • Property mode set to 100644
File size: 21.7 KB
RevLine 
[f8d632a]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" [
[f8d632a]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
316 <sect3 id="titlebars.sh">
317 <title>/etc/profile.d/xterm-titlebars.sh</title>
318
319 <indexterm zone="postlfs-config-profile titlebars.sh">
320 <primary sortas="e-etc-profile.d-titlebars.sh">/etc/profile.d/titlebars.sh</primary>
321 </indexterm>
322
[384039a]323 <para>This script shows an example of a different way of setting the prompt.
324 The normal variable, <envar>PS1</envar>, is supplemented by
325 <envar>PROMPT_COMMAND</envar>. If set, the value of
326 <envar>PROMPT_COMMAND</envar> is executed as a command prior to
[2753b70b]327 issuing each primary prompt.</para>
[384039a]328
[2753b70b]329<screen role="root"><userinput>cat &gt; /etc/profile.d/xterm-titlebars.sh &lt;&lt; "EOF"
330<literal># The substring match ensures this works for "xterm" and "xterm-xfree86".
[1a396398]331if [ "${TERM:0:5}" = "xterm" ]; then
332 PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} : ${PWD}\007"'
333 export PROMPT_COMMAND
[2753b70b]334fi</literal>
335EOF</userinput></screen>
336
337 </sect3>
338
339 <sect3 id="i18n.sh">
[384039a]340 <title>'/etc/profile.d/i18n.sh'</title>
[2753b70b]341
342 <indexterm zone="postlfs-config-profile i18n.sh">
343 <primary sortas="e-etc-profile.d-i18n.sh">/etc/profile.d/i18n.sh</primary>
344 </indexterm>
345
[384039a]346 <para>This script shows how to set some environment variables necessary for
347 native language support. Setting these variables properly gives you:</para>
[2753b70b]348
349 <itemizedlist>
350 <listitem>
351 <para>the output of programs translated into your native language</para>
352 </listitem>
353 <listitem>
[384039a]354 <para>correct classification of characters into letters, digits and
355 other classes &ndash; this is necessary for <application>Bash</application>
[2753b70b]356 to accept keystrokes properly in non-English locales</para>
357 </listitem>
358 <listitem>
359 <para>the alphabetical sorting order correct for your country</para>
360 </listitem>
361 <listitem>
362 <para>proper default paper size</para>
363 </listitem>
364 <listitem>
365 <para>correct formatting of monetary, time and date values</para>
366 </listitem>
367 </itemizedlist>
368
[384039a]369 <para>Replace <replaceable>[ll]</replaceable> with the two-letter code for
370 your language (e.g., <quote>en</quote>) and
371 <replaceable>[CC]</replaceable> with the two-letter code for your country
372 (e.g., <quote>GB</quote>). Also you may need to specify (and this is actually
373 the preferred form) your character encoding (e.g., <quote>iso8859-1</quote>)
374 after a dot (so that the result is <quote>en_GB.iso8859-1</quote>). Issue the
[2753b70b]375 following command for more information:</para>
376
377<screen><userinput>man 3 setlocale</userinput></screen>
378
[384039a]379 <para>The list of all locales supported by <application>Glibc</application>
[2753b70b]380 can be obtained by running the following command:</para>
381
[384039a]382<screen><userinput>locale -a</userinput></screen>
383
384 <para>After you are sure about your locale settings, create the
385 <filename>/etc/profile.d/i18n.sh</filename> file:</para>
[2753b70b]386
387<screen role="root"><userinput>cat &gt; /etc/profile.d/i18n.sh &lt;&lt; "EOF"
388<literal># Set up i18n variables
[d295e92]389export LC_ALL=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>
390export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>
[2753b70b]391export G_FILENAME_ENCODING=@locale</literal>
392EOF</userinput></screen>
393
[384039a]394 <para>The <envar>LC_ALL</envar> variable sets the same value for all locale
395 categories. For better control, you may prefer to set values individually for
396 all categories listed in the output of the <command>locale</command>
[2753b70b]397 command.</para>
398
399 <para>The <envar>G_FILENAME_ENCODING</envar> variable tells applications
[384039a]400 such as <application>Glib</application> and <application>GTK+</application>
[2753b70b]401 that filenames are in the default locale encoding and not in UTF-8 as
402 assumed by default.</para>
403
404 </sect3>
405
406 <sect3>
407 <title>Other Initialization Values</title>
408
[384039a]409 <para>Other initialization can easily be added to the
410 <filename>profile</filename> by adding additional scripts to the
[2753b70b]411 <filename class='directory'>/etc/profile.d</filename> directory.</para>
412
413 </sect3>
414
415 </sect2>
416
417 <sect2 id="etc-bashrc-profile">
418 <title>/etc/bashrc</title>
419
420 <indexterm zone="postlfs-config-profile etc-bashrc-profile">
421 <primary sortas="e-etc-bashrc">/etc/bashrc</primary>
422 </indexterm>
423
424 <para>Here is a base <filename>/etc/bashrc</filename>. Comments in the
425 file should explain everything you need.</para>
426
427<screen role="root"><userinput>cat &gt; /etc/bashrc &lt;&lt; "EOF"
[384039a]428<literal># Begin /etc/bashrc
429# Written for Beyond Linux From Scratch
[b554263]430# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[ad33bab6]431# updated by Bruce Dubbs &lt;bdubbs@linuxfromscratch.org&gt;
432
433# Make sure that the terminal is set up properly for each shell
434
435if [ -f /etc/profile.d/tinker-term.sh ]; then
436 source /etc/profile.d/tinker-term.sh
437fi
438
439if [ -f /etc/profile.d/xterm-titlebars.sh ]; then
440 source /etc/profile.d/xterm-titlebars.sh
441fi
[b554263]442
443# System wide aliases and functions.
444
445# System wide environment variables and startup programs should go into
446# /etc/profile. Personal environment variables and startup programs
447# should go into ~/.bash_profile. Personal aliases and functions should
448# go into ~/.bashrc
449
450# Provides a colored /bin/ls command. Used in conjunction with code in
451# /etc/profile.
[1a396398]452
[b554263]453alias ls='ls --color=auto'
454
[1a396398]455# Provides prompt for non-login shells, specifically shells started
[2753b70b]456# in the X environment. [Review the LFS archive thread titled
[384039a]457# PS1 Environment Variable for a great case study behind this script
[dd362e5]458# addendum.]
[1a396398]459
[3383489]460#export PS1="[\u@\h \w]\\$ "
461export PS1='\u@\h:\w\$ '
[28a9992]462
[2753b70b]463# End /etc/bashrc</literal>
464EOF</userinput></screen>
465
466 </sect2>
467
468 <sect2 id="bash_profile-profile">
469 <title>~/.bash_profile</title>
470
471 <indexterm zone="postlfs-config-profile bash_profile-profile">
472 <primary sortas="e-AA.bash_profile">~/.bash_profile</primary>
473 </indexterm>
474
475 <para>Here is a base <filename>~/.bash_profile</filename>. If you want each
476 new user to have this file automatically, just change the output of
477 the command to <filename>/etc/skel/.bash_profile</filename> and check the
478 permissions after the command is run. You can then copy
479 <filename>/etc/skel/.bash_profile</filename> to the home directories of already
[384039a]480 existing users, including <systemitem class="username">root</systemitem>,
[2753b70b]481 and set the owner and group appropriately.</para>
482
483<screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
484<literal># Begin ~/.bash_profile
[b554263]485# Written for Beyond Linux From Scratch
486# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[1a396398]487# updated by Bruce Dubbs &lt;bdubbs@linuxfromscratch.org&gt;
[b554263]488
[64d97b7c]489# Personal environment variables and startup programs.
[b554263]490
491# Personal aliases and functions should go in ~/.bashrc. System wide
492# environment variables and startup programs are in /etc/profile.
493# System wide aliases and functions are in /etc/bashrc.
494
[1a396398]495append () {
496 # First remove the directory
497 local IFS=':'
498 local NEWPATH
499 for DIR in $PATH; do
500 if [ "$DIR" != "$1" ]; then
[3f1b51a]501 NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
[384039a]502 fi
[1a396398]503 done
[384039a]504
[1a396398]505 # Then append the directory
506 export PATH=$NEWPATH:$1
507}
508
[b554263]509if [ -f "$HOME/.bashrc" ] ; then
[7008de1]510 source $HOME/.bashrc
[b554263]511fi
512
513if [ -d "$HOME/bin" ] ; then
[384039a]514 append $HOME/bin
[b554263]515fi
516
[1a396398]517unset append
[b554263]518
[2753b70b]519# End ~/.bash_profile</literal>
520EOF</userinput></screen>
521
522 </sect2>
[384039a]523
[2753b70b]524 <sect2 id="bashrc-profile">
525 <title>~/.bashrc</title>
526
527 <indexterm zone="postlfs-config-profile bashrc-profile">
528 <primary sortas="e-AA.bashrc">~/.bashrc</primary>
529 </indexterm>
530
531 <para>Here is a base <filename>~/.bashrc</filename>. The comments and
532 instructions for using <filename class="directory">/etc/skel</filename> for
533 <filename>.bash_profile</filename> above also apply here. Only the target file
534 names are different.</para>
535
536<screen><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
537<literal># Begin ~/.bashrc
[b554263]538# Written for Beyond Linux From Scratch
539# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
540
541# Personal aliases and functions.
542
543# Personal environment variables and startup programs should go in
[64d97b7c]544# ~/.bash_profile. System wide environment variables and startup
[b554263]545# programs are in /etc/profile. System wide aliases and functions are
[384039a]546# in /etc/bashrc.
[b554263]547
548if [ -f "/etc/bashrc" ] ; then
[7008de1]549 source /etc/bashrc
[b554263]550fi
551
[2753b70b]552# End ~/.bashrc</literal>
553EOF</userinput></screen>
554
555 </sect2>
[384039a]556
557
[2753b70b]558 <sect2 id="bash_logout-profile">
559 <title>~/.bash_logout</title>
560
561 <indexterm zone="postlfs-config-profile bash_logout-profile">
562 <primary sortas="e-AA.bash_logout">~/.bash_logout</primary>
563 </indexterm>
564
565 <para>This is an empty <filename>~/.bash_logout</filename> that can be used as
566 a template. You will notice that the base <filename>~/.bash_logout</filename>
567 does not include a <userinput>clear</userinput> command. This is because the
568 clear is handled in the <filename>/etc/issue</filename> file.</para>
569
570<screen><userinput>cat &gt; ~/.bash_logout &lt;&lt; "EOF"
571<literal># Begin ~/.bash_logout
[b554263]572# Written for Beyond Linux From Scratch
573# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
574
575# Personal items to perform on logout.
576
[2753b70b]577# End ~/.bash_logout</literal>
578EOF</userinput></screen>
579
580 </sect2>
[384039a]581
582
[2753b70b]583 <sect2 id="etc-dircolors-profile">
584 <title>/etc/dircolors</title>
585
586 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
587 <primary sortas="e-etc-dircolors">/etc/dircolors</primary>
588 </indexterm>
589
590 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
591 <primary sortas="e-AA.dircolors">~/.dircolors</primary>
592 </indexterm>
593
594 <para> If you want to use the <filename>dircolors</filename> capability, then
595 run the following command. The <filename class="directory">/etc/skel</filename>
596 setup steps seen above also can be used here to provide a
[384039a]597 <filename>~/.dircolors</filename> file when a new user is set up. As before,
[2753b70b]598 just change the output file name on the following command and assure the
[384039a]599 permissions, owner, and group are correct on the files created and/or
[2753b70b]600 copied.</para>
601
602<screen role="root"><userinput>dircolors -p > /etc/dircolors</userinput></screen>
603
604 <para>If you wish to customize the colors used for different file types, you can
[384039a]605 edit the <filename>/etc/dircolors</filename> file. The instructions for setting
[2753b70b]606 the colors are embedded in the file.</para>
607
608
609 <para>Finally, Ian Macdonald has written an excellent collection of tips and
610 tricks to enhance your shell environment. You can read it online at
611 <ulink url="http://www.caliban.org/bash/index.shtml">
612 http://www.caliban.org/bash/index.shtml</ulink>.</para>
613
614 </sect2>
615
[b554263]616</sect1>
Note: See TracBrowser for help on using the repository browser.