Changeset 81a73ed8 for postlfs/config/profile.xml
- Timestamp:
- 03/25/2020 03:07:11 PM (4 years ago)
- Branches:
- 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
- Children:
- 986f53b9
- Parents:
- fa3edfef
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
postlfs/config/profile.xml
rfa3edfef r81a73ed8 16 16 <title>The Bash Shell Startup Files</title> 17 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 22 the <filename class="directory">/etc</filename> directory generally provide 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 27 <filename>/bin/login</filename>, by reading the 28 <filename>/etc/passwd</filename> file. This shell invocation normally reads 29 <filename>/etc/profile</filename> and its private equivalent 30 <filename>~/.bash_profile</filename> (or <filename>~/.profile</filename> if 31 called as <command>/bin/sh</command>) upon startup.</para> 32 33 <para>An interactive non-login shell is normally started at the command-line 34 using a shell program (e.g., 35 <prompt>[prompt]$</prompt><command>/bin/bash</command>) or by the 36 <command>/bin/su</command> command. An interactive non-login shell is also 37 started with a terminal program such as <command>xterm</command> or 38 <command>konsole</command> from within a graphical environment. This type of 39 shell invocation normally copies the parent environment and then reads the 40 user's <filename>~/.bashrc</filename> file for additional startup 41 configuration instructions.</para> 42 43 <para>A non-interactive shell is usually present when a shell script is 44 running. It is non-interactive because it is processing a script and not 45 waiting for user input between commands. For these shell invocations, only 46 the environment inherited from the parent shell is used.</para> 47 48 <para> The file <filename>~/.bash_logout</filename> is not used for an 49 invocation of the shell. It is read and executed when a user exits from an 50 interactive login shell.</para> 51 52 <para>Many distributions use <filename>/etc/bashrc</filename> for system wide 53 initialization of non-login shells. This file is usually called from the 54 user's <filename>~/.bashrc</filename> file and is not built directly into 55 <command>bash</command> itself. This convention is followed in this 56 section.</para> 57 58 <para>For more information see <command>info bash</command> -- 59 <emphasis role="strong">Nodes: Bash Startup Files and Interactive 60 Shells</emphasis>.</para> 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> 61 75 62 76 <note> 63 <para>Most of the instructions below are used to create files located in 64 the <filename class='directory'>/etc</filename> directory structure which 65 requires you to execute the commands as the 66 <systemitem class='username'>root</systemitem> user. If you elect to create 67 the files in user's home directories instead, you should run the commands 68 as an unprivileged user.</para> 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> 69 85 </note> 70 86 71 72 87 <para condition="html" role="usernotes">User Notes: 88 <ulink url="&blfs-wiki;/bash-shell-startup-files"/></para> 73 89 74 90 <sect2 id="etc-profile-profile"> … … 79 95 </indexterm> 80 96 81 <para>Here is a base <filename>/etc/profile</filename>. This file starts by 82 setting up some helper functions and some basic parameters. It specifies some 83 <command>bash</command> history parameters and, for security purposes, 84 disables keeping a permanent history file for the <systemitem 85 class="username">root</systemitem> user. It also sets a 86 default user prompt. It then calls small, single purpose scripts in the 87 <filename class='directory'>/etc/profile.d</filename> directory to provide most 88 of the initialization.</para> 89 90 <para>For more information on the escape sequences you can use for your prompt 91 (i.e., the <envar>PS1</envar> environment variable) see <command>info 92 bash</command> -- <emphasis role="strong">Node: Printing a 93 Prompt</emphasis>.</para> 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> 94 114 95 115 <screen role="root"><?dbfo keep-together="auto"?><userinput>cat > /etc/profile << "EOF" … … 180 200 </indexterm> 181 201 182 <para>Now create the <filename class='directory'>/etc/profile.d</filename> 183 directory, where the individual initialization scripts are placed:</para> 202 <para> 203 Now create the <filename class='directory'>/etc/profile.d</filename> 204 directory, where the individual initialization scripts are placed: 205 </para> 184 206 185 207 <screen role="root"><userinput>install --directory --mode=0755 --owner=root --group=root /etc/profile.d</userinput></screen> … … 194 216 </indexterm> 195 217 196 <note><para>Using the bash completion script below is controversial. 197 Not all users like it. It adds many (usually over 1000) lines to the 198 bash environment and makes it difficult to use the 'set' command to 199 examine simple environment variables. Omitting this script does not 200 interfere with the ability of bash to use the tab key for file name 201 completion.</para></note> 202 203 <para>This script imports bash completion scripts, installed by many 204 other BLFS packages, to allow TAB command line completion.</para> 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> 205 233 206 234 <screen role="root"><userinput>cat > /etc/profile.d/bash_completion.sh << "EOF" … … 240 268 # End /etc/profile.d/bash_completion.sh</literal> 241 269 EOF</userinput></screen> 242 <para>Make sure that the directory exists:</para> 270 <para> 271 Make sure that the directory exists: 272 </para> 243 273 244 274 <screen role="root"><userinput>install --directory --mode=0755 --owner=root --group=root /etc/bash_completion.d</userinput></screen> 245 275 246 <para>For a more complete installation, see 247 <ulink url="&blfs-wiki;/bash-shell-startup-files#bash-completions"/>.</para> 276 <para> 277 For a more complete installation, see 278 <ulink url="&blfs-wiki;/bash-shell-startup-files#bash-completions"/>. 279 </para> 248 280 249 281 </sect3> … … 256 288 </indexterm> 257 289 258 <para>This script uses the <filename>~/.dircolors</filename> and 259 <filename>/etc/dircolors</filename> files to control the colors of file names in a 260 directory listing. They control colorized output of things like <command>ls 261 --color</command>. The explanation of how to initialize these files is at the 262 end of this section.</para> 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> 263 297 264 298 <screen role="root"><userinput>cat > /etc/profile.d/dircolors.sh << "EOF" … … 285 319 </indexterm> 286 320 287 <para>This script adds some useful paths to the <envar>PATH</envar> and 288 can be used to customize other PATH related environment variables 289 (e.g. LD_LIBRARY_PATH, etc) that may be needed for all users.</para> 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> 290 326 291 327 <screen role="root"><userinput>cat > /etc/profile.d/extrapaths.sh << "EOF" … … 314 350 </indexterm> 315 351 316 <para>This script sets up the default <filename>inputrc</filename> 317 configuration file. If the user does not have individual settings, it uses the 318 global file.</para> 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> 319 357 320 358 <screen role="root"><userinput>cat > /etc/profile.d/readline.sh << "EOF" … … 335 373 </indexterm> 336 374 337 <para>Setting the <command>umask</command> value is important for security. 338 Here the default group write permissions are turned off for system users and when 339 the user name and group name are not the same.</para> 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> 340 380 341 381 <screen role="root"><userinput>cat > /etc/profile.d/umask.sh << "EOF" … … 358 398 </indexterm> 359 399 360 <para>If <application>X</application> is installed, the <envar>PATH</envar> 361 and <envar>PKG_CONFIG_PATH</envar> variables are also updated.</para> 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> 362 404 363 405 <screen role="root"><userinput>cat > /etc/profile.d/X.sh << "EOF" … … 382 424 </indexterm> 383 425 384 <para>This script sets an environment variable necessary for 385 native language support. A full discussion on determining this 386 variable can be found on the <ulink 387 url="&lfs-root;/chapter07/profile.html">LFS Bash Shell 388 Startup Files</ulink> page.</para> 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 430 url="&lfs-root;/chapter07/profile.html">LFS Bash Shell 431 Startup Files</ulink> page. 432 </para> 389 433 390 434 <screen role="root" revision="sysv"><userinput>cat > /etc/profile.d/i18n.sh << "EOF" … … 404 448 <title>Other Initialization Values</title> 405 449 406 <para>Other initialization can easily be added to the 407 <filename>profile</filename> by adding additional scripts to the 408 <filename class='directory'>/etc/profile.d</filename> directory.</para> 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> 409 455 410 456 </sect3> … … 419 465 </indexterm> 420 466 421 <para>Here is a base <filename>/etc/bashrc</filename>. Comments in the 422 file should explain everything you need.</para> 467 <para> 468 Here is a base <filename>/etc/bashrc</filename>. Comments in the 469 file should explain everything you need. 470 </para> 423 471 424 472 <screen role="root"><userinput>cat > /etc/bashrc << "EOF" … … 469 517 </indexterm> 470 518 471 <para>Here is a base <filename>~/.bash_profile</filename>. If you want each 472 new user to have this file automatically, just change the output of 473 the command to <filename>/etc/skel/.bash_profile</filename> and check the 474 permissions after the command is run. You can then copy 475 <filename>/etc/skel/.bash_profile</filename> to the home directories of already 476 existing users, including <systemitem class="username">root</systemitem>, 477 and set the owner and group appropriately.</para> 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> 478 528 479 529 <screen><userinput>cat > ~/.bash_profile << "EOF" … … 514 564 </indexterm> 515 565 516 <para>Here is a base <filename>~/.profile</filename>. The comments and 517 instructions for using <filename class="directory">/etc/skel</filename> for 518 <filename>.bash_profile</filename> above also apply here. Only the target 519 file names are different.</para> 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> 520 572 521 573 <screen><userinput>cat > ~/.profile << "EOF" … … 542 594 </indexterm> 543 595 544 <para>Here is a base <filename>~/.bashrc</filename>.</para> 596 <para> 597 Here is a base <filename>~/.bashrc</filename>. 598 </para> 545 599 546 600 <screen><userinput>cat > ~/.bashrc << "EOF" … … 576 630 </indexterm> 577 631 578 <para>This is an empty <filename>~/.bash_logout</filename> that can be used as 579 a template. You will notice that the base <filename>~/.bash_logout</filename> 580 does not include a <userinput>clear</userinput> command. This is because the 581 clear is handled in the <filename>/etc/issue</filename> file.</para> 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> 582 639 583 640 <screen><userinput>cat > ~/.bash_logout << "EOF" … … 605 662 </indexterm> 606 663 607 <para> If you want to use the <filename>dircolors</filename> capability, 608 then run the following command. The 609 <filename class="directory">/etc/skel</filename> setup steps shown above 610 also can be used here to provide a <filename>~/.dircolors</filename> file 611 when a new user is set up. As before, just change the output file name on 612 the following command and assure the permissions, owner, and group are 613 correct on the files created and/or copied.</para> 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> 614 673 615 674 <screen role="root"><userinput>dircolors -p > /etc/dircolors</userinput></screen> 616 675 617 <para>If you wish to customize the colors used for different file types, 618 you can edit the <filename>/etc/dircolors</filename> file. The instructions 619 for setting the colors are embedded in the file.</para> 620 621 622 <para>Finally, Ian Macdonald has written an excellent collection of tips and 623 tricks to enhance your shell environment. You can read it online at 624 <ulink url="http://www.caliban.org/bash/index.shtml"/>.</para> 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> 681 682 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> 625 688 626 689 </sect2>
Note:
See TracChangeset
for help on using the changeset viewer.