Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (2023)

.zshrc is a configuration file that contains the commands that run the zsh shell, just like the .bashrc file that contains the commands for the bash shell. Contains scripts to run when an interactive zsh session is started. On Linux, the file is stored as a hidden file in the home/user directory. The file can be edited to customize the zsh experience, but customization is not recommended. The file is also hidden and stored in the user's home directory on macOS. The file is created automatically when the zsh shell is installed on a system. Today we will look at the .zshrc file in detail.


  • what is zh

    Zsh is short for Z shell. It's an interactive login.shelloriginally developed in the 1990s for the Unix operating system. zsh is built on top of Bash, so it inherits all of the original features and functionality of the Bash shell, plus many others. It's the default shell on macOS and also comes pre-installed on some Linux distributions like Kali Linux, but it's not enabled by default. Zsh can be easily installed on all Linux distributions via the respective package manager. Use the following commands to install zsh on your Linux distribution.

    $ sudo pacman -Sy zsh// don't use Arch$ sudo apt-get install zsh// don't use debian/ubuntu$ sudo dnf install zsh// don't use Fedora
    Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (1)

    .zshrc file

    The .zshrc file is created automatically when zsh is installed on your system. The period (.) in front of the filename indicates that the file is hidden and not visible unless otherwise noted. The command allows you to examine the file in your home directory yourself"after,' which lists the entire contents of the directory. Use this command in the home/user directory of your file system and you will find the .zshrc file at the bottom of the list.

    The file contains scripts used to configure keyboard shortcuts, functions, options, and other important parameters used when starting a new instance of zsh. It is technically known as the boot file and there are five zsh boot files in total. But .zshrc is more important and is the only one found in the home directory. The file can easily be opened and its contents viewed or modified with the text editor of your choice. As mentioned in the file itself, the contents of the file must not be modified incorrectly or you could end up corrupting zsh.

    Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (2)

    zshrc vs zprofile

    Zprofile is also one of the five zsh installation files and is also located in the home directory. The main difference between zshrc and zprofile is that zprofile contains login user information and settings while zshrc contains other scripts and links, options etc. Another notable difference between the two files is that the zshrc is generated whenever a new instance of the zsh shell is started, while the zprofile file is generated once when the user logs in.

    (Video) Customizing Zsh

    Reload zshrc

    If you add or change the zshrc file, you must reload the file for the changes to take effect, or the aliases or functions you just added to the file will not work in the shell. Run the following command in the zsh shell to reload the configuration file and make the changes effective.

    $ Quelle ~/.zshrc

    Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (3)


    Fixed Xtools XToolkit installation error

    Zshrc vs Bashrc

    .bashrc is a bash configuration file that resides in the home directory and is hidden, unlike the zshrc file, which contains the full configuration source for the zsh shell. The bashrc file is relatively small and does not contain any configuration scripts for the bash shell. bashrc is only used to set aliases and other environment variables for the bash shell, but contains no additional information or scripts. zshrc, on the other hand, can not only be used to define aliases, but also contains the default configuration scripts and environment variables.

    Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (4)
    (Video) Uninstall Oh My ZSH Right Now And Do This Instead

    Add functions to zshrc

    Like aliases for custom commands in terminals, custom functions can be added to the configuration file. You must add the function definition to the file and then check out or reload the file before using it. The function definition syntax and how it is automatically loaded into the zsh shell is shown below.

    // function syntax functiondef func_name(args){ // // function body // returns return_obj //return value }

    Add the following declarations to the file so that the function loads automatically and you don't have to find it manually each time.

    fpath=(~/functions $fpath) // path to file with functionsautoload function_1 function_2 //name of functions

    zshrc file aliases

    Aliases are shortcut commands used to run a specific command in the terminal. An example of an alias is the simplest "CD" domain. No matter what working directory you are in, an empty cd command will always change your current working directory to "~/. (home/username)" without specifying the destination address of the target. Users can define their own aliases based on their custom requirements. Aliases can be added to the file in a specific syntax and saved. They can be used later.

    Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (5)

    Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (6)


    Troubleshooting DeepMotion Preview Not Working - Tips and Tricks

    (Video) ~/.dotfiles in 100 Seconds

    How to create a zshrc file on macOS

    Zsh may be the default shell on macOS, but the zshrc file is not in your home directory by default. Preferences and other scripts are stored elsewhere on macOS. However, if you need to change some variables or add aliases to the zsh shell, you can create the file yourself and add changes to it and it will work exactly as you want. Follow the given steps to create a zsh configuration file on macOS.

    • Open Terminal.
    • Make sure you're there~/ (home/<Benutzer>)“Directory.
    • Enter the command"Tap ~/.zshrc“.
    • A new file is created in the directory.
    • Open and edit the file with your text editor of choice and save your changes.
    • Load the file into the shell by typing "Quelle ~/.zshrc

    add zshrc to the path

    PATH is a global environment variable that contains the directory locations of executable binaries on your system. To get the value of the PATH variable in yoursystem linux, enter the command "echo $PATH" in the shell and your PATH addresses will be returned. New entries for PATH variables can be added to the zshrc. Complete the following steps to enter a new address in the zsh shell path variable.

    • Open Terminal.
    • Make sure you're there/home/<Benutzer>Directory.
    • open this.zshrcFile with your text editor of choice (we used nano here).
    • Add to "export PATH=<add1>:<add2>
    • Write the file withStrg + O.
    • End the file withcheck+X.

    USE– <add1> and <add2> are two different addresses separated by a colon. You can add multiple addresses on a single line by separating them with a colon.

    Zshrc File Explained in 10 Easy to Understand Points - Pond Tools (7)


    Get Virtufi Don't have internet access? You must do this!

    (Video) My AMAZING Terminal Setup - Hyper, Oh My Zsh, Fig.io, and More!


    How do I start a zsh shell from bash?

    Just type "zsh" in the bash terminal and hit enter.

    What are all zsh startup files?

    There are five zsh initialization files: .zshrc, .zshprofile, .zshenv, .zshlogin, .zshlogout.

    Where is the .zshrc file on macOS?

    Also on macOS the zshrc file is located in the„~/ (home/<Benutzer>)" directory. It is hidden and not visible unless specified in the command or file manager.

    (Video) Arch Linux: Getting Started With ZSH


    .zshrc is a configuration file needed to configure the zsh shell. We compare the file with similar files like zprofile and bashrc to understand that it is much more complicated and important than both. The file can be safely edited to use the zsh shell as per the user's needs, e.g. B. by adding PATH addresses and aliases. Otherwise the file must be modified and left as is.

    trending now

    • Fix Xtools XToolkit Installation ErrorBy Dharam Nath Jha ● March 3, 2023
    • Troubleshooting DeepMotion Preview Not Working - Tips and Tricks By Dharam Nath Jha ● March 3, 2023
    • Get Virtufi Don't have internet access? This must be done! by Dharam Nath Jha• February 16, 2023
    • The Ultimate Guide to Fixing Wabbajack Unknown Error By Dharam Nath Jha ● February 16, 2023


    1. Too lazy to configure ZSH? Just use this script...
    (Eric Murphy)
    2. How To Make Your macOS Terminal Amazing From Scratch
    (Kantan Coding)
    3. Customize Iterm 2 with ZSH and Powerlevel10k | ZSH Tutorial
    (Quentin Watt Tutorials)
    4. New *incredible* mac OS terminal! (warp + starship + zsh)
    (Christian Lempa)
    5. Dotfiles! Here's how I organize them.
    (Andrew Burgess)
    6. How to create perfect billboards in Planet Zoo using free apps!
    Top Articles
    Latest Posts
    Article information

    Author: Moshe Kshlerin

    Last Updated: 01/29/2023

    Views: 6319

    Rating: 4.7 / 5 (57 voted)

    Reviews: 80% of readers found this page helpful

    Author information

    Name: Moshe Kshlerin

    Birthday: 1994-01-25

    Address: Suite 609 315 Lupita Unions, Ronnieburgh, MI 62697

    Phone: +2424755286529

    Job: District Education Designer

    Hobby: Yoga, Gunsmithing, Singing, 3D printing, Nordic skating, Soapmaking, Juggling

    Introduction: My name is Moshe Kshlerin, I am a gleaming, attractive, outstanding, pleasant, delightful, outstanding, famous person who loves writing and wants to share my knowledge and understanding with you.