{"id":1023,"date":"2022-07-31T09:40:25","date_gmt":"2022-07-31T16:40:25","guid":{"rendered":"https:\/\/jasonsblog.access.ly\/?p=1023"},"modified":"2022-11-05T08:55:33","modified_gmt":"2022-11-05T15:55:33","slug":"dramatically-improve-your-cli-by-switching-to-zsh-and-oh-my-zsh-with-two-stellar-added-plugins","status":"publish","type":"post","link":"https:\/\/jasonsblog.ddns.net\/index.php\/2022\/07\/31\/dramatically-improve-your-cli-by-switching-to-zsh-and-oh-my-zsh-with-two-stellar-added-plugins\/","title":{"rendered":"Dramatically Improve Your CLI by Switching to Zsh and Oh My Zsh with Two Stellar Added Plugins"},"content":{"rendered":"\n<p>In my decades of using Linux, I&#8217;ve never really ventured away from <a aria-label=\"BASH (opens in a new tab)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Bash_(Unix_shell)\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">BASH<\/a>, Bourne Again SHell, which was a GNU project to improve upon the Bourne Shell that originated with Bell Labs and AT&amp;T my former employer. But with using Kali Linux I was unknowingly using <a aria-label=\"Zsh (opens in a new tab)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Z_shell\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Zsh<\/a> with a couple wonderful plugins which has motivated me to switch over most of my machines and virtual machines. Not only can you jazz up the look of your terminal with multiple themes included in <a aria-label=\"Oh My Zsh (opens in a new tab)\" href=\"https:\/\/ohmyz.sh\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Oh My Zsh<\/a>, but two plugins are extremely useful, <a href=\"https:\/\/github.com\/zsh-users\/zsh-autosuggestions\" target=\"_blank\" aria-label=\"zsh-autosuggestions (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">zsh-autosuggestions<\/a> and <a href=\"https:\/\/github.com\/zsh-users\/zsh-syntax-highlighting\" target=\"_blank\" aria-label=\"zsh-syntax-highlighting (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">zsh-syntax-highlighting<\/a>. Syntax Highlighting just helps you format your command and Auto Suggestions helps pull in history by showing you commands you regularly use without needing to finish typing the command. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"860\" height=\"644\" src=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-from-2022-07-31-09-14-25-updraft-pre-smush-original.png\" alt=\"\" class=\"wp-image-1945\" srcset=\"https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-from-2022-07-31-09-14-25-updraft-pre-smush-original.png 860w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-from-2022-07-31-09-14-25-updraft-pre-smush-original-300x225.png 300w, https:\/\/jasonsblog.ddns.net\/wp-content\/uploads\/2022\/11\/Screenshot-from-2022-07-31-09-14-25-updraft-pre-smush-original-768x575.png 768w\" sizes=\"auto, (max-width: 860px) 100vw, 860px\" \/><figcaption class=\"wp-element-caption\">Zsh Agnoster theme showing syntax highlighting and auto completion<\/figcaption><\/figure>\n\n\n\n<p>To install Zsh on Debian\/Ubuntu systems:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install zsh<\/code><\/pre>\n\n\n\n<p>To install on Arch based systems:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pacman -S zsh<\/code><\/pre>\n\n\n\n<p>To install on Red Hat based systems:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install zsh<\/code><\/pre>\n\n\n\n<p>To install on Solus Linux:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo eopkg install zsh<\/code><\/pre>\n\n\n\n<p>To change the shell you&#8217;ll need to get your zsh location:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>whereis zsh<\/code><\/pre>\n\n\n\n<p>Then use that location to switch shells, and you can also use autocomplete to help, usually \/bin\/zsh as below and substitute your login id for user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chsh -s \/bin\/zsh user<\/code><\/pre>\n\n\n\n<p>To enable zsh you&#8217;ll need to logout and log back in. But we&#8217;ll continue by installing Oh My Zsh (you might need to install git and wget on your system like zsh above):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/github.com\/robbyrussell\/oh-my-zsh\/raw\/master\/tools\/install.sh -O - | zsh<\/code><\/pre>\n\n\n\n<p>It&#8217;s always a good idea to inspect scripts before you install, and you can examine the script <a href=\"https:\/\/github.com\/ohmyzsh\/ohmyzsh\/blob\/master\/tools\/install.sh\" target=\"_blank\" aria-label=\"here (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">here<\/a>.<\/p>\n\n\n\n<p>Once installed copy files:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp ~\/.oh-my-zsh\/templates\/zshrc.zsh-template ~\/.zshrc<\/code><\/pre>\n\n\n\n<p>Now we&#8217;ll install the zsh-autosuggestions plugin:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/zsh-users\/zsh-autosuggestions.git ~\/.oh-my-zsh\/custom\/plugins\/zsh-autosuggestions<\/code><\/pre>\n\n\n\n<p>Then install the zsh-syntax-highlighting plugin:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/zsh-users\/zsh-syntax-highlighting.git ~\/.oh-my-zsh\/custom\/plugins\/zsh-syntax-highlighting<\/code><\/pre>\n\n\n\n<p>Then we&#8217;ll need to edit the file ~\/.zshrc, change the theme to Agnoster:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ZSH_THEME=\"agnoster\"<\/code><\/pre>\n\n\n\n<p>Then we&#8217;ll update the plugins (can be changed to your needs and here is a list of available plugins <a aria-label=\"here (opens in a new tab)\" href=\"https:\/\/github.com\/ohmyzsh\/ohmyzsh\/tree\/master\/plugins\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">here<\/a>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plugins=(git colorize github pip python zsh-autosuggestions zsh-syntax-highlighting docker)<\/code><\/pre>\n\n\n\n<p>Save the file and then we&#8217;ll need to load into zsh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>source ~\/.zshrc<\/code><\/pre>\n\n\n\n<p>Now logout and back in and you&#8217;ll have zsh as your shell. If the Agnoster theme doesn&#8217;t show properly, not the clean arrow prompt, you&#8217;ll need to install the <a aria-label=\"Powerline font (opens in a new tab)\" href=\"https:\/\/github.com\/powerline\/fonts\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Powerline font<\/a> in your distribution as I had a couple where it wasn&#8217;t installed by default. One note, when using the zsh-autosuggestion to accept the command it is showing hit the right arrow or END key.<\/p>\n\n\n\n<p>Now with Oh My Zsh you&#8217;re not limited to just one theme, and you can look through the available themes <a aria-label=\"here (opens in a new tab)\" href=\"https:\/\/github.com\/ohmyzsh\/ohmyzsh\/wiki\/Themes\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">here<\/a>, and to enable you&#8217;ll need to change in ~\/.zshrc and reload with the source command. If the theme doesn&#8217;t display properly you may need to install some additional fonts from <a aria-label=\"Nerd Fronts (opens in a new tab)\" href=\"https:\/\/github.com\/ryanoasis\/nerd-fonts\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Nerd Fronts<\/a>. And there are a lot more <a href=\"https:\/\/github.com\/ohmyzsh\/ohmyzsh\/wiki\/External-themes\" target=\"_blank\" aria-label=\"additional themes you can look through on the Oh My Zsh Github page (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">additional themes you can look through on the Oh My Zsh Github page<\/a> as well. <\/p>\n\n\n\n<p>I think you&#8217;ll agree that with auto suggestions and syntax highlighting you&#8217;ll find Zsh a delight to do your command line work. And there are even more shells if you want to experiment not to mention a lot more customizations you can make to Zsh. You have to love the variety you have with Unix and Linux systems not to mention the power of the command line in completing tasks.<\/p>\n\n\n\n<p>One additional tip, if you like to run a program and have it go to the background and say close the terminal, there was one quirk with Zsh, you have to use &amp;! instead of just &amp;.  And if you want to go back to BASH you&#8217;d use the chsh command above to point your user back to BASH.<\/p>\n\n\n\n<p>I hope you enjoy using Zsh as much as I do. And it makes me think it&#8217;s time to try out the other shells as well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my decades of using Linux, I&#8217;ve never really ventured away from BASH, Bourne Again SHell, which was a GNU project to improve upon the Bourne Shell that originated with Bell Labs and AT&amp;T my former employer. But with using Kali Linux I was unknowingly using Zsh with a couple wonderful plugins which has motivated [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1023","post","type-post","status-publish","format-standard","hentry","category-tech"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"featured_image_src":null,"author_info":{"display_name":"Jason","author_link":"https:\/\/jasonsblog.ddns.net\/index.php\/author\/jturning\/"},"_links":{"self":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/1023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/comments?post=1023"}],"version-history":[{"count":5,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":1946,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/posts\/1023\/revisions\/1946"}],"wp:attachment":[{"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/media?parent=1023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/categories?post=1023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jasonsblog.ddns.net\/index.php\/wp-json\/wp\/v2\/tags?post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}