<?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: Nihey Takizawa</title>
    <description>The latest articles on DEV Community by Nihey Takizawa (@nihey).</description>
    <link>https://dev.to/nihey</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%2F1406733%2Fffeda99c-381a-4afd-b056-6db05cabebca.jpeg</url>
      <title>DEV Community: Nihey Takizawa</title>
      <link>https://dev.to/nihey</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nihey"/>
    <language>en</language>
    <item>
      <title>Mastering the Linux Terminal / Command-Line</title>
      <dc:creator>Nihey Takizawa</dc:creator>
      <pubDate>Mon, 08 Apr 2024 14:37:35 +0000</pubDate>
      <link>https://dev.to/nihey/mastering-the-linux-terminal-command-line-3953</link>
      <guid>https://dev.to/nihey/mastering-the-linux-terminal-command-line-3953</guid>
      <description>&lt;p&gt;Using the terminal is something any developer will eventually need. It is part of my daily routine to perform almost all of my development activities in a terminal, mastering this skill is something that will certainly boost your productivity and make you learn how to use any command-line interface (CLI) faster.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to read a Manual
&lt;/h1&gt;

&lt;p&gt;When you wish to read the manual or help section of any command-line, it is pretty straightforward, just run: &lt;code&gt;man &amp;lt;command&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;command&amp;gt; --help&lt;/code&gt; and it should give you some instructions on how to do it, right? But do you know how to read these manuals properly?&lt;/p&gt;

&lt;p&gt;For instance, by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;man git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will give you this man page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl8nvnasqjvhxc9jlq7po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl8nvnasqjvhxc9jlq7po.png" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can navigate it by using the arrow keys and quit using &lt;code&gt;q&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Do you understand what this section means with its symbols and conventions?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git [-v | --version] [-h | --help] [-C &amp;lt;path&amp;gt;] [-c &amp;lt;name&amp;gt;=&amp;lt;value&amp;gt;]
    [--exec-path[=&amp;lt;path&amp;gt;]] [--html-path] [--man-path] [--info-path]
    [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
    [--git-dir=&amp;lt;path&amp;gt;] [--work-tree=&amp;lt;path&amp;gt;] [--namespace=&amp;lt;name&amp;gt;]
    [--super-prefix=&amp;lt;path&amp;gt;] [--config-env=&amp;lt;name&amp;gt;=&amp;lt;envvar&amp;gt;]
    &amp;lt;command&amp;gt; [&amp;lt;args&amp;gt;]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Alternatives
&lt;/h2&gt;

&lt;p&gt;Let's analyze the part:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git [-v | --version]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The pipe (&lt;code&gt;|&lt;/code&gt;) character means that you can use one option or the other. This can mean that both option would either be mutually exclusive (or would not make sense)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8cda3n6sbmmmxcwv1nk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8cda3n6sbmmmxcwv1nk.png" alt="Image description" width="488" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Optional and Required Arguments
&lt;/h2&gt;

&lt;p&gt;The brackets inside the brackets (&lt;code&gt;[]&lt;/code&gt;) means the argument is optional, so you are not required to insert any of them unless you want to explicitly use them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git [-v | --version] [...] &amp;lt;command&amp;gt; [&amp;lt;args&amp;gt;]
      │                │                │
      │                │                │
      └────────────────┴────────────────┴─ All Optional
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Arguments inside lesser and greater than symbols &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt; are always required.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git [-v | --version] [...] &amp;lt;command&amp;gt; [&amp;lt;args&amp;gt;]
                               │
                               │
                            Required
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows us that the only mandatory argument when using the &lt;code&gt;git&lt;/code&gt; command is an argument named &lt;code&gt;&amp;lt;command&amp;gt;&lt;/code&gt; that should be positioned before all of these optional arguments, and after this, there are some optional arguments that can be set after it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Simplified documentation&lt;/span&gt;
git &amp;lt;&lt;span class="nb"&gt;command&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&amp;lt;args&amp;gt;]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conventions
&lt;/h2&gt;

&lt;p&gt;There are some argument conventions that most command-line utilities use and can make your life easier when understanding command-line usage.&lt;/p&gt;

&lt;h3&gt;
  
  
  Short Options
&lt;/h3&gt;

&lt;p&gt;Several command-line offer short options for common used arguments, for instance the &lt;code&gt;ls&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-a, --all
       do not ignore entries starting with.
-l     use a long listing format
-h, --human-readable
       with -l and -s, print sizes like 1K 234M 2G etc.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The short options are usually prefixed by a single hyphen (&lt;code&gt;-&lt;/code&gt;) (e.g.: &lt;code&gt;-a&lt;/code&gt;), long options are usually prefixed by double hyphen &lt;code&gt;--&lt;/code&gt; (e.g.: &lt;code&gt;--all&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Combining arguments
&lt;/h3&gt;

&lt;p&gt;Some command-line software support combining short options by simply putting everything together, for instance, these two commands produce the same output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -lah
ls -l -a -h
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Arguments with Parameters
&lt;/h3&gt;

&lt;p&gt;Some command-line software support arguments with parameters, one common convention is to be able to use both of them indicated by space or by &lt;code&gt;=&lt;/code&gt; sign.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# These are the same
git commit -a --author="Name &amp;lt;email@email.com&amp;gt;"
git commit -a --author "Name &amp;lt;email@email.com&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sometimes a parameter can appear immediately after the option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grep "Text to Find" * -R -n2
                          │
                          └─ Shows two lines before and after the found text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Navigating the man pages
&lt;/h2&gt;

&lt;p&gt;When navigating the manual or help pages or a particular command, it is common that they are presented in the &lt;code&gt;less&lt;/code&gt; command, in which you can navigate the manual using the arrow up and down keyboard keys.&lt;/p&gt;

&lt;p&gt;But you can also navigate it using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Page Up -&amp;gt; Navigate one page (screen size) up
Page Down -&amp;gt; Navigate one page (screen size) down
Home -&amp;gt; Go to the beginning
Down -&amp;gt; Go to the end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also perform search with: &lt;code&gt;/&amp;lt;pattern&amp;gt;&lt;/code&gt;, and it will search for the pattern you've typed.&lt;/p&gt;

&lt;p&gt;After searching you can navigate by using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;n -&amp;gt; Go to the next result
N -&amp;gt; Go to the previous result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you wish to learn more about &lt;code&gt;less&lt;/code&gt;, you can check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;man less
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also, now you can finally RTFM&lt;/p&gt;

</description>
      <category>linux</category>
      <category>commandline</category>
      <category>tutorial</category>
      <category>terminal</category>
    </item>
  </channel>
</rss>
