This article will show you how to set up some powerful tools in Fedora’s command Line interpreter (CLI) Shell. If you use bash (the default) or ZSH, Fedora makes it easy to set up these tools.

Lead requirements

This requires some installed packages. On a Fedora workstation, run the following command:

sudo dnf install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make
Copy the code

Running on Silverblue:

sudo rpm-ostree install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make
Copy the code

Note: On Silverblue, you need to reboot to continue.

The font

You can freshen up the terminal by installing new fonts. Why not use a font that displays both characters and ICONS?

Nerd-Fonts

Open a new terminal and type the following command:

git clone https://github.com/ryanoasis/nerd-fonts ~/.nerd-fonts
cd .nerd-fonts
sudo ./install.sh
Copy the code

Awesome-Fonts

On the workstation, use the following command to install:

sudo dnf fontawesome-fonts
Copy the code

Type on Silverblue:

sudo rpm-ostree install fontawesome-fonts
Copy the code

Powerline

Powerline is a status line plug-in for Vim and also provides status lines and prompts for several other applications, including bash, ZSH, TMUS, I3, Awesome, IPython, and Qtile. You can also find more information on the official documentation site.

The installation

To install the Powerline utility on a Fedora workstation, open a new terminal and run:

sudo dnf install powerline vim-powerline tmux-powerline powerline-fonts
Copy the code

On Silverblue, the command changes to:

sudo rpm-ostree install powerline vim-powerline tmux-powerline powerline-fonts
Copy the code

Note: On Silverblue, you need to reboot to continue.

Activate the Powerline

To make Powerline active by default, place the following code at the end of the ~/.bashrc file:

if [ -f `which powerline-daemon` ]; then
  powerline-daemon -q
  POWERLINE_BASH_CONTINUATION=1
  POWERLINE_BASH_SELECT=1
  . /usr/share/powerline/bash/powerline.sh
fi
Copy the code

Finally, close the terminal and open a new terminal. It looks something like this:

Oh-My-Zsh

Oh-my-zsh is a framework for managing Zsh configurations. It bundles useful functionality, plug-ins, and themes. To learn how to set Zsh as the default shell, see this article.

The installation

Enter:

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Copy the code

Alternatively, you can enter the following:

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Copy the code

Finally, you should see a terminal like this:

Congratulations, oH-my-Zsh has been installed successfully.

The theme

Once installed, you can select themes. I like using PowerLevel10k. One advantage is that it is 100 times faster than a PowerLevel9k theme. To install it, run the following command line:

git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k
Copy the code

And set ZSH_THEME in your ~/.zshrc file:

ZSH_THEME=powerlevel10k/powerlevel10k
Copy the code

Close the terminal. When you open the terminal again, the PowerLevel10k configuration wizard will ask you a few questions to correctly configure the prompt.

After completing the powerline10k configuration wizard, your prompt will look like this:

If you don’t like it. You can always run the Powerline10k wizard using the p10k configure command.

To enable the plugin

The plugins are stored in the.oh-my-zsh/plugins folder. To activate the plugin, you need to edit the ~/.zshrc file. Installing plug-ins means that you create a series of aliases or shortcuts that perform specific functions.

For example, to enable firewalld and git plug-ins, first edit ~/.zshrc:

plugins=(firewalld git)
Copy the code

Note: Use Spaces to separate the list of plug-in names.

Then reload the configuration:

source ~/.zshrc
Copy the code

To see the aliases created, use the following command:

alias | grep firewall
Copy the code

More configuration

I recommend installing syntax highlighting and syntax autosuggestion plug-ins.

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-autosuggestions
Copy the code

Add them to the list of plug-ins in the file ~/.zshrc.

plugins=( [plugins...]  zsh-syntax-highlighting zsh-autosuggestions)Copy the code

Reload the configuration.

source ~/.zshrc
Copy the code

View the results:

Colorful folders and ICONS

Colorls is a Ruby gem that beautifies terminal ls commands with colors and awesome font ICONS. You can visit the official website for more information.

Because it’s a Ruby gem, follow these simple steps:

sudo gem install colorls
Copy the code

To stay current, simply do the following:

sudo gem update colorls
Copy the code

To prevent each input of colorls, you can create an alias in ~/.bashrc or ~/.zshrc.

alias ll='colorls -lA --sd --gs --group-directories-first'
alias ls='colorls --group-directories-first'
Copy the code

Alternatively, you can enable TAB completion for colorls options by typing the following line at the end of the shell configuration:

source $(dirname ($gem which colorls))/tab_complete.sh
Copy the code

Reload and see what happens:


Via: fedoramagazine.org/tuning-your…

Author: George Luiz Maluf lujun9972

This article is originally compiled by LCTT and released in Linux China