Ubuntu – ‘bash’ command in bash

bashcommand line

I just typed bash in Ubuntu's terminal and, it was like normal. But after that, I had to type exit twice. What is bash command in bash?

Best Answer

There is a difference between shells and terminal emulators.

Shell is a thing that passes your commands to the kernel, and that is executed. And terminal emulator programs let you interact with the shell. Examples of Terminal emualtors are gnome-terminal,konsole and shells are bash,zsh,sh etc. Terminal emulators are simply named as Terminal in most desktop environments.

When you open Terminal, it uses a shell by default. For most terminals it is bash. You can change the default shell. First run whoami to get your user name. Then run cat /etc/passwd | grep user_name where user_name is your user name. The last word is your default shell. Now you can change your shell with sudo usermod --shell /bin/shell_name user_name.

Also when you type bash it just opens another shell. You can simply exit the other shell by running exit. Such as executing zsh or sh will take you to other shell. You can read the man pages of shell with man shell_name to learn the differences between shells. However the man pages are extremely large and complicated to read that it will make your head spin. Executing a man shell_name | wc -l will give you the line count.

Hope that helps