Linux Know-How provides a collection of introductory texts on often needed Linux skills. |
Home Bash Guide for Beginners The Bash environment Configuration System-wide configuration files | |||
See also: Individual user configuration files, Setup and Configuration Files | |||
Search the VIAS Library | Index | |||
System-wide configuration files/etc/profileWhen invoked interactively with the --login option or when invoked as sh, Bash reads the /etc/profile instructions. These usually set the shell variables PATH, USER, MAIL, HOSTNAME and HISTSIZE. On some systems, the umask value is configured in /etc/profile; on other systems this file holds pointers to other configuration files such as:
All settings that you want to apply to all your users' environments should be in this file. It might look like this:
This configuration file sets some basic shell environment variables as well as some variables required by users running Java and/or Java applications in their web browser. See Section 3.2. See Chapter 7 for more on the conditional if used in this file; Chapter 9 discusses loops such as the for construct. The Bash source contains sample profile files for general or individual use. These and the one in the example above need changes in order for them to work in your environment! /etc/bashrcOn systems offering multiple types of shells, it might be better to put Bash-specific configurations in this file, since /etc/profile is also read by other shells, such as the Bourne shell. Errors generated by shells that don't understand the Bash syntax are prevented by splitting the configuration files for the different types of shells. In such cases, the user's ~/.bashrc might point to /etc/bashrc in order to include it in the shell initialization process upon login. You might also find that /etc/profile on your system only holds shell environment and program startup settings, while /etc/bashrc contains system-wide definitions for shell functions and aliases. The /etc/bashrc file might be referred to in /etc/profile or in individual user shell initialization files. The source contains sample bashrc files, or you might find a copy in /usr/share/doc/bash-2.05b/startup-files. This is part of the bashrc that comes with the Bash documentation:
Apart from general aliases, it contains useful aliases which make commands work even if you misspell them. We will discuss aliases in Section 3.5.2. This file contains a function, pskill; functions will be studied in detail in Chapter 11.
|
|||
Home Bash Guide for Beginners The Bash environment Configuration System-wide configuration files |