Similar to the initialization files ~/.bashrc or /etc/bash.bashrc of the bash(1) shell, PowerShell also has initialization files.
For example on my system, I can find them in the following locations:
$PROFILE | Select-Object *
AllUsersAllHosts : /snap/powershell/294/opt/powershell/profile.ps1
AllUsersCurrentHost : /snap/powershell/294/opt/powershell/Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts : /home/dviererbe/.config/powershell/profile.ps1
CurrentUserCurrentHost : /home/dviererbe/.config/powershell/Microsoft.PowerShell_profile.ps1
Length : 67
Due to the nature of how snaps work, /snap/powershell/294/** is a read-only file system. Therefore I am unable to change the system-wide initialization file.
The AllUsersAllHosts and AllUsersCurrentHost profile should be in a user writable location.
Similar to the initialization files
~/.bashrcor/etc/bash.bashrcof thebash(1)shell, PowerShell also has initialization files.For example on my system, I can find them in the following locations:
Due to the nature of how snaps work,
/snap/powershell/294/**is a read-only file system. Therefore I am unable to change the system-wide initialization file.The
AllUsersAllHostsandAllUsersCurrentHostprofile should be in a user writable location.