Exploring Zsh and Its Powerful Plugins: A Guide to Supercharge Your Terminal Experience
Tags: zsh, linux, terminal, bash
Published: 2023-10-31 04:52:35



Zsh, an upgraded version of the Bourne Shell, brings several new features like automatic cd (change directory), spell correction, themes, and plugins.

![ZSH](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v7ny2gckiv41e3fkjwqu.png)


&nbsp;
### Installation:

1) **Installation:** Open your terminal and enter the following command to install Zsh:

```
sudo apt install zsh

```
2) **Set Zsh as Your Default Shell:** Make Zsh your default shell using:

```
chsh -s /bin/zsh

```
3) **Log out first, then reopen the terminal.**

&nbsp;
## .zshrc

The `.zshrc` File: Your Personalized Shell Guidebook

The .zshrc file acts as a manual for your Zsh shell, allowing you to customize your shell environment. You can create shortcuts (aliases), modify your prompt's appearance, and add extra features (plugins) through this file.

zshrc is typically located in the user's home directory.

1) To edit the zshrc

```
gedit ~/.zshrc

```

2) To reload your shell to apply changes made in the .zshrc file.

```
exec .zshrc

```
&nbsp;
### Introducing Oh My Zsh:
![ZSH website](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tm1ryu6asvqrk5a6cptg.png)

**Oh My Zsh** is a tool that makes using the Zsh shell easier and more customizable. **It provides a collection of themes, plugins, and functions** that enhance your command-line experience. In simple words, it's like a toolbox that helps you customize and improve how you interact with your computer using the command line.


#### Installation Guide for Oh My Zsh

To install Oh My Zsh, simply visit the [official website](https://ohmyz.sh/) and locate the provided script. Copy this script, then open your terminal and paste it there to initiate the installation process

&nbsp;
## Must-Have Plugins

Oh My Zsh opens the door to a universe of plugins, each catering to specific needs and enhancing your workflow. Here are some essential plugins to consider:

### 1. **Git: Streamlining Version Control**

This plugin provides many aliases and functions that make working with Git from the command line easier.

#### Usage:

For detailed usage, you can refer to the [official documentation](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git).

#### Installation:

1) The git plugin comes bundled with Oh My Zsh.
2) To install it, append git to the plugin list in your `.zshrc `file in your home directory.
```
plugins=( 
    git
)
```

### 2. **Sudo**

The sudo plugin helps to add 'sudo' in front of previous commands by pressing the escape button twice.

#### Installation:

1. The sudo plugin comes bundled with Oh My Zsh.
2. To install it, append sudo to the plugin list in your `.zshrc `file in your home directory.

```
plugins=( 
    sudo
)
```

### 3. **Zsh-autosuggestions**

This plugin provides fish-like autosuggestions for zsh.

#### Installation:

1) First, clone the zsh-autosuggestions repository into `~/.oh-my-zsh/custom/plugins`.

```
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

```
2) Then, append zsh-autosuggestions to the plugin list in your `.zshrc` file in your home directory.

```
plugins=( 
    zsh-autosuggestions
)
```

### 4. **History**
This plugin provides several commands to work with your command history.

#### Usage:
**h**: Prints your command history.
**hs**: Use grep to search your command history.
**hsi**: Use grep to do a case-insensitive search of your command history.


#### Installation:

1) The `history` plugin comes bundled with Oh My Zsh.
2) To install it, append `history` to the plugin list in your `.zshrc` file in your home directory.

```
plugins=( 
    history
)
```

### 5. **Copypath**

The `copypath` plugin allows you to copy the current directory path to your system clipboard.

#### Installation:
1) The copypath plugin comes bundled with Oh My Zsh.
2) To install it, append copypath to the plugin list in your .zshrc file in your home directory.

```
plugins=( 
   copypath
)
```

### 6. **Copyfile**

The `copyfile` plugin allows you to copy the contents of a file to your system clipboard.

#### Installation:
1) The copyfile plugin comes bundled with Oh My Zsh.
2) To install it, append copyfile to the plugin list in your .zshrc file in your home directory.

```
plugins=( 
   copyfile
)
```

### 7. **Copybuffer**
The `copybuffer` plugin lets you copy the current command line to your system clipboard.

#### Installation:

1. The copybuffer plugin comes bundled with Oh My Zsh.
2. To install it, append copybuffer to the plugin list in your .zshrc file in your home directory.

```
plugins=( 
   copybuffer
)
```

### 8. **Dirhistory**

The `dirhistory` plugin provides commands for navigating directory history.


#### Installation:

1. The dirhistory plugin comes bundled with Oh My Zsh.
2. To install it, append dirhistory to the plugin list in your .zshrc file in your home directory.

```
plugins=( 
   copybuffer
)
```
### 9. **JsonTools**

The `jsonTools` plugin provides commands for validating and formatting JSON.

#### Installation:

1. The jsonTools plugin comes bundled with Oh My Zsh.
2. To install it, append jsonTools to the plugin list in your .zshrc file in your home directory.

```
plugins=( 
   jsonTools
)
```