What is the first file executed by a non login shell?

What is the first file executed by a non login shell?

For example -bash, -su etc. A Non login shell is started by a program without a login. In this case, the program just passes the name of the shell executable. For example, for a Bash shell it will be simply bash.

Which bash configuration files are used for non login bash shell sessions?

A non-login shell will read the file /etc/bash. bashrc and then the user specific file ~/. bashrc to create its environment.

What is a login shell bash?

Login shell. A login shell is a shell given to a user upon login into their user account. This is initiated by using the -l or –login option, or placing a dash as the initial character of the command name, for example invoking bash as -bash. Simulating an initial login shell with bash -l or sh -l.

When is Bash invoked as an interactive login shell?

When Bash is invoked as an interactive login shell, or as a non-interactive shell with the –login option, it first reads and executes commands from the file /etc/profile, if that file exists.

Where does Bash read and execute commands from?

When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. This may be inhibited by using the –norc option. The –rcfile file option will force Bash to read and execute commands from file instead of ~/.bashrc .

When to run bash in / etc / profile?

The following is an excerpt of the INVOCATION section of man bash (emphasis mine): When bash is invoked as an interactive login shell, or as a non-interactive shell with the –login option, it first reads and executes commands from the file /etc/profile, if that file exists.

What does it mean to run a non login shell?

When you open a terminal emulator ( gnome-terminal for example), you are executing what is known as an interactive, non-login shell. When you log into your machine from the command line, or run a command such as su – username, you are running an interactive login shell. When you log in graphically, you are running something completely different.