Skip to main content
Engineering LibreTexts

02-E.14: User Account Profile Configuration

  • Page ID
    26816
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    What Defines a User's Profile?

    In the Linux world each user can define what their working environment looks like, to an extent. There are certain files that get run when a user logs in to a system. We can break the files into system profiles and individual profiles. There are some files in the /etc directory: /etc/profile, /etc/bash.bashrc (some systems use /etc/bashrc) that will set system wide preferences. Check your man pages for the Bash shell (man bash) and it should give you specific details about your distribution and how it is configured.

    What Do /etc/profile and ~/.profile Do?

    Profiles mainly are used to load environment variables. Since profiles are loaded by login shells, and login shells are the initial entry point into a system, that's the time when setting up the environment makes the most sense. One of the biggest environment variables is the PATH variable. When a login shell is initiated, the PATH is set. Other environment variables also can be set in the system-wide profile or individual user profiles, but just know that the profile system is where most variables are set.

    The order with which profile information is loaded is very important, because if you want to override the system-wide default profile information, you can do so by specifying environment variables in your personal user profile script. For instance, the PATH variable is usually modified by the user's profile script on login. Usually, the .profile (or .bash_profile, etc., see above) script will add ~/bin to the PATH variable if users have their own bin folder inside their home directory. Because user profiles are loaded after the system-wide profile, user settings take precedent and override system-wide settings.

    What Do /etc/bash.bashrc and .bashrc Do?

    The system-wide bashrc file and then the individual user's .bashrc script usually set personal preferences for the command line. If a user wants to customize their prompt, or prefer a specific color scheme, the bashrc system is where that would be set. Like the profile file described above, the user's .bashrc file overrides the system-wide /etc/bash.bashrc (or /etc/bashrc) settings. That means a user can customize the behavior of their command line in any manner they desire without impacting other users on the system.

    The most common customization inside the .bashrc file is to add aliases. An alias is sort of like text expansion, in that it substitutes your defined alias with whatever command you specify. For example, here's a snippet from a .bashrc file in the user's folder:

    alias ll='ls -alF'
    alias la='ls -A'
    alias l='ls -CF'
    
    

    The aliases make it so that if the user types ll on the command line, the system will execute ls -alF instead. It's a great way to make shortcuts for commands with cryptic options or shortcuts for commands you type often.


    This page titled 02-E.14: User Account Profile Configuration is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Patrick McClanahan.

    • Was this article helpful?