Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When starting my shell with e.g. exec zsh from the command line, how can I have it not parse any /etc/ files?

I read in the zsh guide that when a user starts a zsh shell, it processes the following init files in order:

# Every shell. Always
/etc/zshenv

# Every shell. Avoidable if passing flag -f to zsh
~/zshenv

# If it's a login shell.
/etc/zprofile
~/zprofile

# If it is an interactive shell
/etc/zshrc
~/zshrc

# If it is a login shell
/etc/zlogin
~/zlogin

When starting zsh, I would like to skip processing all the /etc/* files (except /etc/zshenv which I assume I can't skip as a non-root user?), and only parse my own init files in my home directory.

How can I do this when I invoke exec zsh from the command line?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Unset the GLOBAL_RCS option. To do this, add unsetopt GLOBAL_RCS to /etc/zshenv or $ZDOTDIR/.zshenv or run zsh -o NO_GLOBAL_RCS. Note that if $ZDOTDIR is unset, $HOME is used instead.

When GLOBAL_RCS is unset, /etc/zprofile, /etc/zshrc, /etc/zlogin and /etc/zlogout will not be sourced.

share|improve this answer
    
Thanks. I do not have admin rights to edit /etc/zshenv. I guess I can add this to ~/zshenv instead? –  user815423426 Apr 15 '13 at 23:24
1  
That will work. You personal zshenv file is sourced right after /etc/zshenv, before the other config files are sourced. I have edited my answer to include that. –  paraxor Apr 15 '13 at 23:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.