No .zprofile on new install - how are shell configs loaded in Manjaro?

New to Manjaro and trying to configure zsh. I note there is no .zprofile in $HOME but there is a .profile which seems to be parsed when using zsh. In Arch I specified emulate sh -c '. ~/.profile' in .zprofile but this appears to be happening by default in Manjaro. Can someone help me understand how this is configured and the hierarchy of config files for zsh in Manjaro?

.zshrc ?

2 Likes

Exists, but .zprofile is read before .zshrc and should contain different options to .zshrc.

https://wiki.archlinux.org/title/Zsh

1 Like

It is for you to create and populate.
That is how I read the Arch Wiki description.

1 Like

but how is .profile being parsed if .zprofile doesn’t explicitly call on it? .profile isn’t ordinarily associated with zsh

It is probably sourced from one of the other startup files.
I don’t use zsh and can’t look at the moment.

If I run grep "\.profile" ~/.* 2> /dev/null I get nothing though.

You should investigate the manjaro-zsh-config package that probably is installed.

3 Likes

Yep, looked at that already but couldn’t find anything that would explain this.

Project is here should anyone else be interested: GitHub - Chrysostomus/manjaro-zsh-config: Zsh configuration package for manjaro

1 Like

I have .zsh folder (with powerlevel folder inside) then .zshrc, .p10k.zsh and .zsh_history - no .zprofile.

.profile
export EDITOR='/usr/bin/micro'
export SUDO_EDITOR=/usr/bin/micro
export VISUAL='/usr/bin/kate'
export PAGER=bat
export MOAR='--statusbar=bold'
export MANPAGER="batman"
export DIFFPROG="meld"

Every now and then I have to go checking in .profile, .zshrc, fishconfig etc to make sure I don’t keep duplicating stuff that gets thrown in the wrong place…


/etc/zsh/zprofile

If you didn’t create your own .zprofile, then this is the only one.

If you’re freshly setting it up, I’d advise frequent snapshots and, if possible, instead of being tempted by frameworks like ‘oh-my-GOD’ just DIY for a more efficient config.

3 Likes

I guess I’ll have to look into this zsh stuff at some point since it’s become so ubiuitous these days.

Isn’t there something in /etc/skel to start with?

Of course, I prefer and will stick to BASH as long as possible. :wink:

EDIT: Just checked one of mine, but bear in mind I never set up zsh on this one:

$ ls -la /etc/skel
total 52
drwxr-xr-x   3 root root  4096 Sep 17 02:32 .
drwxr-xr-x 121 root root 12288 Oct 11 01:35 ..
-rw-r--r--   1 root root    21 Aug  2 15:56 .bash_logout
-rw-r--r--   1 root root    57 Aug  2 15:56 .bash_profile
-rw-r--r--   1 root root  3270 Aug  2 15:56 .bashrc
drwxr-xr-x   4 root root  4096 Jan 31  2025 .config
-rw-r--r--   1 root root  4855 Jun 30  2024 .dir_colors
-rwxr-xr-x   1 root root   100 Jun 30  2024 .Xclients
-rwxr-xr-x   1 root root  1637 Nov 19  2024 .xinitrc
-rw-r--r--   1 root root   382 May 15 17:11 .zshrc

The file /etc/zsh/zprofile is mentioned in Arch’s wiki:

/etc/zsh/zprofile Used for executing commands at start for all users, will be read when starting as a login shell. Please note that on Arch Linux, by default it contains one line which sources /etc/profile. See warning below before wanting to remove that!

The file comes from the zsh package and the package comes directly from Arch:

> pacman -Qi zsh
Name            : zsh
Version         : 5.9-5
Description     : A very advanced and programmable command interpreter (shell) for UNIX
Architecture    : x86_64
URL             : https://www.zsh.org/
Licenses        : custom
Groups          : None
Provides        : None
Depends On      : pcre2  libcap  gdbm
Optional Deps   : None
Required By     : manjaro-kde-settings
Optional For    : fzf
Conflicts With  : None
Replaces        : None
Installed Size  : 6.56 MiB
Packager        : Christian Hesse <eworm@archlinux.org>
Build Date      : Fri Mar 15 00:28:04 2024
Install Date    : Tue May 14 15:28:10 2024
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

The sourced file is /etc/profile and not ~/.profile though. Maybe the latter contains the same than the former and hence the mix up?

Yeah that’s what I’m trying to do.

Since you don’t have a .zprofile (same as me) does your .profile get processed when using zsh? Mine is being processed but in theory it shouldn’t.

Yes, but my ~/.profile is being processed when using zsh and I can’t work out why. As far as I’m aware it shouldn’t unless its being called from somewhere like ~/.zprofile or ~/.zshrc

I noticed this note in Arch’s wiki:

$HOME/.profile is not a part of the Zsh startup files and is not sourced by Zsh unless Zsh is invoked as sh or ksh and started as a login shell. For more details about the sh and ksh compatibility modes refer to zsh(1)

Is your zsh being called as zsh or anything else?

Sorry to ask the obvious, but are you completely sure that ~/.profile is being sourced? If you put something of your own (like an echo or something else), did it get executed?

1 Like

.profile is sourced when you start a session - it’s also sourced by login shells (TTY or SSH logins).

It is not sourced by non-login interactive shells (in your terminal).

However, if this worries you - just enter the line in your .bashrc or .zshrc:

source ~/.profile

As you can see, my Manpager is, indeed, batman - and if I execute ‘moar’ I’ll get the bold text statusbar.

1 Like

Please provide the exact example of what you are doing when ~/.profile is sourced - mine isn’t sourced neither is ~/.zprofile but notice i’m talking about interactive non-login shell, and notice

cat /etc/zsh/zprofile                                                                                                                                        
emulate sh -c 'source /etc/profile'

which comes from Arch (and should not be removed).

1 Like

Depending on where you want to use the variables

Please see → Environment variables - ArchWiki

1 Like

Abandoned topic (30+ days).