<?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: KC Beard</title>
    <description>The latest articles on DEV Community by KC Beard (@kcbeard).</description>
    <link>https://dev.to/kcbeard</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%2F430071%2F94c2859f-321e-4e35-86db-fca90cb59486.jpeg</url>
      <title>DEV Community: KC Beard</title>
      <link>https://dev.to/kcbeard</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kcbeard"/>
    <language>en</language>
    <item>
      <title>5 Tips to Supercharge Your Terminal</title>
      <dc:creator>KC Beard</dc:creator>
      <pubDate>Sun, 12 Jul 2020 16:28:15 +0000</pubDate>
      <link>https://dev.to/kcbeard/5-tips-to-supercharge-your-terminal-j67</link>
      <guid>https://dev.to/kcbeard/5-tips-to-supercharge-your-terminal-j67</guid>
      <description>&lt;p&gt;Sometimes using the terminal can be a nightmare. I've compiled a few tips that can help make the terminal less scary and more enjoyable.&lt;/p&gt;

&lt;h1&gt;
  
  
  1: Use the Right Tools
&lt;/h1&gt;

&lt;p&gt;Two tools are essential for improving your terminal: your &lt;em&gt;app&lt;/em&gt; and your &lt;em&gt;shell&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For my app I use &lt;a href="https://www.iterm2.com/"&gt;iTerm2&lt;/a&gt;. It solves a lot of the headaches associated with the default Terminal.app. Other popular choices are &lt;a href="https://hyper.is/"&gt;hyper&lt;/a&gt; and &lt;a href="https://github.com/alacritty/alacritty"&gt;alacritty&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For my shell I use &lt;a href="https://ohmyz.sh/"&gt;oh my zsh&lt;/a&gt;. The primary benefit of oh-my-zsh is the "plugins" written by other users (more on this later).&lt;/p&gt;

&lt;h1&gt;
  
  
  2: Love your theme and prompt
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RboHh0dv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6wxwqt37w15i2wiflmad.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RboHh0dv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6wxwqt37w15i2wiflmad.png" alt="Example terminal theme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should find a theme and prompt that (1) you enjoy using and (2) presents useful information at a glance.&lt;/p&gt;

&lt;p&gt;I enjoy dark mode with bright, easy to read colors. You can see I have a few useful snippets of information in my prompt: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The arrow at the beginning tells me if the previous command was successful (green) or failed (red) &lt;/li&gt;
&lt;li&gt;The directory I'm currently in (with my &lt;code&gt;$HOME&lt;/code&gt; represented as &lt;code&gt;~&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;The branch I'm currently on &lt;/li&gt;
&lt;li&gt;A yellow &lt;code&gt;x&lt;/code&gt; if my branch is in a "dirty state"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can browse available oh-my-zsh themes &lt;a href="https://github.com/ohmyzsh/ohmyzsh/wiki/Themes"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here's the code for the prompt I use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;function &lt;/span&gt;get_pwd&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PWD&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="p"&gt;/~&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;ret_status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%(?:%{&lt;/span&gt;&lt;span class="nv"&gt;$fg_bold&lt;/span&gt;&lt;span class="s2"&gt;[green]%}➜ :%{&lt;/span&gt;&lt;span class="nv"&gt;$fg_bold&lt;/span&gt;&lt;span class="s2"&gt;[red]%}➜ )"&lt;/span&gt;
&lt;span class="nv"&gt;PROMPT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'${ret_status}%{$fg[cyan]%} $(get_pwd)%{$reset_color%}$(git_prompt_info) '&lt;/span&gt;

