source: postlfs/config/profile.xml@ bdd4ca4

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 bdd4ca4 was bdd4ca4, checked in by Xi Ruoyao <xry111@…>, 3 years ago

prepend /usr/local/share to XDG_DATA_DIRS if it exists

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