Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Tuning your bash or zsh shell on Fedora Workstation and Silverblue

#1
Tuning your bash or zsh shell on Fedora Workstation and Silverblue

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue.png" width="654" height="481" title="" alt="" /></div><div><p>This article shows you how to set up some powerful tools in your command line interpreter (CLI) shell on Fedora. If you use <em>bash</em> (the default) or <em>zsh</em>, Fedora lets you easily setup these tools. </p>
<p> <span id="more-29527"></span> </p>
<h2>Requirements</h2>
<p>Some installed packages are required. On Workstation, run the following command:</p>
<pre class="wp-block-preformatted">sudo dnf install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make</pre>
<p>On Silverblue run:</p>
<pre class="wp-block-preformatted">sudo rpm-ostree install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make</pre>
<p><strong>Note</strong>: On Silverblue you need to restart before proceeding. </p>
<h2>Fonts</h2>
<p>You can give your terminal a new look by installing new fonts. Why not fonts that display characters and icons together?</p>
<h4>Nerd-Fonts</h4>
<p>Open a new terminal and type the following commands:</p>
<pre class="wp-block-preformatted">git clone https://github.com/ryanoasis/nerd-fonts ~/.nerd-fonts
cd .nerd-fonts sudo ./install.sh</pre>
<h4>Awesome-Fonts</h4>
<p>On Workstation, install using the following command:</p>
<pre class="wp-block-preformatted">sudo dnf install fontawesome-fonts</pre>
<p>On Silverblue, type:</p>
<pre class="wp-block-preformatted">sudo rpm-ostree install fontawesome-fonts</pre>
<h2>Powerline</h2>
<p>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 <a href="https://powerline.readthedocs.io/en/latest/">documentation site</a>. </p>
<h3>Installation</h3>
<p>To install powerline utility on Fedora Workstation, open a new terminal and run:</p>
<pre class="wp-block-preformatted">sudo dnf install powerline vim-powerline tmux-powerline powerline-fonts</pre>
<p>On Silverblue, the command changes to:</p>
<pre class="wp-block-preformatted">sudo rpm-ostree install powerline vim-powerline tmux-powerline powerline-fonts</pre>
<p><strong>Note</strong>: On Silverblue, before proceeding you need restart.</p>
<h3>Activating powerline</h3>
<p style="text-align:left">To make the powerline active by default, place the code below at the end of your <em>~/.bashrc</em> file</p>
<pre class="wp-block-preformatted">if [ -f `which powerline-daemon` ]; then powerline-daemon -q POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_SELECT=1 . /usr/share/powerline/bash/powerline.sh
fi</pre>
<p>Finally, close the terminal and open a new one. It will look like this:</p>
<figure class="wp-block-image is-resized"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue.png" alt="" class="wp-image-29533" width="654" height="481" /></figure>
<h2>Oh-My-Zsh</h2>
<p><a href="https://ohmyz.sh">Oh-My-Zsh</a> 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 <a href="https://fedoramagazine.org/set-zsh-fedora-system/">article</a>.</p>
<h3>Installation</h3>
<p>Type this in the terminal:</p>
<pre class="wp-block-preformatted">sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-m...install.sh)"</pre>
<p>Alternatively, you can type this:</p>
<pre class="wp-block-preformatted">sh -c "$(wget https://raw.github.com/robbyrussell/oh-m...install.sh -O -)"</pre>
<p>At the end, you see the terminal like this:</p>
<figure class="wp-block-image"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue-1.png" alt="" class="wp-image-29542" /></figure>
<p>Congratulations, Oh-my-zsh is installed.</p>
<h3>Themes</h3>
<p>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:</p>
<pre class="wp-block-preformatted">git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k</pre>
<p>And set ZSH_THEME in your <em>~/.zshrc</em> file</p>
<pre class="wp-block-preformatted">ZSH_THEME=powerlevel10k/powerlevel10k</pre>
<p>Close the terminal. When you open the terminal again, the Powerlevel10k configuration wizard will ask you a few questions to configure your prompt properly.</p>
<figure class="wp-block-image"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue-2.png" alt="" class="wp-image-29543" /></figure>
<p>After finish Powerline10k configuration wizard, your prompt will look like this:</p>
<figure class="wp-block-image"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue-3.png" alt="" class="wp-image-29575" /></figure>
<p>If you don’t like it. You can run the powerline10k wizard any time with the command <em>p10k configure</em>.</p>
<h3>Enable plug-ins</h3>
<p>Plug-ins are stored in <em>.oh-my-zsh/plugins</em> folder. You can visit this site for more information. To activate a plug-in, you need edit your <em>~/.zshrc </em>file. Install plug-ins means that you are going create a series of aliases or shortcuts that execute a specific function. </p>
<p>For example, to enable the firewalld and git plugins, first edit ~/.zshrc:</p>
<pre class="wp-block-preformatted">plugins=(firewalld git)</pre>
<p><strong>Note</strong>: use a blank space to separate the plug-ins names list.</p>
<p>Then reload the configuration</p>
<pre class="wp-block-preformatted">source ~/.zshrc </pre>
<p>To see the created aliases, use the command:</p>
<pre class="wp-block-preformatted">alias | grep firewall</pre>
<figure class="wp-block-image"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue-4.png" alt="" class="wp-image-29546" /></figure>
<h3>Additional configuration</h3>
<p>I suggest the install syntax-highlighting and syntax-autosuggestions plug-ins. </p>
<pre class="wp-block-preformatted">git clone https://github.com/zsh-users/zsh-syntax-...ghting.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-autosuggestions</pre>
<p>Add them to your plug-ins list in your file <em>~/.zshrc</em></p>
<pre class="wp-block-preformatted">plugins=( [plugins...] zsh-syntax-highlighting zsh-autosuggestions)</pre>
<p>Reload the configuration</p>
<pre class="wp-block-preformatted">source ~/.zshrc </pre>
<p>See the results:</p>
<figure class="wp-block-image"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue-5.png" alt="" class="wp-image-29576" /></figure>
<h2>Colored folders and icons</h2>
<p>Colorls is a Ruby gem that beautifies the terminal’s ls command, with colors and font-awesome icons. You can visit the official <a href="https://github.com/athityakumar/colorls">site</a> for more information.</p>
<p>Because it’s a ruby gem, just follow this simple step:</p>
<pre class="wp-block-preformatted">sudo gem install colorls</pre>
<p>To keep up to date, just do:</p>
<pre class="wp-block-preformatted">sudo gem update colorls</pre>
<p>To prevent type colorls everytime you can make aliases in your <em>~/.bashrc</em> or <em>~/.zshrc</em>.</p>
<pre class="wp-block-preformatted">alias ll='colorls -lA --sd --gs --group-directories-first'
alias ls='colorls --group-directories-first'</pre>
<p>Also, you can enable tab completion for colorls flags, just entering following line at end of your shell configuration:</p>
<pre class="wp-block-preformatted">source $(dirname ($gem which colorls))/tab_complete.sh</pre>
<p>Reload it and see what it happens:</p>
<figure class="wp-block-image"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue-6.png" alt="" class="wp-image-29577" /></figure>
<figure class="wp-block-image"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2019/11/tuning-your-bash-or-zsh-shell-on-fedora-workstation-and-silverblue-7.png" alt="" class="wp-image-29578" /></figure>
</div>


https://www.sickgaming.net/blog/2019/11/...ilverblue/
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016