Linux shell
In this lecture, we will talk about shells in Linux
Let us understand first of all, what is shell?
A SHELL is a program that provides a text-based interface, for users, to interact with the computer's operating system, by entering commands.
It acts as an intermediary, between the user and the kernel, which is the core of the operating system, allowing users, to execute commands and run programs.
There are several different shells available in Linux, and users can choose which one to use, based on their preferences and requirements.
Shell types
let us see now some examples of shells.
- First of all, we have Bash, which stands for Bourne-Again SHell. Bash is the default shell on most linux distributions. It is a powerful and versatile (polyvalente) shell with a wide range of features.
- we have also Z Sell which is an extended and more feature-rich shell compared to Bash. It offers a variety of plugins, and a set of features which make it very useful and popular.
- Fish (Friendly Interactive SHell)
- Ksh (Korn Shell)
- Bourne Shell(sh)
Which shell should i use?
- The choice of which shell to use, depends on personal preferences, scripting needs, and system requirements. Users can typically change their default shell, and they can even switch between different shells on the same system, if multiple shells are installed.
View the current shell
- You can view the current shell you are using, using the echo command with SHELL env var
- After running this command, you will see the path to the shell executable. For example, if you're using the Bash shell, you will see something like that:
- The output will vary depending on which shell you are currently using.
Change the shell
- Let's say that you want to change the current shell that you are using. so how you can switch to a different shell?
- But before that, you have to know how to check the shells that are available on your system.
- to check the shells that are available on the system you are using, run this command: cat /etc/shells
- The output will display a list of available shells, each one on a separate line
- Select the shell you want to change, based on the list of the available shells
- and now you can change your default shell for your user account, by using the command chsh which stands for change shell, followed by the path to shell executable that you want to use
- you have to make sure to enter the correct path for the shell that you want to use
- After changing your shell, it is essential to log out of your current session, and then log back in to activate the new shell.
- Your new shell should be the default one when you log in again
Comments
Post a Comment