Skip to main content

Command Palette

Search for a command to run...

Hola , Linux πŸ‘‹ | Beyond Shell(s)

Updated
β€’3 min read
Hola , Linux πŸ‘‹ | Beyond Shell(s)

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:-

  1. Login Shell.
  2. Non-Login Shell
  3. Interactive Shell.
  4. Non-Interactive Shell.

    Login Shell πŸ‘€:-

➑️ The shell is considered as Login Shell when you use the shell to :-

  1. Login via a terminal (or Switching to another user).
  2. 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 directory

  • In 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.