Linux shell is a feature/program in the Linux system that takes instruction from the user typed via keyboard and translates it to machine language for OS to be able to interpret and process. Is simply a program that provides a command line interface for Unix-like systems. Linux Shell can be drawn back to 1971 when the first Unix shell called Thompson shell (/bin/sh) was invented. This shell was independent and executed outside the kernel.
Beyond 1977, the evolution of technology and looking for an alternative Linux shell to the Thompson shell. Other shells such as the Bourne shell came into existence which led to the development of the Almquist shell (ash) and the Bourn again shell (Bash)
In this guide, we are going to talk about the Fish shell, one of the most popular used shells in the Linux environment with a pretty interactive CLI. Specifically, we are going to discuss how to install Fish Shell and Oh My Fish on OpenSUSE.
Fish Shell and Its Features
This is an exotic Unix shell that is designed to provide users with an interactive command line interface. This command line can give you fun if you want to make it more productive without learning many syntax and configuration options. This is because Fish shell supports powerful features like;
- syntax highlighting
- Searchable command history
- Advanced tab completion
- Web-based configuration
- Advanced error messages
- Universal variables
Install Fish Shell on OpenSUSE / SUSE
Follow the steps below to install Fish Shell and Oh My Fish on OpenSUSE / SUSE.
Step 1: Adding repositories and installing Fish
OpenSUSE is an RPM-based Operating system that exists in different versions. To install Fish shell in OpenSUSE, first, add the Fish shell repo in the system as below.
For openSUSE Tumbleweed run the following as root:
zypper addrepo https://download.opensuse.org/repositories/shells:fish:release:3/openSUSE_Tumbleweed/shells:fish:release:3.repo
zypper refresh
zypper install fish
For 15.6, run the following as root:
zypper addrepo https://download.opensuse.org/repositories/shells:fish:release:3/15.6/shells:fish:release:3.repo
zypper refresh
zypper install fish
For 15.5, run the following as root:
zypper addrepo https://download.opensuse.org/repositories/shells:fish:release:3/15.5/shells:fish:release:3.repo
zypper refresh
zypper install fish
For 15.4, run the following as root:
zypper addrepo https://download.opensuse.org/repositories/shells:fish:release:3/15.4/shells:fish:release:3.repo
zypper refresh
zypper install fish
Verify that Fish has been installed:
$ fish -v
fish, version 3.7.1
Step 2: Creating Fish rc File.
A fish resource (rc) file is a configuration file that is used to store a predefined set of variables and functions to be used by the fish shell. This configuration file is at ~/.config/fish/config.fish
You can see what is to be executed on startup whether on interactive or login shell.
For instance, you can set a function to display a message when exiting the fish shell.
$ vim ~/.config/fish/config.fish
Add below line of function in the file ad save.
if status is-interactive
# Commands to run in interactive sessions can go here
end
function on_exit --on-event fish_exit
echo You are now exiting fish shell, Bye!!
end
The above function will display the “You are now exiting fish shell, Bye!!” message on leaving the fish shell with the [exit] command.
devops@localhost ~> exit
You are now exiting fish shell, Bye!!
Step 3: Installation of Oh My Fish on OpenSUSE15
This is a Fishshell framework that can be used to modify your shell by using plugins and theme to make it more beautiful. Uses omf command that you can easily use in installing new features in fish shell such as themes and plugins and twerk your shell as you wish.
Step 3.1 Install Oh My Fish
Option 1:
You below command to install Fish shell using the installation script from GitHub or the Fish shell official site.
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
#Or use below command.
curl -L https://get.oh-my.fish | fish
The above command will download and run the installation script of the Oh My Fish fish shell framework.
Option 2:
Download the install file then modifies your config to match your preferences.
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > install
fish install --path=~/.local/share/omf --config=~/.config/omf
Option 3:
You can also install Oh My Fish from offline source
git clone https://github.com/oh-my-fish/oh-my-fish
cd oh-my-fish
bin/install --offline
#Out put of the above command
Installing package config
✔ config successfully installed.
Installing package spark
Submodule 'spark' (https://github.com/holman/spark) registered for path 'spark'
Cloning into '/root/.local/share/omf/pkg/spark/spark'...
Submodule path 'spark': checked out 'ab88ac6f8f33698f39ece2f109b1117ef39a68eb'
✔ spark successfully installed.
Installing package weather
✔ weather successfully installed.
Installing package default
✔ default successfully installed.
Installing package slacker
✔ slacker successfully installed.
Installing package slavic-cat
✔ slavic-cat successfully installed.
Installation successful!
Welcome to fish, the friendly interactive shell
~/oh-my-fish ☭ master ○
Step 4: Setting Fishshell Theme in Oh My Fish Framework.
Oh My Fish shell framework provides an awesome interface for the fish shells. It comes with a variety of themes to help user choose different themes depending on his/her preference. To show installed themes and plugins, use omf command.
⋊> ~ omf list
Plugins
fish-spec omf
Themes
Default
From above we note that only 2 plugins and one default theme is installed.
To see only installed and available themes use this command.
$ omf theme
Installed:
default
Available:
agnoster cmorrell fishbone harleen lolfish pastfish separation trout
aight coffeeandcode fishface heartsteal mars perryh simple tweetjay
anchor cor fishy-drupal idan mint pie simple-ass-prompt uggedal
ays cyan fisk integral mish plain simplevi will
batman dangerous flash jacaetevha mokou pure slacker wolf-theme
beloglazov default fluffy johanson mtahmed pygmalion slavic-cat yimmy
bira dmorrell fox kawasaki nai random solarfish zeit
bobthefish doughsay gentoo kovial neel randomrussel sushi zephyr
boxfish eclm gianu krisleech nelsonjchen red-snapper syl20bnr zish
budspencer edan gitstatus l neolambda rider taktoa
cbjohnson eden gnuykeaj lambda numist robbyrussell technopagan
chain emoji-powerline godfather lambda-zero ocean sashimi toaster
clearance es graystatus lavender one scorphish tomita
This is only theme installed and many more available themes which you can install with help of omf command. Before installing a theme, you can preview here to get one that interests. Having chosen one, run omf install <your-theme> to install the new theme.
For instance, to install slavic-cat theme run this.
⋊> ~ omf install slavic-cat
Updating https://github.com/oh-my-fish/packages-main master... Done!
Installing package slavic-cat
✔ slavic-cat successfully installed.
By default, a new theme will be applied immediately due installation. To switch to another theme use omf command in this format; omf master <theme-name>
Step 5: How to Use omf Tool.
Update packages and repositories
$ omf update
List installed packages.
$ omf list
List available themes
$ omf themes
Installation of themes and plugins.
$ omf install <theme-name>
$ omf install <plugin-name>
Use OMF to remove packages and themes
$ omf remove <package name>
Updating Oh My Fish.
Oh My Fish framework is open-source and the version is being actively worked on resulting in new versions being created to improve features and performance. You can use the below command to update the OMF framework on OpenSUSE15.
$ omf update
Oh My Fish is up to date.
You are now using Oh My Fish version 7.
Updating https://github.com/oh-my-fish/packages-main master... Done!
config is already up-to-date.
spark is already up-to-date.
weather is already up-to-date.
default is already up-to-date.
slacker is already up-to-date.
slavic-cat is already up-to-date.
Similar articles: