Linux shell: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= What’s the Difference Between Bash, Zsh, and Other Linux Shells = https://www.howtogeek.com/68563/htg-explains-what-are-the-differences-between-linux-shells/ = sh (Bourne shell, 1977) = * Basic shell * POSIX-compliant shell = Bash shell = * Can be mostly POSIX compliant * Expose array indices * Regular expression conditionals * Increment assignment operator * Current version: Bash 4 [http://bash.cyberciti.biz/guide/Main_Page Bash shell programming] = Dash = * Mos...") |
|||
Line 70: | Line 70: | ||
* Oh-my-zsh | * Oh-my-zsh | ||
** Files: ~/.oh-my-zsh/, check ~/.zshrc file | ** Files: ~/.oh-my-zsh/, check ~/.zshrc file | ||
* [https://www.youtube.com/watch?v=80PHRWH84Tc Upgrade Your Terminal] Novaspirit | |||
'''The more you customize, the less portable your config can become.''' The more you add to your shell, the more time it can take to start up and to run basic commands. Be selective when you customize. | '''The more you customize, the less portable your config can become.''' The more you add to your shell, the more time it can take to start up and to run basic commands. Be selective when you customize. |
Revision as of 17:32, 14 July 2024
What’s the Difference Between Bash, Zsh, and Other Linux Shells
https://www.howtogeek.com/68563/htg-explains-what-are-the-differences-between-linux-shells/
sh (Bourne shell, 1977)
- Basic shell
- POSIX-compliant shell
Bash shell
- Can be mostly POSIX compliant
- Expose array indices
- Regular expression conditionals
- Increment assignment operator
- Current version: Bash 4
Dash
- Mostly compatible with Bash
- POSIX compliant
- Low-memory usage
- Faster execution
- Doesn't have a command history
- Not easily installed in CentOS 7 (though popular in Debian OS)
zsh shell
- echo $SHELL shows Bio-Linux is using zsh.
- What is ZSH, and Why Should You Use It Instead of Bash?
- Automatic cd
- Recursive path expansion
- Automatic Syntax Highlighting
- Spelling correction and approximate completion
- Plugin and theme support
- https://www.howtoforge.com/tutorial/how-to-setup-zsh-and-oh-my-zsh-on-linux/. Note that there is a green arrow for zsh. This is quite special. I need to reboot to see a switch to zsh.
- https://superuser.com/questions/362372/how-to-change-the-login-shell-on-mac-os-x-from-bash-to-zsh chsh -s /bin/zsh
- https://superuser.com/questions/776759/switch-from-zsh-to-default-os-x. chsh -s /bin/bash
- How to Install ZSH Shell on Ubuntu 18.04 LTS
- Installing ZSH Shell
- Making ZSH the Default Shell
- Installing Powerline and Powerline Fonts for ZSH
- Installing ZSH Powerlevel9k Theme
- Enable Syntax Highlighting on ZSH Shell
- ZSH and Git Integration with Oh-My-ZSH (https://ohmyz.sh/)
- Changing Oh-My-ZSH Theme
- Enabling Oh-My-ZSH Plugins
- I can further change the color scheme in iTerm2 preferences in macOS or Terminator preferences in Ubuntu from the Profile tab. On Ubuntu, I can choose 'Tango' (looks good) or 'Solarized' (the colors on the filenames are too light). On iTerm2, I choose 'Tango (light)' or 'Pastel (Dark Background)'.
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" nano .zshrc # change ZSH_THEME to "agnoster" # add RPROMPT='%*' # add prompt_context(){} at the bottom of your ~/.zshrc to hide the “user@hostname” info sudo apt install fonts-powerline
- How to change from zsh to bash? Changing your shell, via sudo chsh --shell=/bin/bash $USER will change the shell field in /etc/passwd. This value is only consulted at login time, when the system has no idea of which shell to use for you. Running processes, whether started by zsh, bash apache or evil_overlord's_program won't be affected.
- When I try to change the shell to zsh to bash, I use sudo usemod but choose the wrong location '/usr/bin/bash' (it should be /bin/bash). The result is when I try to reconnect to Pi, it always said the password is not correct. Fortunately I can shutdown Pi, move the SD card to chromebox and run sudo nano /var/host/media/removable/rootfs/etc/passwd to fix the bash path.
- How can you export your .bashrc to .zshrc?
- Use .zshrc to do things like
- Export environment variables
- Set command aliases
- Set non-default Bash Options by using setopt
- scp with zsh : no matches found. This is because the wildcard expansion is not enabled by default in zsh. One solution is to add a double quote. For example, scp "username@hostname:Downloads/*.txt" ~/Downloads. Another way is to add this to your .zshrc
alias scp='noglob scp' # OR setopt nonomatch
- Bash vs Zsh: Differences and Comparison
- Mac instruction
- How to Configure your macOs Terminal with Zsh like a Pro. This involves some changes in iTerm2 preferences.
- Oh-my-zsh
- Files: ~/.oh-my-zsh/, check ~/.zshrc file
- Upgrade Your Terminal Novaspirit
The more you customize, the less portable your config can become. The more you add to your shell, the more time it can take to start up and to run basic commands. Be selective when you customize.
Fish shell
- Features
- Most compatible with Bash
- Designed for interactivity
- Syntax highlighting on the CLI
- Interactive autosuggestions
- Cleaner syntax for conditions and loops
- Only available in third-party EPEL software repository