Profile Files

Profile files are
hidden files(starting with a dot) in Linux/RHEL that define yourshell environment. They control settings likeenvironment variables, aliases(shortcuts for commands), andterminal behavior. These files are processed in a specific order when you log in or open a terminal window.
Types of Profile Files
system-wide profiles
user-specific profiles.
System-wide Profiles (/etc directory):
/etc/profile: This file contains system-wide environmentvariables and settingsthat apply to all users. It's executed when a user logs in.
/etc/inputrc: This file defineskeyboard mappings and shortcutsfor the readline library, which is used by Bash for command-line editing.
/etc/bashrc: This file contains system-wideBash configurations and functionsthat are applied to all users when they start a new Bash shell.
User Profiles ($HOME directory):
.bash_profile(or.profilefor non-bash shells): Executed for login shells (when you first log in through a terminal). It sets permanent environment variables and aliases.
.bashrc: Executed for all interactive shells (including login shells and subsequent terminal windows). It sets aliases and customizations that you want in all interactive shells.
Create Own Alias
- Open a text editor (e.g.,
nano ~/.profile.d/my_alias.sh) and add the following line, replacingcommandwith the actual command you want to shorten andalias_namewith your preferred alias:
alias alias_name='command'

- Save the file and source it using the following command (replace
my_alias.shwith your filename if different):
source ~/.profile.d/my_alias.sh

- Now, whenever you type
alias_name, the actualcommandwill be executed.

Loading in Home Directory Bash Files:
When you log in or open a terminal:
/etc/profile(if not modified)
/etc/profile.dscripts (alphabetical order)
~/.bash_profile(or~/.profile)For subsequent interactive shells:
~/.bashrc
Impact Based on Shell:
Different shells have different profile files. For example, Bash uses
.bash_profileand.bashrc, while other shells like Zsh may use.zshrc. Customizations made in these files will only affect the behavior of the respective shell.
/etc/skel Directory:
This directory contains skeleton files used to create new user home directories. When a new user is added, files from
/etc/skelare copied to the user's home directory. This ensures consistency in user environments. Common files found in/etc/skelinclude:
.bash_logout(executed when logging out)
.bash_profile(or.profile)
.bashrc








