1. I want to know which shells have been installed on my machine? You can view the following two methods: [Oracle @ Fedora ~] $ Chsh-l/bin/sh/bin/bash/sbin/nologin/bin/zsh type 2: [oracle @ fedora ~] $ Cat/etc/shells/bin/sh/bin/bash/sbin/nologin/bin/zsh in fact, chsh-l is also used to view this file. 2. I want to know
1. I want to know which shells have been installed on my machine?
You can view the following two methods:
First:
[Oracle @ Fedora ~] $ Chsh-l
/Bin/sh
/Bin/bash
/Sbin/nologin
/Bin/zsh
Second:
[Oracle @ fedora ~] $ Cat/etc/shells
/Bin/sh
/Bin/bash
/Sbin/nologin
/Bin/zsh
In fact, chsh-l is also used to view this file.
2. I want to know which shell I am currently using?
[Oracle @ fedora ~] $ Echo $ SHELL
/Bin/bash
Note that SHELL must be capitalized. As you can see, the current shell I use is/bin/bash.
3. After zsh is executed, I can check whether the current shell type is still/bin/bash?
Please note that although we have executed zsh, the so-called "Current shell" is a big environment concept for a logged-on user. However, we only started a zsh interpreter program to execute zsh without changing the general environment. If you want to change the "current shell", you still need to use chsh.
4. I want to change my shell to zsh!
[Oracle @ fedora ~] $ Chsh-s/bin/zsh
Changing shell for oracle.
Password:
Shell changed.
[Oracle @ fedora ~] $
Use chsh and the option-s to modify the logon shell!
You will find that the output is still/bin/bash after executing echo $ SHELL, because you need to restart your shell to fully invest in zsh.
5. Where has chsh-s been modified?
Tell you the secret. Chsh-s actually modifies the line corresponding to your user name in the/etc/passwd file. Now let's check:
[Oracle @ fedora ~] $ Cat/etc/passwd | grep ^ oracle
Oracle: x: 500: 500: oracle, China:/oracle/PSB/home:/bin/zsh
Look! You can find that the last part of the output content has become/bin/zsh! Next time you restart, linux will read this command to start your shell!
Now, I want to resume normal operation. I will be familiar with/bin/bash when I modify the shell!
[Oracle @ fedora ~] $ Chsh-s/bin/bash
Changing shell for oracle.
Password:
Shell changed.