Contents
What is difference between Zprofile and Zshrc?
zprofile are basically the same thing – they set the environment for login shells; they just get loaded at different times (see below). . zprofile is based on the Bash’s . bash_profile while . zlogin is a derivative of CSH’s .
What goes Zshenv?
zshenv’ is sourced on all invocations of the shell, unless the -f option is set. It should contain commands to set the command search path, plus other important environment variables. It should contain commands to set up aliases, functions, options, key bindings, etc.
Should I use Bashrc or Bash_profile?
bash_profile is executed for login shells, while . bashrc is executed for interactive non-login shells. When you login (type username and password) via console, either sitting at the machine, or remotely via ssh: . bash_profile is executed to configure your shell before the initial command prompt.
When to use zshenv, zlogin,.zshrc?
.zlogin is sourced on the start of a login shell but after.zshrc if the shell is also interactive. This file is often used to start X using startx. Some systems start X on boot, so this file is not always very useful..zlogout is sometimes used to clear and reset the terminal.
What should the next file in zshrc be?
According to standards, the.zprofile should not contain any commands that alter the shell environment; you should only use it to run external commands. The next file is.zshrc that contains the shell configurations and commands. It is sourced in interactive shells and contains aliases, key bindings, variables, and functions.
What’s the difference between.zlogin and.zprofile?
.zlogin and .zprofile are basically the same thing – they set the environment for login shells; they just get loaded at different times (see below). .zprofile is based on the Bash’s .bash_profile while .zlogin is a derivative of CSH’s .login. Since Bash was the default shell for everything up to Mojave, stick with .zprofile.
What should / shouldn’t go in the zsh file?
You set options for the interactive shell there with the setopt and unsetopt commands. You can also load shell modules, set your history options, change your prompt, set up zle and completion, et cetera. You also set any variables that are only used in the interactive shell (e.g. $LS_COLORS ).