Maojui

Shell Profiles

2023-08-04

Global

Linux: /etc/profile : provides system-wide configuration for all Bourne compatible shells (sh, bash, ksh, etc.)
Windows : Set Environment Variable

Zsh

Commands are first read from ~/.zshenv
Then, if the shell is a login shell : /etc/zprofile -> ~/.zprofile
Then, if the shell is interactive, /etc/zshrc -> ~/.zshrc.
Finally, if the shell is a login shell, /etc/zlogin -> ~/.zlogin are read.

Bash

/etc/bash.bashrc : bash-specific, and will be run for both login and non-login shells.

Local

~/.bashrc defines the settings for a user when running a subshell.
~/.bash_profile defines the settings for a user when running a login shell.

Powershell

All Users, All Hosts

Windows - $PSHOME\Profile.ps1
Linux - /opt/microsoft/powershell/7/profile.ps1
macOS - /usr/local/microsoft/powershell/7/profile.ps1

Users, Current Host

Windows - $PSHOME\Microsoft.PowerShell_profile.ps1
Linux - /opt/microsoft/powershell/7/Microsoft.PowerShell_profile.ps1
macOS - /usr/local/microsoft/powershell/7/Microsoft.PowerShell_profile.ps1

Current User, All Hosts

Windows - $HOME\Documents\PowerShell\Profile.ps1
Linux - ~/.config/powershell/profile.ps1
macOS - ~/.config/powershell/profile.ps1

Current user, Current Host

Windows - $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Linux - ~/.config/powershell/Microsoft.PowerShell_profile.ps1
macOS - ~/.config/powershell/Microsoft.PowerShell_profile.ps1