&lt;span class="nv"&gt;ZSH_THEME_GIT_PROMPT_PREFIX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%{&lt;/span&gt;&lt;span class="nv"&gt;$fg_bold&lt;/span&gt;&lt;span class="s2"&gt;[blue]%} (%{&lt;/span&gt;&lt;span class="nv"&gt;$fg&lt;/span&gt;&lt;span class="s2"&gt;[red]%}"&lt;/span&gt;
&lt;span class="nv"&gt;ZSH_THEME_GIT_PROMPT_SUFFIX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%{&lt;/span&gt;&lt;span class="nv"&gt;$reset_color&lt;/span&gt;&lt;span class="s2"&gt;%}"&lt;/span&gt;
&lt;span class="nv"&gt;ZSH_THEME_GIT_PROMPT_DIRTY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%{&lt;/span&gt;&lt;span class="nv"&gt;$fg&lt;/span&gt;&lt;span class="s2"&gt;[blue]%}) %{&lt;/span&gt;&lt;span class="nv"&gt;$fg&lt;/span&gt;&lt;span class="s2"&gt;[yellow]%}✗"&lt;/span&gt;
&lt;span class="nv"&gt;ZSH_THEME_GIT_PROMPT_CLEAN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%{&lt;/span&gt;&lt;span class="nv"&gt;$fg&lt;/span&gt;&lt;span class="s2"&gt;[blue]%})"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  3: Install the right plugins
&lt;/h1&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;
  git
  copyfile
&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;For oh-my-zsh, you should browse the &lt;a href="https://github.com/unixorn/awesome-zsh-plugins"&gt;list of awesome zsh plugins&lt;/a&gt;. Installing these plugins is easy: you can make a list of them in your &lt;code&gt;.zshrc&lt;/code&gt;, open a new terminal window, and they'll magically work. Here's a few of my favorites.&lt;/p&gt;

&lt;h4&gt;
  
  
  Git
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VLUkCA0d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dmkaoeh11xeuwdoiywtl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VLUkCA0d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dmkaoeh11xeuwdoiywtl.png" alt="Terminal showing example of shortended git commands"&gt;&lt;/a&gt;&lt;br&gt;
The &lt;a href="https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git"&gt;git plugin&lt;/a&gt; gives you a ton of useful aliases and functions that cuts out a lot of characters from your git commands.&lt;/p&gt;
&lt;h4&gt;
  
  
  Autosuggestions
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vq5EiN82--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mto6gg2gklo25qu8kcy6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vq5EiN82--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mto6gg2gklo25qu8kcy6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Super useful tool that gives you autocomplete without having to comb through history.&lt;/p&gt;
&lt;h4&gt;
  
  
  Diff-so-fancy
&lt;/h4&gt;

&lt;p&gt;This one isn't an oh-my-zsh plugin, but I've found &lt;a href="https://github.com/so-fancy/diff-so-fancy"&gt;diff-so-fancy&lt;/a&gt; to be invaluable because it makes &lt;code&gt;git diff&lt;/code&gt; output so much easier to read.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZZ3M4IH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/3429760/32387617-44c873da-c082-11e7-829c-6160b853adcb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZZ3M4IH8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://user-images.githubusercontent.com/3429760/32387617-44c873da-c082-11e7-829c-6160b853adcb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  4: Alias your common operations
&lt;/h1&gt;

&lt;p&gt;When you come across a long command that you struggle to remember, create an alias for it! &lt;/p&gt;

&lt;p&gt;For example, I enjoy having a command &lt;code&gt;gls&lt;/code&gt; that acts like &lt;code&gt;ls&lt;/code&gt;, but for my git branches, listing them in priority of most recently used. Here's how I defined that alias and an example usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# in your .zshrc&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;gls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)'"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yZANxD3v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ubtqwlzdpib07c9qulxm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yZANxD3v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ubtqwlzdpib07c9qulxm.png" alt="Terminal image showing 5 most recent branches"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  5: Create a git repo for your dotfiles
&lt;/h1&gt;

&lt;p&gt;Inevitably, when you're exploring new terminal setups, you'll break something and want to revert to a previous state. Or you'll get a new computer, switch jobs, etc and struggle to get your previous setup working again.&lt;/p&gt;

&lt;p&gt;A former (very talented) coworker of mine introduced to me to &lt;a href="https://github.com/kc-beard/dotfiles"&gt;the dotfile setup I use now&lt;/a&gt;. It's helped me undo some terrible errors, and makes it painless to switch to new computer.&lt;/p&gt;




&lt;p&gt;Thanks for reading! Let me know your favorite terminal tips in the comments.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>bash</category>
      <category>beginners</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
