Jump to navigation. In my previous articleI explained how to get started with Z-shell Zsh. For some users, the most exciting thing about Zsh is its ability to adopt new themes. It's so easy to theme Zsh both because of the active community designing visuals for the shell and also because of the Oh My Zsh project, which makes it trivial to install them.
There's a lot more to Oh My Zsh than just pretty themes, though; there are also hundreds of plugins that add features to your Z-shell environment. The ohmyz. While the Oh My Zsh project is almost certainly trustworthy, it's generally ill-advised to blindly run scripts on your system.
If you want to run the install script, you can download it, read it, and run it after you're satisfied you understand what it's doing. If you download the script and read it, you may notice that installation is only a three-step process:. Next, back up your existing. You can do this in one command using the -b backup option for mvas long as your version of the mv command includes that option:.
5 tips to improve productivity with zsh
To do that, append your old config to the end of the new one using the cat command :. The file is well-commented, so it's a great way to get a good idea of what's possible. For instance, you can change the location of your. After editing the config, you have to relaunch your shell. Before you do that, make sure you've finished any in-progress config changes; for instance, don't change the path of.
If you don't want to relaunch your shell, you can source the config file, just as you can with Bash:. Installing Oh My Zsh sets your Z-shell theme to robbyrussella theme by the project's maintainer. This theme's changes are minimal, mostly involving the color of your prompt.
To view all the available themes, list the contents of the.
"Oh My ZSH!"
To see screenshots of themes before trying them, visit the Oh My Zsh wiki. For even more themes, visit the External themes wiki page. Most themes are simple to set up and use. Just change the value of the theme name in. Other themes require extra configuration. For example, to use the agnoster theme, you must first install the Powerline font.
This is an open source font, and it's probably in your software repository if you're running Linux. Install it with:. Upon relaunch, you will see the new theme:. Over plugins ship with Oh My Zsh, and you can see them by looking in. Some plugins are relatively simple. For instance, the dnfubuntubrewand macports plugins are collections of aliases to simplify interactions with the DNF, Apt, Homebrew, and MacPorts package managers.
Others are more complex. The git plugin, active by default, detects when you're working in a Git repository and updates your shell prompt so that it lists the current branch and even indicates whether there are unmerged changes.
The plugins are now active.Jump to navigation. It has similarities to other shells in the sh Bourne shell family, such as as bash and kshbut it provides many advanced features and powerful command line editing options, such as enhanced Tab completion.
It would be impossible to cover all the options of zsh here; there are literally hundreds of pages documenting its many features. In this article, I'll present five tips to make you more productive using the command line with zsh. Through the years, the open source community has developed countless themes and plugins for zsh. A theme is a predefined prompt configuration, while a plugin is a set of useful aliases and functions that make it easier to use a specific command or programming language.
The quickest way to get started using themes and plugins is to use a zsh configuration framework. There are many available, but the most popular is Oh My Zsh. By default, it enables some sensible zsh configuration options and it comes loaded with hundreds of themes and plugins. A theme makes you more productive as it adds useful information to your prompt, such as the status of your Git repository or Python virtualenv in use.
Having this information at a glance saves you from typing the equivalent commands to obtain it, and it's a cool look. Here's an example of Powerlevel9kmy theme of choice:. In addition to themes, Oh My Zsh bundles tons of useful plugins for zsh. For example, enabling the Git plugin gives you access to a number of useful aliases, such as:.
There are plugins available for many programming languages, packaging systems, and other tools you commonly use on the command line.
Here's a list of plugins I use in my Fedora workstation:. Aliases are very useful in zsh. Defining aliases for your most-used commands saves you a lot of typing. Oh My Zsh configures several useful aliases by default, including aliases to navigate directories and replacements for common commands with additional options such as:.
In addition to command aliases, zsh enables two additional useful alias types: the suffix alias and the global alias. A suffix alias allows you to open the file you type in the command line using the specified program based on the file extension. For example, to open YAML files using vim, define the following alias:.
Now if you type any file name ending with yml or yaml in the command line, zsh opens that file using vim:. A global alias enables you to create an alias that is expanded anywhere in the command line, not just at the beginning. This is very useful to replace common filenames or piped commands. For example:. When you're using the command line, navigating across different directories is one of the most common tasks. Zsh makes this easier by providing some useful directory navigation features.
These features are enabled with Oh My Zsh, but you can enable them by using this command:. With these options set, you don't need to type cd to change directories. Just type the directory name, and zsh switches to it:. Zsh keeps the history of directories you visited so you can quickly switch to any of them. To see the list, type dirs -v :.
Now you can type d to see the first ten items in the list and the number to switch to it:. Finally, zsh automatically expands directory names with Tab completion.
Type the first letters of the directory names and TAB to use it:.Do you use your terminal all day?
Jazz Up Your “ZSH” Terminal In Seven Steps — A Visual Guide
Is the terminal the first app you start after restarting your computer? In this article, you will find how to improve your terminal look and practical commands for your day-to-day work. You need to have Homebrew installed. Homebrew requires Command Line Tools for Xcode. Run brew help to see if it is installed. You can download iterm2 or you can install iTerm2 with Homebrew.
Zsh is a shell designed for interactive use and it is also a powerful scripting language. And find your zsh version. If your shell is not zsh, run the following. Then restart your iTerm2 or open a new tab in iTerm2. It comes bundled with a ton of helpful functions, helpers, plugins, themes. You can install Oh-My-Zsh with running one of the following commands in iTerm. You can install this via the command-line with either curl or wget. When you need to upgrade Oh-My-Zsh:.
Wes … More about Wes Bos …. Every second Tuesday, we send a newsletter with useful techniques on front-end and UX.
With tools like Grunt, Gulp and Bower leveraging the increase in productivity that comes with working in the command line, we are seeing it become a much more friendly and comfortable place for beginners and experts alike. This article provides insight into some of the best tools to use in your day-to-day workflow in the command line and gets you started with a totally customized setup. Also, please make sure to check out my series on how to become a command-line power useravailable for free, of course.
Before we can start using ZSH, Z and related tools, getting the right terminal application up and running would be extremely helpful. This includes pane splitting, custom color schemes, paste history, fine-grained control over hotkeys, together with dozens of other handy preferences that you will find useful as you become more comfortable in the terminal.
On Windows we have the built-in PowerShell. You have a couple of options here. The easiest would be to install Cmdr, which provides Git integration, custom prompt and color schemes out of the box. For most, this will be more than enough to get started with all major web development tooling.
It cannot, however, do any of the ZSH and Z that we will be exploring below. When you start a terminal application, whether it be on your server or your local computer, it is running a shell called Bash. Bash is by far the most popular shell and comes with pretty much every UNIX-based operating system.
There are, however, alternatives to Bash that make using the terminal faster and more comfortable for web developers. One of the most popular shells with web developers is the Z shell, or ZSH. Before jumping into the next few sections, we need to know about ZSH settings. These are stored in a. Swap out open with your favorite editor command, such as nanosubl or vim.
Whenever you make a change to this file, you need to source it in order for the changes to take effect in your terminal. Customizing what your terminal looks like is one of the best things you can do. Not only does it make you look like a bad-ass coder, but it can greatly improve readability via different colors. It can also improve productivity by displaying important information related to file path, Git status and more! Prompts are the line s of text shown when you are about to type something into the terminal.
Your prompt provides useful information related to your project, such as the current version of Ruby, Node. You can customize your path into oblivion, but chances are that someone has created a prompt that already suits your needs.
Your ZSH theme is set in the few lines of your. You can browse all the ZSH themes and prompts in the wiki. Because there are hundreds of themes, not all of them come with ZSH by default. Note: Many of these themes require a patched font to display the arrows and Git icons. You can download the fonts on GitHub ; then, make sure to set them in your iTerm2 settings. By default, the themes come with your basic red, green, yellow and blue, but we can tweak those to be the exact variants that we want.
So, now that our terminal is looking great, what can we actually do with ZSH and related tools? Probably one of the most useful features of ZSH is that it enables us to list and tab through files and folders. If you have ever tried to perfectly spell the name of a file, struggled with the case or fought with an impossibly long list of folders with spaces in it, you know the pain and limitations of Bash.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up. Everything works fine, but when I become a root user, it changes to the default zsh theme. Disclaimer Updated : Only do this on a single user machine as it will make a user able to run programs as root see comment by Eliah Kagan.
I installed oh-my-zsh with root account. Now I login with another account, and install oh-my-zsh again in the home directory of the account. It works for the non-root account. For anyone else with the same question, I would recommend a combination of Tummala Dhanvi's and Morton's approach. I installed oh-my-zsh both as root and as the user using the following commands:. This approach allows for a shared config while keeping the system secure.
You will, however, need root privileges to edit. Ubuntu Community Ask! Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Asked 5 years, 7 months ago. Active 3 days ago. Viewed 38k times. Sajjad Hoviegar 95 11 11 bronze badges.
Tummala Dhanvi Tummala Dhanvi 1, 3 3 gold badges 14 14 silver badges 29 29 bronze badges. How are you becoming root? How did you install oh my zsh in the first place?
Any why not just do the same for root? I've done that for months on servers i managed. Active Oldest Votes. Morten Morten 1 1 gold badge 5 5 silver badges 13 13 bronze badges.
Subscribe to RSS
This should be the accepted answer, eliminates the hustle of installing zsh twice. If you do that, it actually doesn't make sense to link. I tried it and could not use oh-my-zsh plugins using this method. They were considered insecure by compinit. I recommend against this method, at least if one does not first consider the security risks.
Any program the user runs can edit those configuration files without prompting the user--because they belong to the user, not root--and thus can cause root to perform any action whatsoever next time root uses zsh!
Would you be willing to add or okay with someone else adding a warning about that to this answer? Henry Henry 4 4 bronze badges. Maarten Maarten 11 1 1 bronze badge. New contributor. Sign up or log in Sign up using Google. Sign up using Facebook.Simple zsh plugin that reminds you that you should use one of your existing aliases for a command you just typed.
You dont need to do anything.Advanced History with ZSH - Command Line Power User (8/11)
Once it's installed, zsh-you-should-use will let you know if you wrote a command with an existing alias. It is possible the plugin might work on even older versions. However they would not have been tested as part of the CI test process.
Then add this line to your. By default, you-should-use will display its reminder message before a command has executed. By default, you-should-use will display the best match from any matching aliases found. You can enable Hardcore mode to enforce the use of aliases. Enabling this will cause zsh to refuse to execute commands you have entered if an alternative alias for it exists.
This is a handy way of forcing you to use your aliases and help you turn those aliases into muscle memory. Now if you type a command that has an alias defined and you didnt use it, zsh will refuse to execute that command:. It's often useful to check how often we use our aliases so that we have an idea of which ones we could probably get rid of or remind ourselves of them if we forgot. If your history is disabled or if you limit your history to a certain amount of time, then the alias report generated will be a reflection of the limited data available.
This parameter specifies how many entries in the history to check when generating the report. In the example below, history is limited to the last entries when generating the alias report. I have tried to cater for as many use cases that I can think of. However, they are naturally tailored to to my own workflow and I could be missing many others. Run zunit in the root directory of the repo. NOTE: The tests that run move your git configuration to a temporary location during the test process so that your user configuration does not interfere with tests.
This will be restored at the end of each test so there is no risk in losing your settings.So folks, let me tell you this, there is no perfect OS. My workaround to this has been cmder, which is also superb! Here is how. Next, go to the windows store, and install ubuntu. Now launch ubuntu, and install zsh. Next do vi. Cool, now relaunch ubuntu, which will run zsh, go through the initial configuration. Next install agnoster, like this.
The issue here is that windows console supports only 16 colors. I know Microsoft is working on fixing this, but sticking with 16 colors, you can get quite close to solarized light, which is my favorite theme. Note that this will also affect your regular console, so. Create a. Import the above reg file. And finally, relaunch ubuntu, and now it looks like this, not too shabby huh?
But now you have pretty much everything oh my zsh offers. For instance, one theme I really like is powerlevel9k. Here it is running on windows. Gotta say, there is something super sexy about running oh my zsh on Windows, I now have Linux and Windows together!
You can even integrate this in VSCode, like this oh and if your themes with git integration are making the prompt too slow, use this trick to speed things up. Sign in. Angular Videos Contact me. Running oh my zsh on Windows Sahil Malik Follow. See responses 6. More From Medium. Related reads. Victor Mours. Casper Beyer in Commit Log. James Garijo-Garde in Better Programming. Discover Medium.