How to import OhMyZsh settings and themes to root user

Computer users and technology in general can be divided into two groups. Those who like things just functional, regardless of aesthetics. And those (like me) who, besides functional things, also like them cute. Yes, we like a good fragrance.

how-to-import-ohmyzsh-settings-and-themes-to-root-user Today's article is a complement to another article you can find on here. And also to the two videos below. If you don't know what ZSH or OhMyZshIt is essential that, for the full understanding of this article, you watch these two videos.

Well, now that you know what it is, let's get down to business.

In the article, and the videos cited above, you learned how to install the ZSH and use it as the default shell instead of bash. They also learned to customize the look of the ZSH through the OhMyZshYou can choose from many themes to leave the terminal with your face.

However, a small detail was not covered in previous posts: how to make the settings and themes of OhMyZsh also apply when we use the terminal in mode root.

After you have installed both, ZSH and OhMyZsh, and set up the desired theme (in my case, the Agnoster theme), as explained in the posts linked above. You will have your terminal look similar to the image below:


However, as you can see in the image, when entering root, the settings do not hold and return to the default ZSH.

What are we going to do now configure so that all the settings referring to the OhMyZsh, are also applied to the user root.

How to perform the procedure?

The tutorial below will be divided into two parts, each with a different method for performing the same procedure. Regardless of which method you choose, the result will be the same.

The first method (1), best suited for those who prefer to perform the procedure via graphic interface, through a script that will do all the step by step so automatic. And the second (2), for those who want to do manually, through himself terminal.

1) Performing the procedure via graphical interface.

Download the script by clicking on here. To access the repository page in Githubclick on here.

In the preferences of your file manager, on the tab Behaviorin the section Executable Text Files, select the option Ask what to do. This will allow you to run the script without having to open the terminal.

Obs.: All popular file managers have this option. However, it may be elsewhere, or have a slightly different name if you are using a file manager other than Nautilus.

nautilus preferences

Right click on the script you downloaded, go to properties. In the tab Permissions check box Allow file execution as a program.

Now d two clicks about the script click Run in terminal, enter your password and press Enter.


After a few seconds the message appears Operation completed..


Ready! Now just open your terminal and see how it went.

2) Performing the procedure manually, via terminal.

Run the following commands in the following order:

Copy the .zshrc file to the / root directory.

sudo cp /home/$USER/.zshrc / root

Copy the .oh-my-zsh folder to the / root directory:

sudo cp -r /home/$USER/.oh-my-zsh / root

Edit the .zshrc file that is in the / root directory:

Paste the line below into the file .zshrc, so that it looks like the image below:

export ZSH = "/ root / .oh-my-zsh"

Press Control + O followed by Enter to save, and then Control + X to close the text editor.

Restart the terminal, and you're done!

What do you think about these perfumes? Do you, like me, think that the visual aspect is very important, or do you think the important thing is just being functional? Tell us your opinion in the comments.

Do you like Linux and technology? Got a question or problem you can't solve? Come join our community in the Diolinux Plus!

For today all staff!


See an error or would you like to add any suggestions to this article? Collaborate, click here.