Jump to content

Welcome to CodeNameJessica

โœจ Welcome to CodeNameJessica! โœจ

๐Ÿ’ป Where tech meets community.

Hello, Guest! ๐Ÿ‘‹
You're just a few clicks away from joining an exclusive space for tech enthusiasts, problem-solvers, and lifelong learners like you.

๐Ÿ” Why Join?
By becoming a member of CodeNameJessica, youโ€™ll get access to:
โœ… In-depth discussions on Linux, Security, Server Administration, Programming, and more
โœ… Exclusive resources, tools, and scripts for IT professionals
โœ… A supportive community of like-minded individuals to share ideas, solve problems, and learn together
โœ… Project showcases, guides, and tutorials from our members
โœ… Personalized profiles and direct messaging to collaborate with other techies

๐ŸŒ Sign Up Now and Unlock Full Access!
As a guest, you're seeing just a glimpse of what we offer. Don't miss out on the complete experience! Create a free account today and start exploring everything CodeNameJessica has to offer.

In this post I will show you how to install the ZSH shell on Rocky Linux. ZSH is an alternate shell that some people prefer instead of BASH shell. Some people say ZSH has better auto-completion, theme support, and plugin system. If you want to give ZSH a try its quite easy to install and give it a try. This post is focused on the Rocky Linux user and how to install ZSH and get started with its usage.

Before installing anything new, it’s good practice to update your system packages:

sudo dnf update

It might be easier than you think to install and use a new shell. First install the package like this:

sudo dnf install zsh

Now you can enter a session of zsh be invoking the shell’s name ‘zsh’.

zsh

You might not be sure if it succeeded, how you can verify which sell you are using now?

echo $0

You should see some output like the following:

[root@mypc]~# echo $0:
zsh:
[root@mypc]~#

ok good, if it says bash or something other than zsh you have a problem with your setup. Now lets run a couple basic commands

Example 1: Print all numbers from 1 to 10. In Zsh, you can use a for loop to do this:

for i in {1..10}; do echo $i; done

Example 2: Create a variable to store your username and then print it. You can use the $USER environment variable which automatically contains your username:

my_username=$USER
echo $my_username

Example 3: Echo a string that says “I love $0”. The $0 variable in a shell script or interactive shell session refers to the name of the script or shell being run. Here’s how to use it:

echo "I love $0"

When run in an interactive Zsh session, this will output something like “I love -zsh” if you’re in a login shell, or “I love zsh” if not.

Conclusion

Switching shells in a linux system is easy due to the modularity. Now that you see how to install ZSH you may like it and decide to use it as your preferred shell.

0 Comments

Recommended Comments

There are no comments to display.

Guest
Add a comment...

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.