[f8d632ac] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 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">
|
---|
[bae6e15] | 9 | <?dbhtml filename="profile.html"?>
|
---|
[b554263] | 10 | <title>The Bash Shell Startup Files</title>
|
---|
[f45b1953] | 11 |
|
---|
[b554263] | 12 | <para>The shell program <filename>/bin/bash</filename> (hereafter
|
---|
[64d97b7c] | 13 | referred to as just "the shell") uses a collection of startup files to
|
---|
[1a396398] | 14 | help create an environment. Each file has a specific use and
|
---|
[cfc2a54] | 15 | may affect login and interactive environments differently. The files in
|
---|
[8604d92f] | 16 | the <filename class="directory">/etc</filename> directory generally provide global
|
---|
[cfc2a54] | 17 | settings. If an equivalent file exists in your home directory it may
|
---|
| 18 | override the global settings.
|
---|
| 19 | </para>
|
---|
| 20 |
|
---|
| 21 | <para>An interactive login shell is started after a successful login, using
|
---|
[1a396398] | 22 | <filename>/bin/login</filename>, by reading the <filename>/etc/passwd</filename>
|
---|
| 23 | file. This shell invocation normally reads <filename>/etc/profile</filename>
|
---|
| 24 | and its private equivalent <filename>~/.bash_profile</filename> upon startup.</para>
|
---|
| 25 |
|
---|
| 26 | <para>An interactive non-login shell is normally started at the command-line
|
---|
[0990cf7a] | 27 | (e.g., <prompt>[prompt]$</prompt><command>/bin/bash</command>) or by the
|
---|
[1a396398] | 28 | <command>/bin/su</command> command. An interactive non-login shell is also
|
---|
| 29 | started with a terminal program such as <command>xterm</command> or
|
---|
| 30 | <command>konsole</command> from within a graphical environment. This type of
|
---|
| 31 | shell invocation normally copies the parent environment and then reads the
|
---|
| 32 | user's <filename>~/.bashrc</filename> file for additional startup configuration
|
---|
| 33 | instructions.</para>
|
---|
| 34 |
|
---|
| 35 | <para>A non-interactive shell is usually present when a shell script is
|
---|
| 36 | running. It is non-interactive because it is processing a script and not
|
---|
[3b7081ba] | 37 | waiting for user input between commands. For these shell invocations, only
|
---|
| 38 | the environment inherited from the parent shell is used.</para>
|
---|
[1a396398] | 39 |
|
---|
| 40 | <para> The file <filename>~/.bash_logout</filename> is not used for an
|
---|
| 41 | invocation of the shell. It is read and executed when a user exits from an
|
---|
| 42 | interactive login shell.</para>
|
---|
| 43 |
|
---|
| 44 | <para>To the standard files, we also add <filename>/etc/bashrc</filename>
|
---|
| 45 | which is called from the user's <filename>~/.bashrc</filename> for
|
---|
| 46 | system wide initialization of non-login shells.</para>
|
---|
[b554263] | 47 |
|
---|
[766bbe40] | 48 | <para>For more information see <command>info bash</command> --
|
---|
| 49 | <emphasis role="strong">Nodes: Bash Startup Files and Interactive
|
---|
| 50 | Shells.</emphasis></para>
|
---|
[b554263] | 51 |
|
---|
[1a396398] | 52 | <sect2>
|
---|
| 53 | <title><filename>/etc/profile</filename></title>
|
---|
[cfc2a54] | 54 |
|
---|
[1a396398] | 55 | <para>Here is a base <filename>/etc/profile</filename>. This file starts by
|
---|
| 56 | setting up some helper functions and some basic parameters. It specifies some
|
---|
| 57 | <filename>bash</filename> history parameters and, for security purposes,
|
---|
| 58 | disables keeping a permanent history file for the root user. It also sets a
|
---|
| 59 | default user prompt. It then calls small, single purpose scripts in the
|
---|
| 60 | <filename class='directory'>/etc/profile.d</filename> directory to provide most
|
---|
| 61 | initialization. </para>
|
---|
[b554263] | 62 |
|
---|
[1a396398] | 63 | <para>For more information on the escape sequences you can use for your prompt
|
---|
[0990cf7a] | 64 | (e.g., the <envar>PS1</envar> environment variable) see <command>info
|
---|
[766bbe40] | 65 | bash</command> -- <emphasis role="strong">Node: Printing a
|
---|
| 66 | Prompt.</emphasis></para>
|
---|
[b554263] | 67 |
|
---|
[766bbe40] | 68 | <screen><userinput><command>cat > /etc/profile << "EOF"</command>
|
---|
| 69 | # Begin /etc/profile
|
---|
[b554263] | 70 | # Written for Beyond Linux From Scratch
|
---|
| 71 | # by James Robertson <jameswrobertson@earthlink.net>
|
---|
[1a396398] | 72 | # modifications by Dagmar d'Surreal <rivyqntzne@pbzpnfg.arg>
|
---|
| 73 |
|
---|
[b554263] | 74 | # System wide environment variables and startup programs.
|
---|
[1a396398] | 75 |
|
---|
[b554263] | 76 | # System wide aliases and functions should go in /etc/bashrc. Personal
|
---|
| 77 | # environment variables and startup programs should go into
|
---|
| 78 | # ~/.bash_profile. Personal aliases and functions should go into
|
---|
| 79 | # ~/.bashrc.
|
---|
[1a396398] | 80 |
|
---|
| 81 | # Functions to help us manage paths. Second argument is the name of the
|
---|
| 82 | # path variable to be modified (default: PATH)
|
---|
| 83 | pathremove () {
|
---|
| 84 | local IFS=':'
|
---|
| 85 | local NEWPATH
|
---|
| 86 | local DIR
|
---|
| 87 | local PATHVARIABLE=${2:-PATH}
|
---|
| 88 | for DIR in ${!PATHVARIABLE} ; do
|
---|
| 89 | if [ "$DIR" != "$1" ] ; then
|
---|
| 90 | NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
|
---|
| 91 | fi
|
---|
| 92 | done
|
---|
| 93 | export $PATHVARIABLE="$NEWPATH"
|
---|
[b554263] | 94 | }
|
---|
[1a396398] | 95 |
|
---|
| 96 | pathprepend () {
|
---|
| 97 | pathremove $1 $2
|
---|
| 98 | local PATHVARIABLE=${2:-PATH}
|
---|
| 99 | export $PATHVARIABLE="$1${!PATHVARIABLE:+:${!PATHVARIABLE}}"
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | pathappend () {
|
---|
| 103 | pathremove $1 $2
|
---|
| 104 | local PATHVARIABLE=${2:-PATH}
|
---|
| 105 | export $PATHVARIABLE="${!PATHVARIABLE:+${!PATHVARIABLE}:}$1"
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | if [ $EUID -eq 0 ] ; then
|
---|
| 109 | unset HISTFILE
|
---|
[b554263] | 110 | fi
|
---|
[1a396398] | 111 |
|
---|
| 112 | # Setup some environment variables.
|
---|
| 113 | export HISTSIZE=1000
|
---|
| 114 | export HISTIGNORE="&:[bf]g:exit"
|
---|
| 115 | #export PS1="[\u@\h \w]\\$ "
|
---|
| 116 | export PS1='\u@\h:\w\$ '
|
---|
| 117 |
|
---|
| 118 | for script in /etc/profile.d/*.sh ; do
|
---|
| 119 | if [ -x $script ] ; then
|
---|
| 120 | . $script
|
---|
| 121 | fi
|
---|
| 122 | done
|
---|
| 123 |
|
---|
| 124 | # Now to clean up after ourselves
|
---|
| 125 | unset pathremove pathprepend pathappend
|
---|
| 126 |
|
---|
| 127 | # End /etc/profile
|
---|
| 128 | <command>EOF</command></userinput></screen>
|
---|
| 129 |
|
---|
| 130 | <para>Now create the <filename class='directory'>/etc/profile.d</filename> directory.</para>
|
---|
| 131 |
|
---|
| 132 | <screen><userinput><command>install --directory --mode=0755 --owner=root --group=root /etc/profile.d</command></userinput></screen>
|
---|
| 133 |
|
---|
| 134 | <sect3>
|
---|
| 135 | <title><filename>/etc/profile.d/dircolors.sh</filename></title>
|
---|
| 136 |
|
---|
| 137 | <para>This script uses the <filename>~/.dircolors</filename> and
|
---|
| 138 | <filename>/etc/dircolors</filename> files to control the colors of file names in a
|
---|
| 139 | directory listing. They control colorized output of things like <command>ls
|
---|
| 140 | --color</command>. The explaination of how to initialize these files is at the
|
---|
| 141 | end of this section. </para>
|
---|
[b554263] | 142 |
|
---|
[1a396398] | 143 |
|
---|
| 144 | <screen><userinput><command>cat > /etc/profile.d/dircolors.sh << "EOF"</command>
|
---|
| 145 | # Setup for /bin/ls to support color, the alias is in /etc/bashrc.
|
---|
| 146 | if [ -f "/etc/dircolors" ] ; then
|
---|
| 147 | eval $(dircolors -b /etc/dircolors)
|
---|
| 148 |
|
---|
| 149 | if [ -f "$HOME/.dircolors" ] ; then
|
---|
| 150 | eval $(dircolors -b $HOME/.dircolors)
|
---|
| 151 | fi
|
---|
[b554263] | 152 | fi
|
---|
[1a396398] | 153 | alias ls='ls --color=auto'
|
---|
| 154 | <command>EOF</command></userinput></screen>
|
---|
| 155 | </sect3>
|
---|
| 156 |
|
---|
[b554263] | 157 |
|
---|
[1a396398] | 158 | <sect3>
|
---|
| 159 | <title><filename>/etc/profile.d/extrapaths.sh</filename></title>
|
---|
| 160 |
|
---|
| 161 | <para>This script adds several useful paths to the <envar>PATH</envar> and
|
---|
| 162 | <envar>PKG_CONFIG_PATH</envar> environment variables. If you want, you can uncomment
|
---|
| 163 | the last section to put a dot at the end of your path. This will allow executables in the
|
---|
[4faa9b91] | 164 | current working directory to be executed without specifiying a ./, however
|
---|
[1a396398] | 165 | you are warned that this is generally considered a security hazard.</para>
|
---|
| 166 |
|
---|
| 167 | <screen><userinput><command>cat > /etc/profile.d/extrapaths.sh << "EOF"</command>
|
---|
| 168 | if [ -d /usr/local/lib/pkgconfig ] ; then
|
---|
| 169 | pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH
|
---|
| 170 | fi
|
---|
| 171 | if [ -d /usr/local/bin ]; then
|
---|
| 172 | pathprepend /usr/local/bin
|
---|
[b554263] | 173 | fi
|
---|
[1a396398] | 174 | if [ -d /usr/local/sbin -a $EUID -eq 0 ]; then
|
---|
| 175 | pathprepend /usr/local/sbin
|
---|
| 176 | fi
|
---|
| 177 | for directory in $(find /opt/*/lib/pkgconfig -type d); do
|
---|
| 178 | pathappend $directory PKG_CONFIG_PATH
|
---|
| 179 | done
|
---|
| 180 | for directory in $(find /opt/*/bin -type d); do
|
---|
| 181 | pathappend $directory
|
---|
| 182 | done
|
---|
| 183 | if [ -d ~/bin ]; then
|
---|
| 184 | pathprepend ~/bin
|
---|
| 185 | fi
|
---|
| 186 | #if [ $EUID -gt 99 ]; then
|
---|
| 187 | # pathappend .
|
---|
| 188 | #fi
|
---|
| 189 | <command>EOF</command></userinput></screen>
|
---|
| 190 | </sect3>
|
---|
[b554263] | 191 |
|
---|
[1a396398] | 192 | <sect3>
|
---|
| 193 | <title><filename>/etc/profile.d/readline.sh</filename></title>
|
---|
[b554263] | 194 |
|
---|
[1a396398] | 195 | <para>This script sets up the default <filename>inputrc</filename> configuration file.
|
---|
| 196 | If the user does not have individual settings, it uses the global file.</para>
|
---|
| 197 |
|
---|
| 198 | <screen><userinput><command>cat > /etc/profile.d/readline.sh << "EOF"</command>
|
---|
[b554263] | 199 | # Setup the INPUTRC environment variable.
|
---|
| 200 | if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ] ; then
|
---|
[1a396398] | 201 | INPUTRC=/etc/inputrc
|
---|
[b554263] | 202 | fi
|
---|
[1a396398] | 203 | export INPUTRC
|
---|
| 204 | <command>EOF</command></userinput></screen>
|
---|
| 205 | </sect3>
|
---|
[b554263] | 206 |
|
---|
[1a396398] | 207 | <sect3>
|
---|
| 208 | <title><filename>/etc/profile.d/tinker-term.sh</filename></title>
|
---|
[b554263] | 209 |
|
---|
[1a396398] | 210 | <para>Some applications need a specific <envar>TERM</envar> setting to support color.</para>
|
---|
| 211 |
|
---|
| 212 | <screen><userinput><command>cat > /etc/profile.d/tinker-term.sh << "EOF"</command>
|
---|
| 213 | # This will tinker with the value of TERM in order to convince certain apps
|
---|
| 214 | # that we can, indeed, display color in their window.
|
---|
| 215 |
|
---|
| 216 | if [ -n "$COLORTERM" ]; then
|
---|
| 217 | export TERM=xterm-color
|
---|
| 218 | fi
|
---|
| 219 |
|
---|
| 220 | if [ "$TERM" = "xterm" ]; then
|
---|
| 221 | export TERM=xterm-color
|
---|
[b554263] | 222 | fi
|
---|
[1a396398] | 223 | <command>EOF</command></userinput></screen>
|
---|
| 224 | </sect3>
|
---|
[b554263] | 225 |
|
---|
[1a396398] | 226 | <sect3>
|
---|
| 227 | <title><filename>/etc/profile.d/umask.sh</filename></title>
|
---|
| 228 |
|
---|
| 229 | <para>Setting the <command>umask</command> value is important for security. Here
|
---|
| 230 | we turn off the default group write permissions for system users and when the
|
---|
| 231 | user name and group name are not the same.</para>
|
---|
[b554263] | 232 |
|
---|
[1a396398] | 233 | <screen><userinput><command>cat > /etc/profile.d/umask.sh << "EOF"</command>
|
---|
| 234 | # By default we want the umask to get set.
|
---|
| 235 | if [ "$(id -gn)" = "$(id -un)" -a $EUID -gt 99 ] ; then
|
---|
| 236 | umask 002
|
---|
| 237 | else
|
---|
| 238 | umask 022
|
---|
| 239 | fi
|
---|
| 240 | <command>EOF</command></userinput></screen>
|
---|
| 241 | </sect3>
|
---|
| 242 |
|
---|
| 243 | <sect3>
|
---|
| 244 | <title><filename>/etc/profile.d/X.sh</filename></title>
|
---|
| 245 |
|
---|
| 246 | <para>If <application>X</application> is installed, we also update the <envar>PATH</envar>
|
---|
| 247 | and <envar>PKG_CONFIG_PATH</envar> variables.</para>
|
---|
| 248 |
|
---|
| 249 | <screen><userinput><command>cat > /etc/profile.d/X.sh << "EOF"</command>
|
---|
| 250 | if [ -x /usr/X11R6/bin/X ]; then
|
---|
| 251 | pathappend /usr/X11R6/bin
|
---|
| 252 | fi
|
---|
| 253 | if [ -d /usr/X11R6/lib/pkgconfig ] ; then
|
---|
| 254 | pathappend /usr/X11R6/lib/pkgconfig PKG_CONFIG_PATH
|
---|
| 255 | fi
|
---|
| 256 | <command>EOF</command></userinput></screen>
|
---|
| 257 | </sect3>
|
---|
| 258 |
|
---|
| 259 | <sect3>
|
---|
| 260 | <title><filename>/etc/profile.d/xterm-titlebars.sh</filename></title>
|
---|
| 261 |
|
---|
| 262 | <para>This script shows an example of a different way of setting the prompt. The normal
|
---|
| 263 | variable, <envar>PS1</envar>, is supplemented by <envar>PROMPT_COMMAND</envar>.
|
---|
| 264 | If set, the value of <envar>PROMPT_COMMAND</envar> is executed as a command prior to
|
---|
| 265 | issuing each primary prompt. </para>
|
---|
| 266 |
|
---|
| 267 | <screen><userinput><command>cat > /etc/profile.d/xterm-titlebars.sh << "EOF"</command>
|
---|
| 268 | # The substring match ensures this will work for "xterm" and "xterm-xfree86".
|
---|
| 269 | if [ "${TERM:0:5}" = "xterm" ]; then
|
---|
| 270 | PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} : ${PWD}\007"'
|
---|
| 271 | export PROMPT_COMMAND
|
---|
| 272 | fi
|
---|
[766bbe40] | 273 | <command>EOF</command></userinput></screen>
|
---|
[b554263] | 274 |
|
---|
[1a396398] | 275 | <para>Other initialization can easily be added to the <filename>profile</filename>
|
---|
| 276 | by adding additional scripts to the
|
---|
| 277 | <filename class='directory'>/etc/profile.d</filename> directory.</para>
|
---|
| 278 | </sect3>
|
---|
| 279 | </sect2>
|
---|
| 280 |
|
---|
| 281 | <sect2>
|
---|
| 282 | <title><filename>/etc/bashrc</filename></title>
|
---|
[b554263] | 283 | <para>Here is a base <filename>/etc/bashrc</filename>. Comments in the
|
---|
| 284 | file should explain everything you need.</para>
|
---|
| 285 |
|
---|
[766bbe40] | 286 | <screen><userinput><command>cat > /etc/bashrc << "EOF"</command>
|
---|
| 287 | # Begin /etc/bashrc
|
---|
[b554263] | 288 | # Written for Beyond Linux From Scratch
|
---|
| 289 | # by James Robertson <jameswrobertson@earthlink.net>
|
---|
| 290 |
|
---|
| 291 | # System wide aliases and functions.
|
---|
| 292 |
|
---|
| 293 | # System wide environment variables and startup programs should go into
|
---|
| 294 | # /etc/profile. Personal environment variables and startup programs
|
---|
| 295 | # should go into ~/.bash_profile. Personal aliases and functions should
|
---|
| 296 | # go into ~/.bashrc
|
---|
| 297 |
|
---|
| 298 | # Provides a colored /bin/ls command. Used in conjunction with code in
|
---|
| 299 | # /etc/profile.
|
---|
[1a396398] | 300 |
|
---|
[b554263] | 301 | alias ls='ls --color=auto'
|
---|
| 302 |
|
---|
[1a396398] | 303 | # Provides prompt for non-login shells, specifically shells started
|
---|
| 304 | # in the <application>X</application> environment. [Review the LFS archive thread titled
|
---|
| 305 | # PS1 Environment Variable for a great case study behind this script addendum.]
|
---|
| 306 |
|
---|
[3383489] | 307 | #export PS1="[\u@\h \w]\\$ "
|
---|
| 308 | export PS1='\u@\h:\w\$ '
|
---|
[28a9992] | 309 |
|
---|
[766bbe40] | 310 | # End /etc/bashrc
|
---|
| 311 | <command>EOF</command></userinput></screen>
|
---|
[1a396398] | 312 | </sect2>
|
---|
| 313 |
|
---|
| 314 |
|
---|
| 315 | <sect2>
|
---|
| 316 | <title><filename>~/.bash_profile</filename></title>
|
---|
[b554263] | 317 |
|
---|
[1a396398] | 318 | <para>Here is a base <filename>~/.bash_profile</filename>. If you want each
|
---|
| 319 | new user to have this file automatically, just change the output of
|
---|
| 320 | the command to <filename>/etc/skel/.bash_profile</filename> and check the
|
---|
[cfc2a54] | 321 | permissions after the command is run. You can then copy
|
---|
[1a396398] | 322 | <filename>/etc/skel/.bash_profile</filename> to the home directories of already
|
---|
| 323 | existing users, including root, and set the owner and group appropriately.
|
---|
[cfc2a54] | 324 | </para>
|
---|
[b554263] | 325 |
|
---|
[766bbe40] | 326 | <screen><userinput><command>cat > ~/.bash_profile << "EOF"</command>
|
---|
| 327 | # Begin ~/.bash_profile
|
---|
[b554263] | 328 | # Written for Beyond Linux From Scratch
|
---|
| 329 | # by James Robertson <jameswrobertson@earthlink.net>
|
---|
[1a396398] | 330 | # updated by Bruce Dubbs <bdubbs@linuxfromscratch.org>
|
---|
[b554263] | 331 |
|
---|
[64d97b7c] | 332 | # Personal environment variables and startup programs.
|
---|
[b554263] | 333 |
|
---|
| 334 | # Personal aliases and functions should go in ~/.bashrc. System wide
|
---|
| 335 | # environment variables and startup programs are in /etc/profile.
|
---|
| 336 | # System wide aliases and functions are in /etc/bashrc.
|
---|
| 337 |
|
---|
[1a396398] | 338 | append () {
|
---|
| 339 | # First remove the directory
|
---|
| 340 | local IFS=':'
|
---|
| 341 | local NEWPATH
|
---|
| 342 | for DIR in $PATH; do
|
---|
| 343 | if [ "$DIR" != "$1" ]; then
|
---|
[3f1b51a] | 344 | NEWPATH=${NEWPATH:+$NEWPATH:}$DIR
|
---|
[1a396398] | 345 | fi
|
---|
| 346 | done
|
---|
| 347 |
|
---|
| 348 | # Then append the directory
|
---|
| 349 | export PATH=$NEWPATH:$1
|
---|
| 350 | }
|
---|
| 351 |
|
---|
[b554263] | 352 | if [ -f "$HOME/.bashrc" ] ; then
|
---|
[7008de1] | 353 | source $HOME/.bashrc
|
---|
[b554263] | 354 | fi
|
---|
| 355 |
|
---|
| 356 | if [ -d "$HOME/bin" ] ; then
|
---|
[1a396398] | 357 | append $HOME/bin
|
---|
[b554263] | 358 | fi
|
---|
| 359 |
|
---|
[1a396398] | 360 | unset append
|
---|
[b554263] | 361 |
|
---|
[766bbe40] | 362 | # End ~/.bash_profile
|
---|
| 363 | <command>EOF</command></userinput></screen>
|
---|
[1a396398] | 364 | </sect2>
|
---|
| 365 |
|
---|
| 366 | <sect2>
|
---|
| 367 | <title><filename>~/.bashrc</filename></title>
|
---|
[b554263] | 368 |
|
---|
[1a396398] | 369 | <para>Here is a base <filename>~/.bashrc</filename>. The comments and
|
---|
[8604d92f] | 370 | instructions for using <filename class="directory">/etc/skel</filename> for
|
---|
[1a396398] | 371 | <filename>.bash_profile</filename> above also apply here. Only the target file
|
---|
| 372 | names are different.</para>
|
---|
[b554263] | 373 |
|
---|
[766bbe40] | 374 | <screen><userinput><command>cat > ~/.bashrc << "EOF"</command>
|
---|
| 375 | # Begin ~/.bashrc
|
---|
[b554263] | 376 | # Written for Beyond Linux From Scratch
|
---|
| 377 | # by James Robertson <jameswrobertson@earthlink.net>
|
---|
| 378 |
|
---|
| 379 | # Personal aliases and functions.
|
---|
| 380 |
|
---|
| 381 | # Personal environment variables and startup programs should go in
|
---|
[64d97b7c] | 382 | # ~/.bash_profile. System wide environment variables and startup
|
---|
[b554263] | 383 | # programs are in /etc/profile. System wide aliases and functions are
|
---|
| 384 | # in /etc/bashrc.
|
---|
| 385 |
|
---|
| 386 | if [ -f "/etc/bashrc" ] ; then
|
---|
[7008de1] | 387 | source /etc/bashrc
|
---|
[b554263] | 388 | fi
|
---|
| 389 |
|
---|
[766bbe40] | 390 | # End ~/.bashrc
|
---|
| 391 | <command>EOF</command></userinput></screen>
|
---|
[1a396398] | 392 | </sect2>
|
---|
| 393 |
|
---|
| 394 |
|
---|
| 395 | <sect2>
|
---|
| 396 | <title><filename>~/.bash_logout</filename></title>
|
---|
[b554263] | 397 |
|
---|
[1a396398] | 398 | <para>This is an empty <filename>~/.bash_logout</filename> that can be used as
|
---|
| 399 | a template. You will notice that the base <filename>~/.bash_logout</filename>
|
---|
| 400 | does not include a <userinput>clear</userinput> command. This is because the
|
---|
| 401 | clear is handled in the <filename>/etc/issue</filename> file.</para>
|
---|
[b554263] | 402 |
|
---|
[766bbe40] | 403 | <screen><userinput><command>cat > ~/.bash_logout << "EOF"</command>
|
---|
| 404 | # Begin ~/.bash_logout
|
---|
[b554263] | 405 | # Written for Beyond Linux From Scratch
|
---|
| 406 | # by James Robertson <jameswrobertson@earthlink.net>
|
---|
| 407 |
|
---|
| 408 | # Personal items to perform on logout.
|
---|
| 409 |
|
---|
[766bbe40] | 410 | # End ~/.bash_logout
|
---|
| 411 | <command>EOF</command></userinput></screen>
|
---|
[1a396398] | 412 | </sect2>
|
---|
| 413 |
|
---|
| 414 |
|
---|
| 415 | <sect2>
|
---|
| 416 | <title><filename>/etc/dircolors</filename></title>
|
---|
| 417 |
|
---|
[3b7081ba] | 418 | <para> If you want to use the <filename>dircolors</filename> capability, then
|
---|
[1a396398] | 419 | run the following command. The <filename class="directory">/etc/skel</filename>
|
---|
| 420 | setup steps seen above also can be used here to provide a
|
---|
| 421 | <filename>.dircolors</filename> file when a new user is set up. As before, just
|
---|
| 422 | change the output file name on the following command and assure the
|
---|
[692e12c] | 423 | permissions, owner, and group are correct on the files created and/or copied.
|
---|
[cfc2a54] | 424 | </para>
|
---|
| 425 |
|
---|
[1a396398] | 426 | <screen><userinput><command>dircolors -p > /etc/dircolors</command></userinput></screen>
|
---|
[b554263] | 427 |
|
---|
[1a396398] | 428 | <para>If you wish to customize the colors used for different file types, you can
|
---|
| 429 | edit the <filename>/etc/dircolors</filename> file. The instructions for setting
|
---|
| 430 | the colors are embedded in the file.</para>
|
---|
| 431 |
|
---|
| 432 |
|
---|
| 433 | <para>Finally, Ian Macdonald has written an excellent collection of tips and
|
---|
[7008de1] | 434 | tricks to enhance your shell environment. You can read it online at
|
---|
| 435 | <ulink
|
---|
[2a87a398] | 436 | url="http://www.caliban.org/bash/index.shtml">http://www.caliban.org/bash/index.shtml</ulink>.</para>
|
---|
[1a396398] | 437 | </sect2>
|
---|
[b554263] | 438 | </sect1>
|
---|