What is Hola, Linux ๐ ?
- Hola, Linux ๐ is a project that you can depend on it as a starter code for your brain ๐ง to rebuild Linux concepts.
One Shell, Many Sessions.
โก๏ธ I want you to be quiet ๐ and divide the concept of shell logically to many shell(s) and give them the alias of "Shell Sessions"
โก๏ธโก๏ธ So it's one shell but many names "aliases" based on its function.
โก๏ธ Linux has more than one shell session:-
- Login Shell.
- Non-Login Shell
- Interactive Shell.
- Non-Interactive Shell.
Login Shell ๐ค:-
โก๏ธ The shell is considered as Login Shell when you use the shell to :-
- Login via a terminal (or Switching to another user).
- Login via SSH.
After successful login (No authentication failure.), a shell starts and a new era of execution begins.
Login Shell Behind The Scene Sequence
When shell starts, a group of pre-configured scripts is executed to setup the environment and those scripts are executed under the umbrella of Global Environment, the execution of these scripts is in the -behind the scene- sequence:-
Login Shell invokes
/etc/profile
that contains global configuration that applies to all users.accessing its
/etc/profile.d/*.sh
directoryIn the user's home directory,
~/.bash_profile
file is executed and it's a personal initialization file for configuring the user environment to configure your shell before the initial command prompt besides~/.bash_login
and~/.profile
~/.bash_profile
is configured to invoke~/.bashrc
that defines settings for that logged-in user.~/.bashrc
calls/ect/.bashrc
Non-Login Shell ๐ค:-
โก๏ธ The shell is considered as Non-Login Shell once the user has authenticated via terminal or via SSH and then opened a new terminal, that new terminal opened is considered as Non-Login Shell because user is no longer asked for login credentials. So, a non-login shell is started by a login shell.
Login Shell Behind The Scene Sequence
When that non-login shell starts, a group of pre-configured scripts is executed to setup the environment, the execution of these scripts is in the -behind the scene- sequence:-
Non-login shell executes
~/.bashrc
that defines the settings for the logged-in user (note: that~/.bashrc
is executed after a user has successfully logged in).~/.bashrc
executes/etc/bashrc
/etc/bashrc
invokes the scripts in/etc/profile.d
Interactive Shell ๐ฅ :-
โก๏ธ The shell that expects you, User, to interact with it, for example the user is going to enter some inputs to the shell via keyboard. That one is considered as "Interactive Shell".
Non-Interactive Shell ๐ธ :-
โก๏ธ Non-interactive concept is for systems that are not used directly by people and they don't accept user input.
โก๏ธ In our Linux, Shell is considered as Non-interactive one when there is no interaction on behalf of the user. User is not a part of that process and shell doesn't expect any interactivity from the user.
So, ๐ค Where interaction comes ๐ค? that shell expects inputs to interact but in case of Non-Interactive shell, the input comes from automated script and the user doesn't interact with that shell with his hand and keyboard. A script does that interaction and the output is redirected to a file.
Conclusion
- So i tried to cover up one of the most concepts in shell, shell sessions, to change the way how you deal and interact with your next shell(s).
- We, together, started by Login and Non-Login Shell which the shell you daily use when accessing your remote server via SSH or via terminal.
- Then we moved to Interactive & Non-Interactive Shell, The Interactive Shell that you interact with it using your keyboard. And the one which is used by an automated script while user doesn't touch it and that is the Non-Interactive One*
- Hola, Linux ๐ will take the road of simplifying many Linux concepts.