source: postlfs/config/profile.xml@ f0dc9578

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since f0dc9578 was f0dc9578, checked in by Pierre Labastie <pieere@…>, 4 years ago

Fix references to the lfs book (chapter numbering changes)
Not sure I have all ot them...*

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

  • Property mode set to 100644
File size: 22.9 KB
RevLine 
[f8d632a]1<?xml version="1.0" encoding="ISO-8859-1"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/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
[81a73ed8]18 <para>
19 The shell program <filename>/bin/bash</filename> (hereafter referred to
20 as just "the shell") uses a collection of startup files to help create
21 an environment. Each file has a specific use and may affect login and
22 interactive environments differently. The files in the <filename
23 class="directory">/etc</filename> directory generally provide global
24 settings. If an equivalent file exists in your home directory it may
25 override the global settings.
26 </para>
27
28 <para>
29 An interactive login shell is started after a successful login, using
30 <filename>/bin/login</filename>, by reading the
31 <filename>/etc/passwd</filename> file. This shell invocation normally reads
32 <filename>/etc/profile</filename> and its private equivalent
33 <filename>~/.bash_profile</filename> (or <filename>~/.profile</filename>
34 if called as <command>/bin/sh</command>) upon startup.
35 </para>
36
37 <para>
38 An interactive non-login shell is normally started at the command-line
39 using a shell program (e.g.,
40 <prompt>[prompt]$</prompt><command>/bin/bash</command>) or by the
41 <command>/bin/su</command> command. An interactive non-login shell is also
42 started with a terminal program such as <command>xterm</command> or
43 <command>konsole</command> from within a graphical environment. This type
44 of shell invocation normally copies the parent environment and then reads
45 the user's <filename>~/.bashrc</filename> file for additional startup
46 configuration instructions.
47 </para>
48
49 <para>
50 A non-interactive shell is usually present when a shell script is
51 running. It is non-interactive because it is processing a script and not
52 waiting for user input between commands. For these shell invocations, only
53 the environment inherited from the parent shell is used.
54 </para>
55
56 <para>
57 The file <filename>~/.bash_logout</filename> is not used for an
58 invocation of the shell. It is read and executed when a user exits from an
59 interactive login shell.
60 </para>
61
62 <para>
63 Many distributions use <filename>/etc/bashrc</filename> for system wide
64 initialization of non-login shells. This file is usually called from the
65 user's <filename>~/.bashrc</filename> file and is not built directly into
66 <command>bash</command> itself. This convention is followed in this
67 section.
68 </para>
69
70 <para>
71 For more information see <command>info bash</command> --
72 <emphasis role="strong">Nodes: Bash Startup Files and Interactive
73 Shells</emphasis>.
74 </para>
[ba0deaad]75
76 <note>
[81a73ed8]77 <para>
78 Most of the instructions below are used to create files located in the
79 <filename class='directory'>/etc</filename> directory structure which
80 requires you to execute the commands as the <systemitem
81 class='username'>root</systemitem> user. If you elect to create the
82 files in user's home directories instead, you should run the commands
83 as an unprivileged user.
84 </para>
[ba0deaad]85 </note>
[2753b70b]86
[81a73ed8]87 <para condition="html" role="usernotes">User Notes:
88 <ulink url="&blfs-wiki;/bash-shell-startup-files"/></para>
[5c3f3856]89
[2753b70b]90 <sect2 id="etc-profile-profile">
91 <title>/etc/profile</title>
92
93 <indexterm zone="postlfs-config-profile etc-profile-profile">
94 <primary sortas="e-etc-profile">/etc/profile</primary>
95 </indexterm>
96
[81a73ed8]97 <para>
98 Here is a base <filename>/etc/profile</filename>. This file starts by
99 setting up some helper functions and some basic parameters. It specifies
100 some <command>bash</command> history parameters and, for security
101 purposes, disables keeping a permanent history file for the <systemitem
102 class="username">root</systemitem> user. It also sets a default user
103 prompt. It then calls small, single purpose scripts in the <filename
104 class='directory'>/etc/profile.d</filename> directory to provide most
105 of the initialization.
106 </para>
107
108 <para>
109 For more information on the escape sequences you can use for your prompt
110 (i.e., the <envar>PS1</envar> environment variable) see <command>info
111 bash</command> -- <emphasis role="strong">Node: Printing a
112 Prompt</emphasis>.
113 </para>
[2753b70b]114
[8e37798]115<screen role="root"><?dbfo keep-together="auto"?><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
[2753b70b]116<literal># Begin /etc/profile
[b554263]117# Written for Beyond Linux From Scratch
118# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[1a396398]119# modifications by Dagmar d'Surreal &lt;rivyqntzne@pbzpnfg.arg&gt;
[384039a]120
[b554263]121# System wide environment variables and startup programs.
[384039a]122
[b554263]123# System wide aliases and functions should go in /etc/bashrc. Personal
124# environment variables and startup programs should go into
125# ~/.bash_profile. Personal aliases and functions should go into
126# ~/.bashrc.
[384039a]127
[1a396398]128# Functions to help us manage paths. Second argument is the name of the
129# path variable to be modified (default: PATH)
130pathremove () {
131 local IFS=':'
132 local NEWPATH
133 local DIR
134 local PATHVARIABLE=${2:-PATH}
135 for DIR in ${!PATHVARIABLE} ; do
136 if [ "$DIR" != "$1" ] ; then
137 NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
138 fi
139 done
140 export $PATHVARIABLE="$NEWPATH"
[b554263]141}
[384039a]142
[1a396398]143pathprepend () {
144 pathremove $1 $2
145 local PATHVARIABLE=${2:-PATH}
146 export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
147}
[384039a]148
[1a396398]149pathappend () {
150 pathremove $1 $2
151 local PATHVARIABLE=${2:-PATH}
152 export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
153}
[384039a]154
[ec7940be]155export -f pathremove pathprepend pathappend
[e9ef7b5e]156
157# Set the initial path
158export PATH=/bin:/usr/bin
159
[1a396398]160if [ $EUID -eq 0 ] ; then
[e9ef7b5e]161 pathappend /sbin:/usr/sbin
[1a396398]162 unset HISTFILE
[b554263]163fi
[384039a]164
[1a396398]165# Setup some environment variables.
166export HISTSIZE=1000
167export HISTIGNORE="&amp;:[bf]g:exit"
[0d7ec6f1]168
[97c713e]169# Set some defaults for graphical systems
[caee7667]170export XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/share/}
171export XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg/}
172export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/tmp/xdg-$USER}
[97c713e]173
[410e228b]174# Setup a red prompt for root and a green one for users.
[0d7ec6f1]175NORMAL="\[\e[0m\]"
176RED="\[\e[1;31m\]"
177GREEN="\[\e[1;32m\]"
178if [[ $EUID == 0 ]] ; then
179 PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
180else
181 PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
182fi
[384039a]183
[1a396398]184for script in /etc/profile.d/*.sh ; do
[d3880c0]185 if [ -r $script ] ; then
[1a396398]186 . $script
187 fi
188done
[384039a]189
[f91e4b98]190unset script RED GREEN NORMAL
[dc53944]191
[2753b70b]192# End /etc/profile</literal>
193EOF</userinput></screen>
[1a396398]194
[2753b70b]195 <sect3 id="etc-profile.d">
196 <title>The /etc/profile.d Directory</title>
[99e8a229]197
[2753b70b]198 <indexterm zone="postlfs-config-profile etc-profile.d">
199 <primary sortas="e-etc-profile.d">/etc/profile.d</primary>
200 </indexterm>
[1a396398]201
[81a73ed8]202 <para>
203 Now create the <filename class='directory'>/etc/profile.d</filename>
204 directory, where the individual initialization scripts are placed:
205 </para>
[1a396398]206
[2753b70b]207<screen role="root"><userinput>install --directory --mode=0755 --owner=root --group=root /etc/profile.d</userinput></screen>
[1a396398]208
[2753b70b]209 </sect3>
[1a396398]210
[931a597]211 <sect3 id="etc-profile.d-bash-completion.sh">
212 <title>/etc/profile.d/bash_completion.sh</title>
213
214 <indexterm zone="postlfs-config-profile etc-profile.d-bash-completion.sh">
215 <primary sortas="e-etc-profile.d-bash-completion.sh">/etc/profile.d/bash_completion.sh</primary>
216 </indexterm>
217
[81a73ed8]218 <note>
219 <para>
220 Using the bash completion script below is controversial. Not all
221 users like it. It adds many (usually over 1000) lines to the bash
222 environment and makes it difficult to use the 'set' command to
223 examine simple environment variables. Omitting this script does
224 not interfere with the ability of bash to use the tab key for file
225 name completion.
226 </para>
227 </note>
228
229 <para>
230 This script imports bash completion scripts, installed by many
231 other BLFS packages, to allow TAB command line completion.
232 </para>
[931a597]233
234<screen role="root"><userinput>cat &gt; /etc/profile.d/bash_completion.sh &lt;&lt; "EOF"
235<literal># Begin /etc/profile.d/bash_completion.sh
236# Import bash completion scripts
237
[5c3f3856]238# If the bash-completion package is installed, use its configuration instead
239if [ -f /usr/share/bash-completion/bash_completion ]; then
240
241 # Check for interactive bash and that we haven't already been sourced.
242 if [ -n "${BASH_VERSION-}" -a -n "${PS1-}" -a -z "${BASH_COMPLETION_VERSINFO-}" ]; then
243
244 # Check for recent enough version of bash.
245 if [ ${BASH_VERSINFO[0]} -gt 4 ] || \
246 [ ${BASH_VERSINFO[0]} -eq 4 -a ${BASH_VERSINFO[1]} -ge 1 ]; then
247 [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion" ] &amp;&amp; \
248 . "${XDG_CONFIG_HOME:-$HOME/.config}/bash_completion"
249 if shopt -q progcomp &amp;&amp; [ -r /usr/share/bash-completion/bash_completion ]; then
250 # Source completion code.
251 . /usr/share/bash-completion/bash_completion
252 fi
253 fi
254 fi
255
256else
257
258 # bash-completions are not installed, use only bash completion directory
259 if shopt -q progcomp; then
260 for script in /etc/bash_completion.d/* ; do
261 if [ -r $script ] ; then
262 . $script
263 fi
264 done
265 fi
266fi
267
[931a597]268# End /etc/profile.d/bash_completion.sh</literal>
269EOF</userinput></screen>
[81a73ed8]270 <para>
271 Make sure that the directory exists:
272 </para>
[931a597]273
274<screen role="root"><userinput>install --directory --mode=0755 --owner=root --group=root /etc/bash_completion.d</userinput></screen>
275
[81a73ed8]276 <para>
277 For a more complete installation, see
278 <ulink url="&blfs-wiki;/bash-shell-startup-files#bash-completions"/>.
279 </para>
[931a597]280
[5c3f3856]281 </sect3>
[931a597]282
[2753b70b]283 <sect3 id="etc-profile.d-dircolors.sh">
284 <title>/etc/profile.d/dircolors.sh</title>
285
286 <indexterm zone="postlfs-config-profile etc-profile.d-dircolors.sh">
287 <primary sortas="e-etc-profile.d-dircolors.sh">/etc/profile.d/dircolors.sh</primary>
288 </indexterm>
289
[81a73ed8]290 <para>
291 This script uses the <filename>~/.dircolors</filename> and
292 <filename>/etc/dircolors</filename> files to control the colors of
293 file names in a directory listing. They control colorized output of
294 things like <command>ls --color</command>. The explanation of how to
295 initialize these files is at the end of this section.
296 </para>
[2753b70b]297
298<screen role="root"><userinput>cat &gt; /etc/profile.d/dircolors.sh &lt;&lt; "EOF"
[b5905ae]299<literal># Setup for /bin/ls and /bin/grep to support color, the alias is in /etc/bashrc.
[1a396398]300if [ -f "/etc/dircolors" ] ; then
301 eval $(dircolors -b /etc/dircolors)
[89ef45fc]302fi
[384039a]303
[89ef45fc]304if [ -f "$HOME/.dircolors" ] ; then
305 eval $(dircolors -b $HOME/.dircolors)
[b554263]306fi
[89ef45fc]307
[b5905ae]308alias ls='ls --color=auto'
309alias grep='grep --color=auto'</literal>
[2753b70b]310EOF</userinput></screen>
311
312 </sect3>
313
314 <sect3 id="extrapaths.sh">
315 <title>/etc/profile.d/extrapaths.sh</title>
316
317 <indexterm zone="postlfs-config-profile extrapaths.sh">
318 <primary sortas="e-etc-profile.d-extrapaths.sh">/etc/profile.d/extrapaths.sh</primary>
319 </indexterm>
320
[81a73ed8]321 <para>
322 This script adds some useful paths to the <envar>PATH</envar> and
323 can be used to customize other PATH related environment variables
324 (e.g. LD_LIBRARY_PATH, etc) that may be needed for all users.
325 </para>
[384039a]326
[2753b70b]327<screen role="root"><userinput>cat &gt; /etc/profile.d/extrapaths.sh &lt;&lt; "EOF"
328<literal>if [ -d /usr/local/lib/pkgconfig ] ; then
[1a396398]329 pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH
330fi
331if [ -d /usr/local/bin ]; then
332 pathprepend /usr/local/bin
[b554263]333fi
[1a396398]334if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then
335 pathprepend /usr/local/sbin
[a4f641b]336fi
[bfa21f3]337
338# Set some defaults before other applications add to these paths.
339pathappend /usr/share/man MANPATH
[a4f641b]340pathappend /usr/share/info INFOPATH</literal>
[2753b70b]341EOF</userinput></screen>
342
343 </sect3>
344
345 <sect3 id="readline.sh">
346 <title>/etc/profile.d/readline.sh</title>
347
348 <indexterm zone="postlfs-config-profile readline.sh">
349 <primary sortas="e-etc-profile.d-readline.sh">/etc/profile.d/readline.sh</primary>
350 </indexterm>
351
[81a73ed8]352 <para>
353 This script sets up the default <filename>inputrc</filename>
354 configuration file. If the user does not have individual settings, it
355 uses the global file.
356 </para>
[2753b70b]357
358<screen role="root"><userinput>cat &gt; /etc/profile.d/readline.sh &lt;&lt; "EOF"
359<literal># Setup the INPUTRC environment variable.
[b554263]360if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
[1a396398]361 INPUTRC=/etc/inputrc
[b554263]362fi
[2753b70b]363export INPUTRC</literal>
364EOF</userinput></screen>
365
366 </sect3>
367
368 <sect3 id="umask.sh">
369 <title>/etc/profile.d/umask.sh</title>
370
371 <indexterm zone="postlfs-config-profile umask.sh">
372 <primary sortas="e-etc-profile.d-umask.sh">/etc/profile.d/umask.sh</primary>
373 </indexterm>
[384039a]374
[81a73ed8]375 <para>
376 Setting the <command>umask</command> value is important for security.
377 Here the default group write permissions are turned off for system
378 users and when the user name and group name are not the same.
379 </para>
[b554263]380
[2753b70b]381<screen role="root"><userinput>cat &gt; /etc/profile.d/umask.sh &lt;&lt; "EOF"
[ec64d28]382<literal># By default, the umask should be set.
[1a396398]383if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then
384 umask 002
385else
386 umask 022
[2753b70b]387fi</literal>
388EOF</userinput></screen>
389
390 </sect3>
391
[be409f9a]392<!-- This is handled in the Xorg section of the book
[2753b70b]393 <sect3 id="X.sh">
394 <title>/etc/profile.d/X.sh</title>
[1a396398]395
[2753b70b]396 <indexterm zone="postlfs-config-profile X.sh">
397 <primary sortas="e-etc-profile.d-X.sh">/etc/profile.d/X.sh</primary>
398 </indexterm>
[1a396398]399
[81a73ed8]400 <para>
401 If <application>X</application> is installed, the <envar>PATH</envar>
402 and <envar>PKG_CONFIG_PATH</envar> variables are also updated.
403 </para>
[1a396398]404
[2753b70b]405<screen role="root"><userinput>cat &gt; /etc/profile.d/X.sh &lt;&lt; "EOF"
406<literal>if [ -x /usr/X11R6/bin/X ]; then
[1a396398]407 pathappend /usr/X11R6/bin
408fi
409if [ -d /usr/X11R6/lib/pkgconfig ] ; then
410 pathappend /usr/X11R6/lib/pkgconfig PKG_CONFIG_PATH
[2753b70b]411fi</literal>
412EOF</userinput></screen>
413
414 </sect3>
[be409f9a]415-->
[d202a49f]416 <sect3 id="i18n.sh">
417 <!-- This is handled system wide on systemd but LANG is not exported to
418 the environment, hence it's return...need to add additional text for
419 systemd only -->
[0d7ec6f1]420 <title>/etc/profile.d/i18n.sh</title>
[2753b70b]421
422 <indexterm zone="postlfs-config-profile i18n.sh">
423 <primary sortas="e-etc-profile.d-i18n.sh">/etc/profile.d/i18n.sh</primary>
424 </indexterm>
425
[81a73ed8]426 <para>
427 This script sets an environment variable necessary for
428 native language support. A full discussion on determining this
429 variable can be found on the <ulink
[f0dc9578]430 url="&lfs-root;/chapter09/profile.html">LFS Bash Shell
[81a73ed8]431 Startup Files</ulink> page.
432 </para>
[2753b70b]433
[1794983d]434<screen role="root" revision="sysv"><userinput>cat &gt; /etc/profile.d/i18n.sh &lt;&lt; "EOF"
[2753b70b]435<literal># Set up i18n variables
[0f442884]436export LANG=<replaceable>&lt;ll&gt;</replaceable>_<replaceable>&lt;CC&gt;</replaceable>.<replaceable>&lt;charmap&gt;</replaceable><replaceable>&lt;@modifiers&gt;</replaceable></literal>
[1794983d]437EOF</userinput></screen>
438
439<screen role="root" revision="systemd"><userinput>cat &gt; /etc/profile.d/i18n.sh &lt;&lt; "EOF"
440<literal># Set up i18n variables
441. /etc/locale.conf
442export LANG</literal>
[2753b70b]443EOF</userinput></screen>
444
445 </sect3>
446
447 <sect3>
448 <title>Other Initialization Values</title>
449
[81a73ed8]450 <para>
451 Other initialization can easily be added to the
452 <filename>profile</filename> by adding additional scripts to the
453 <filename class='directory'>/etc/profile.d</filename> directory.
454 </para>
[2753b70b]455
456 </sect3>
457
458 </sect2>
459
460 <sect2 id="etc-bashrc-profile">
461 <title>/etc/bashrc</title>
462
463 <indexterm zone="postlfs-config-profile etc-bashrc-profile">
464 <primary sortas="e-etc-bashrc">/etc/bashrc</primary>
465 </indexterm>
466
[81a73ed8]467 <para>
468 Here is a base <filename>/etc/bashrc</filename>. Comments in the
469 file should explain everything you need.
470 </para>
[2753b70b]471
472<screen role="root"><userinput>cat &gt; /etc/bashrc &lt;&lt; "EOF"
[384039a]473<literal># Begin /etc/bashrc
474# Written for Beyond Linux From Scratch
[b554263]475# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[4e88613]476# updated by Bruce Dubbs &lt;bdubbs@&lfs-domainname;&gt;
[ad33bab6]477
[b554263]478# System wide aliases and functions.
479
480# System wide environment variables and startup programs should go into
481# /etc/profile. Personal environment variables and startup programs
482# should go into ~/.bash_profile. Personal aliases and functions should
483# go into ~/.bashrc
484
[b5905ae]485# Provides colored /bin/ls and /bin/grep commands. Used in conjunction
486# with code in /etc/profile.
[1a396398]487
[b554263]488alias ls='ls --color=auto'
[b5905ae]489alias grep='grep --color=auto'
[b554263]490
[1a396398]491# Provides prompt for non-login shells, specifically shells started
[2753b70b]492# in the X environment. [Review the LFS archive thread titled
[384039a]493# PS1 Environment Variable for a great case study behind this script
[dd362e5]494# addendum.]
[1a396398]495
[0d7ec6f1]496NORMAL="\[\e[0m\]"
497RED="\[\e[1;31m\]"
498GREEN="\[\e[1;32m\]"
499if [[ $EUID == 0 ]] ; then
500 PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
501else
502 PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
503fi
[28a9992]504
[dc53944]505unset RED GREEN NORMAL
506
[2753b70b]507# End /etc/bashrc</literal>
508EOF</userinput></screen>
509
510 </sect2>
511
512 <sect2 id="bash_profile-profile">
513 <title>~/.bash_profile</title>
514
515 <indexterm zone="postlfs-config-profile bash_profile-profile">
516 <primary sortas="e-AA.bash_profile">~/.bash_profile</primary>
517 </indexterm>
518
[81a73ed8]519 <para>
520 Here is a base <filename>~/.bash_profile</filename>. If you want each
521 new user to have this file automatically, just change the output of
522 the command to <filename>/etc/skel/.bash_profile</filename> and check the
523 permissions after the command is run. You can then copy <filename>
524 /etc/skel/.bash_profile</filename> to the home directories of already
525 existing users, including <systemitem class="username">root</systemitem>,
526 and set the owner and group appropriately.
527 </para>
[2753b70b]528
529<screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
530<literal># Begin ~/.bash_profile
[b554263]531# Written for Beyond Linux From Scratch
532# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
[4e88613]533# updated by Bruce Dubbs &lt;bdubbs@&lfs-domainname;&gt;
[b554263]534
[64d97b7c]535# Personal environment variables and startup programs.
[b554263]536
537# Personal aliases and functions should go in ~/.bashrc. System wide
538# environment variables and startup programs are in /etc/profile.
539# System wide aliases and functions are in /etc/bashrc.
540
541if [ -f "$HOME/.bashrc" ] ; then
[76d61ba]542 source $HOME/.bashrc
[b554263]543fi
544
545if [ -d "$HOME/bin" ] ; then
[dc53944]546 pathprepend $HOME/bin
[b554263]547fi
548
[dc53944]549# Having . in the PATH is dangerous
550#if [ $EUID -gt 99 ]; then
551# pathappend .
552#fi
[b554263]553
[2753b70b]554# End ~/.bash_profile</literal>
555EOF</userinput></screen>
556
557 </sect2>
[384039a]558
[6f36554]559 <sect2 id="dot_profile-profile">
560 <title>~/.profile</title>
561
562 <indexterm zone="postlfs-config-profile dot_profile-profile">
563 <primary sortas="e-AA.dot_profile">~/.profile</primary>
564 </indexterm>
565
[81a73ed8]566 <para>
567 Here is a base <filename>~/.profile</filename>. The comments and
568 instructions for using <filename class="directory">/etc/skel</filename>
569 for <filename>.bash_profile</filename> above also apply here. Only the
570 target file names are different.
571 </para>
[6f36554]572
573<screen><userinput>cat &gt; ~/.profile &lt;&lt; "EOF"
574<literal># Begin ~/.profile
575# Personal environment variables and startup programs.
576
577if [ -d "$HOME/bin" ] ; then
578 pathprepend $HOME/bin
579fi
580
[d202a49f]581# Set up user specific i18n variables
582#export LANG=<replaceable>&lt;ll&gt;</replaceable>_<replaceable>&lt;CC&gt;</replaceable>.<replaceable>&lt;charmap&gt;</replaceable><replaceable>&lt;@modifiers&gt;</replaceable>
583
[6f36554]584# End ~/.profile</literal>
585EOF</userinput></screen>
586
587 </sect2>
588
[2753b70b]589 <sect2 id="bashrc-profile">
590 <title>~/.bashrc</title>
591
592 <indexterm zone="postlfs-config-profile bashrc-profile">
593 <primary sortas="e-AA.bashrc">~/.bashrc</primary>
594 </indexterm>
595
[81a73ed8]596 <para>
597 Here is a base <filename>~/.bashrc</filename>.
598 </para>
[2753b70b]599
600<screen><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
601<literal># Begin ~/.bashrc
[b554263]602# Written for Beyond Linux From Scratch
603# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
604
605# Personal aliases and functions.
606
607# Personal environment variables and startup programs should go in
[64d97b7c]608# ~/.bash_profile. System wide environment variables and startup
[b554263]609# programs are in /etc/profile. System wide aliases and functions are
[384039a]610# in /etc/bashrc.
[b554263]611
612if [ -f "/etc/bashrc" ] ; then
[76d61ba]613 source /etc/bashrc
[b554263]614fi
615
[d202a49f]616# Set up user specific i18n variables
617#export LANG=<replaceable>&lt;ll&gt;</replaceable>_<replaceable>&lt;CC&gt;</replaceable>.<replaceable>&lt;charmap&gt;</replaceable><replaceable>&lt;@modifiers&gt;</replaceable>
618
[2753b70b]619# End ~/.bashrc</literal>
620EOF</userinput></screen>
621
622 </sect2>
[384039a]623
624
[2753b70b]625 <sect2 id="bash_logout-profile">
626 <title>~/.bash_logout</title>
627
628 <indexterm zone="postlfs-config-profile bash_logout-profile">
629 <primary sortas="e-AA.bash_logout">~/.bash_logout</primary>
630 </indexterm>
631
[81a73ed8]632 <para>
633 This is an empty <filename>~/.bash_logout</filename> that can be used as
634 a template. You will notice that the base <filename>~/.bash_logout
635 </filename> does not include a <userinput>clear</userinput> command.
636 This is because the clear is handled in the
637 <filename>/etc/issue</filename> file.
638 </para>
[2753b70b]639
640<screen><userinput>cat &gt; ~/.bash_logout &lt;&lt; "EOF"
641<literal># Begin ~/.bash_logout
[b554263]642# Written for Beyond Linux From Scratch
643# by James Robertson &lt;jameswrobertson@earthlink.net&gt;
644
645# Personal items to perform on logout.
646
[2753b70b]647# End ~/.bash_logout</literal>
648EOF</userinput></screen>
649
650 </sect2>
[384039a]651
652
[2753b70b]653 <sect2 id="etc-dircolors-profile">
654 <title>/etc/dircolors</title>
655
656 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
657 <primary sortas="e-etc-dircolors">/etc/dircolors</primary>
658 </indexterm>
659
660 <indexterm zone="postlfs-config-profile etc-dircolors-profile">
661 <primary sortas="e-AA.dircolors">~/.dircolors</primary>
662 </indexterm>
663
[81a73ed8]664 <para>
665 If you want to use the <filename>dircolors</filename> capability, then
666 run the following command. The <filename class="directory">/etc/skel
667 </filename> setup steps shown above also can be used here to provide
668 a <filename>~/.dircolors</filename> file when a new user is set up.
669 As before, just change the output file name on the following command
670 and assure the permissions, owner, and group are correct on the files
671 created and/or copied.
672 </para>
[2753b70b]673
674<screen role="root"><userinput>dircolors -p > /etc/dircolors</userinput></screen>
675
[81a73ed8]676 <para>
677 If you wish to customize the colors used for different file types, you
678 can edit the <filename>/etc/dircolors</filename> file. The instructions
679 for setting the colors are embedded in the file.
680 </para>
[2753b70b]681
682
[81a73ed8]683 <para>
684 Finally, Ian Macdonald has written an excellent collection of tips and
685 tricks to enhance your shell environment. You can read it online at
686 <ulink url="http://www.caliban.org/bash/index.shtml"/>.
687 </para>
[2753b70b]688
689 </sect2>
690
[b554263]691</sect1>
Note: See TracBrowser for help on using the repository browser.