11-07-2019, 07:43 PM
Tuning your bash or zsh shell on Fedora Workstation and Silverblue
This article shows you how to set up some powerful tools in your command line interpreter (CLI) shell on Fedora. If you use bash (the default) or zsh, Fedora lets you easily setup these tools.
Requirements
Some installed packages are required. On Workstation, run the following command:
On Silverblue run:
Note: On Silverblue you need to restart before proceeding.
Fonts
You can give your terminal a new look by installing new fonts. Why not fonts that display characters and icons together?
Nerd-Fonts
Open a new terminal and type the following commands:
Awesome-Fonts
On Workstation, install using the following command:
On Silverblue, type:
Powerline
Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including bash, zsh, tmus, i3, Awesome, IPython and Qtile. You can find more information about powerline on the official documentation site.
Installation
To install powerline utility on Fedora Workstation, open a new terminal and run:
On Silverblue, the command changes to:
Note: On Silverblue, before proceeding you need restart.
Activating powerline
To make the powerline active by default, place the code below at the end of your ~/.bashrc file
Finally, close the terminal and open a new one. It will look like this:
Oh-My-Zsh
Oh-My-Zsh is a framework for managing your Zsh configuration. It comes bundled with helpful functions, plugins, and themes. To learn how set Zsh as your default shell this article.
Installation
Type this in the terminal:
Alternatively, you can type this:
At the end, you see the terminal like this:
Congratulations, Oh-my-zsh is installed.
Themes
Once installed, you can select your theme. I prefer to use the Powerlevel10k. One advantage is that it is 100 times faster than powerlevel9k theme. To install run this line:
And set ZSH_THEME in your ~/.zshrc file
Close the terminal. When you open the terminal again, the Powerlevel10k configuration wizard will ask you a few questions to configure your prompt properly.
After finish Powerline10k configuration wizard, your prompt will look like this:
If you don’t like it. You can run the powerline10k wizard any time with the command p10k configure.
Enable plug-ins
Plug-ins are stored in .oh-my-zsh/plugins folder. You can visit this site for more information. To activate a plug-in, you need edit your ~/.zshrc file. Install plug-ins means that you are going create a series of aliases or shortcuts that execute a specific function.
For example, to enable the firewalld and git plugins, first edit ~/.zshrc:
Note: use a blank space to separate the plug-ins names list.
Then reload the configuration
To see the created aliases, use the command:
Additional configuration
I suggest the install syntax-highlighting and syntax-autosuggestions plug-ins.
Add them to your plug-ins list in your file ~/.zshrc
Reload the configuration
See the results:
Colored folders and icons
Colorls is a Ruby gem that beautifies the terminal’s ls command, with colors and font-awesome icons. You can visit the official site for more information.
Because it’s a ruby gem, just follow this simple step:
To keep up to date, just do:
To prevent type colorls everytime you can make aliases in your ~/.bashrc or ~/.zshrc.
Also, you can enable tab completion for colorls flags, just entering following line at end of your shell configuration:
Reload it and see what it happens:
This article shows you how to set up some powerful tools in your command line interpreter (CLI) shell on Fedora. If you use bash (the default) or zsh, Fedora lets you easily setup these tools.
Requirements
Some installed packages are required. On Workstation, run the following command:
Code:
sudo dnf install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ makeOn Silverblue run:
Code:
sudo rpm-ostree install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ makeNote: On Silverblue you need to restart before proceeding.
Fonts
You can give your terminal a new look by installing new fonts. Why not fonts that display characters and icons together?
Nerd-Fonts
Open a new terminal and type the following commands:
Code:
git clone https://github.com/ryanoasis/nerd-fonts ~/.nerd-fonts
cd .nerd-fonts sudo ./install.shOn Workstation, install using the following command:
Code:
sudo dnf install fontawesome-fontsOn Silverblue, type:
Code:
sudo rpm-ostree install fontawesome-fontsPowerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including bash, zsh, tmus, i3, Awesome, IPython and Qtile. You can find more information about powerline on the official documentation site.
Installation
To install powerline utility on Fedora Workstation, open a new terminal and run:
Code:
sudo dnf install powerline vim-powerline tmux-powerline powerline-fontsOn Silverblue, the command changes to:
Code:
sudo rpm-ostree install powerline vim-powerline tmux-powerline powerline-fontsNote: On Silverblue, before proceeding you need restart.
Activating powerline
To make the powerline active by default, place the code below at the end of your ~/.bashrc file
Code:
if [ -f `which powerline-daemon` ]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh
fiFinally, close the terminal and open a new one. It will look like this:
Oh-My-Zsh
Oh-My-Zsh is a framework for managing your Zsh configuration. It comes bundled with helpful functions, plugins, and themes. To learn how set Zsh as your default shell this article.
Installation
Type this in the terminal:
Code:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"Alternatively, you can type this:
Code:
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"At the end, you see the terminal like this:
Congratulations, Oh-my-zsh is installed.
Themes
Once installed, you can select your theme. I prefer to use the Powerlevel10k. One advantage is that it is 100 times faster than powerlevel9k theme. To install run this line:
Code:
git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10kAnd set ZSH_THEME in your ~/.zshrc file
Code:
ZSH_THEME=powerlevel10k/powerlevel10kClose the terminal. When you open the terminal again, the Powerlevel10k configuration wizard will ask you a few questions to configure your prompt properly.
After finish Powerline10k configuration wizard, your prompt will look like this:
If you don’t like it. You can run the powerline10k wizard any time with the command p10k configure.
Enable plug-ins
Plug-ins are stored in .oh-my-zsh/plugins folder. You can visit this site for more information. To activate a plug-in, you need edit your ~/.zshrc file. Install plug-ins means that you are going create a series of aliases or shortcuts that execute a specific function.
For example, to enable the firewalld and git plugins, first edit ~/.zshrc:
Code:
plugins=(firewalld git)Note: use a blank space to separate the plug-ins names list.
Then reload the configuration
Code:
source ~/.zshrcTo see the created aliases, use the command:
Code:
alias | grep firewallAdditional configuration
I suggest the install syntax-highlighting and syntax-autosuggestions plug-ins.
Code:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestionsAdd them to your plug-ins list in your file ~/.zshrc
Code:
plugins=( [plugins...] zsh-syntax-highlighting zsh-autosuggestions)Reload the configuration
Code:
source ~/.zshrcSee the results:
Colored folders and icons
Colorls is a Ruby gem that beautifies the terminal’s ls command, with colors and font-awesome icons. You can visit the official site for more information.
Because it’s a ruby gem, just follow this simple step:
Code:
sudo gem install colorlsTo keep up to date, just do:
Code:
sudo gem update colorlsTo prevent type colorls everytime you can make aliases in your ~/.bashrc or ~/.zshrc.
Code:
alias ll='colorls -lA --sd --gs --group-directories-first'
alias ls='colorls --group-directories-first'Also, you can enable tab completion for colorls flags, just entering following line at end of your shell configuration:
Code:
source $(dirname ($gem which colorls))/tab_complete.shReload it and see what it happens:

