<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dien Bui</title>
    <description>The latest articles on DEV Community by Dien Bui (@joebui).</description>
    <link>https://dev.to/joebui</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F65648%2Fa059ed2a-a4fd-4687-8ed8-db234d99f25a.png</url>
      <title>DEV Community: Dien Bui</title>
      <link>https://dev.to/joebui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joebui"/>
    <language>en</language>
    <item>
      <title>Getting started with oh-my-zsh</title>
      <dc:creator>Dien Bui</dc:creator>
      <pubDate>Wed, 26 Jul 2023 13:56:53 +0000</pubDate>
      <link>https://dev.to/joebui/getting-started-with-oh-my-zsh-3ecl</link>
      <guid>https://dev.to/joebui/getting-started-with-oh-my-zsh-3ecl</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Oh-my-zsh is an open source, community-driven framework for managing zsh and it is FREE. It has more than 180 optional plugin (rails, git, …), more than 120 theme and an auto-update tool to keep oh-my-zsh up-to-date.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this tutorial, I will guide you to install it on your PC/laptop. The great thing about this is that you can customize your Shell and add plugins. Unlike the old Bash shell, which does not look attractive and can make it difficult for you to use when working with command-line a lot.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Linux and macOS because oh-my-zsh works best on Unix-based OS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UPDATE: WSL (Windows Subsystem for Linux) works with oh-my-zsh too.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;zsh must be pre-installed. In OSX, it is already pre-installed. On Linux, you will need to type command in the Terminal to install:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;curl or wget must be installed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For Debian/Ubuntu:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;zsh


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;For Fedora:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;zsh


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Install oh-my-zsh
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;curl&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

curl &lt;span class="nt"&gt;-L&lt;/span&gt; https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;or &lt;code&gt;wget&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh &lt;span class="nt"&gt;-O&lt;/span&gt; - | sh


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Change default shell
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

chsh &lt;span class="nt"&gt;-s&lt;/span&gt; /bin/zsh


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Note: For some OSes, you may need to restart your computer for this to take effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Change Terminal theme
&lt;/h2&gt;

&lt;p&gt;Now you have successfully installed oh-my-zsh. You will need to change the theme that is suitable for you, instead of using the default one. To change it, you will need to modify the .zshrc file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

vim ~/.zshrc


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In this tutorial, I use vim text editor, you can use other text editor if you like. Next, locate this line in the file &lt;code&gt;ZSH_THEME="robbyrussell"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Change the name &lt;code&gt;robbyrussell&lt;/code&gt; to another name of another theme. You can have a look of all the available themes on this &lt;a href="https://github.com/ohmyzsh/ohmyzsh/wiki/Themes" rel="noopener noreferrer"&gt;website&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;Finally, just restart the Terminal and you will see the difference.&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto-completion with Up
&lt;/h2&gt;

&lt;p&gt;In Bash shell, you can use Ctrl + R and type keyword to auto-fill the most recent and matching command.&lt;/p&gt;

&lt;p&gt;With oh-my-zsh, there is another way: you can type the starting words of the command you want and press Up button to cycle through the history.&lt;/p&gt;

&lt;p&gt;For example, I am a Docker guy and use Docker daily and I want to view log of a container, I just simple type docker logs then press up, I will cycle me through:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

docker logs &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nt"&gt;--tail&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 cocoon-rest &lt;span class="o"&gt;(&lt;/span&gt;first click&lt;span class="o"&gt;)&lt;/span&gt;
docker logs &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nt"&gt;--tail&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 cocoon-webapp &lt;span class="o"&gt;(&lt;/span&gt;second click&lt;span class="o"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After the second click, it shows the command I want, I hit Enter and then I can view the log of it.&lt;/p&gt;

&lt;p&gt;I won’t explain about Docker in this post as it’s out of scope, but intend to write a Docker 101 post soon :) .&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto-completion with Tab
&lt;/h2&gt;

&lt;p&gt;In Bash shell, you can type keyword and press Tab to show list of matching commands, however you need to cycle through the list and remember the name you want and manually type further to complete.&lt;/p&gt;

&lt;p&gt;With oh-my-zsh, things will get better, after pressing Tab the first time, you can press the second time to allow cycling through the list and choose the command you want, then it will automatically fill the rest of the words and finally just hit Enter and you are good to go. For example:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Type doc and press Tab the first time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610207536038%2FY2JRygIkW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610207536038%2FY2JRygIkW.png" alt="1_KTWHpqvCaLFL6KWC8U2wtw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press Tab the second time, then press Tab for Up, Down, Left, Right to cycle through&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610207556859%2FfghWE_9N-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1610207556859%2FfghWE_9N-.png" alt="1_-b3VNwZivUqVcLFQKV0mRQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Updating oh-my-zsh
&lt;/h2&gt;

&lt;p&gt;It will update automatically, but if you want to do so manually just simply type this command in Terminal&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;p&gt;omz update&lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Read more&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;For more information about oh-my-zsh, you can have a look at this &lt;a href="https://ohmyz.sh/" rel="noopener noreferrer"&gt;website&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Note: this post's origin is from my similar post on Medium with slight modification to update with latest changes of oh-my-zsh: &lt;a href="https://dienbui.medium.com/using-oh-my-zsh-f65be6460d3f" rel="noopener noreferrer"&gt;https://dienbui.medium.com/using-oh-my-zsh-f65be6460d3f&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>shell</category>
      <category>ohmyzsh</category>
    </item>
  </channel>
</rss>
