Finding Configuration Files

Each shell has its own unique set of configuration files. System-wide configuration files usually reside in /etc, and user-specific configuration files are found in users' home directories. Both system-wide and user-specific configuration files come in two varieties: login configuration files and non-login configuration files. Login files apply only to shells launched by a login process, such as a remote Secure Shell (SSH) login or a login at a text-mode console. Non-login configuration files apply to shells that aren't login shells, such as xterm windows launched from a GUI environment or a shell obtained by using su to change the login user's identity. Table 4.3 summarizes the locations of bash configuration files.

Table 4.3: Common bash Configuration Files

Type of File

Login File Location

Non-Login File Location

Global Configuration File

/etc/profile and files in /etc/profile.d

/etc/bashrc or /etc/bash, bash rc

User Configuration File

-/.profile

-/.bashrc

In practice, Table 4.3 is just a starting point; it's possible for a configuration file to source another file, meaning to call the additional file. This is possible because these files are really shell scripts, so you can do anything in these files that you can do in any shell script. One example of sourcing is in the common practice of placing program-specific configurations in the /etc/profile.d subdirectory. Programs that require particular environment variables can place appropriate scripts to set those variables in this directory. Mandrake, Red Hat, Slackware, and SuSE all use this approach, but Debian doesn't by default.

In addition to these common login files, other files can run programs when you log out. Specifically, ~/.bash_logout does this for individual users. You might use this file to run programs that delete sensitive temporary files, shut down any open Point-to-Point Protocol (PPP) links to the Internet, or perform some other task.

0 0

Post a comment