<?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: killDevils</title>
    <description>The latest articles on DEV Community by killDevils (@killdevils).</description>
    <link>https://dev.to/killdevils</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%2F382574%2F6642fc1d-1bf2-4066-a845-d44d7f3e0143.jpeg</url>
      <title>DEV Community: killDevils</title>
      <link>https://dev.to/killdevils</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/killdevils"/>
    <language>en</language>
    <item>
      <title>Bash | How to source a file from GitHub?</title>
      <dc:creator>killDevils</dc:creator>
      <pubDate>Sat, 20 Jun 2020 23:39:04 +0000</pubDate>
      <link>https://dev.to/killdevils/bash-how-to-source-a-file-from-github-34af</link>
      <guid>https://dev.to/killdevils/bash-how-to-source-a-file-from-github-34af</guid>
      <description>&lt;p&gt;When you are invoking BootStrap in HTML file, don't bother to download related files, just paste the link:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"&lt;/span&gt; &lt;span class="na"&gt;integrity=&lt;/span&gt;&lt;span class="s"&gt;"sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"&lt;/span&gt; &lt;span class="na"&gt;crossorigin=&lt;/span&gt;&lt;span class="s"&gt;"anonymous"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Often, for future convenience, I gather all Bash functions created by myself in a single file named &lt;strong&gt;&lt;em&gt;funkfunc.sh&lt;/em&gt;&lt;/strong&gt;, so I can source it whenever I need. But, in different projects, I still have to copy the file respectively. In most cases, the hosts are allowed to access Internet, why don't make an online version of &lt;strong&gt;&lt;em&gt;funkfunc.sh&lt;/em&gt;&lt;/strong&gt;?&lt;/p&gt;

&lt;h2&gt;
  
  
  Source a file from a public repo in GitHub
&lt;/h2&gt;

&lt;p&gt;For example, I have a public repo: &lt;a href="https://github.com/killDevils/PublicSource"&gt;killDevils/PublicSource&lt;/a&gt;, there is a file named "bashKit.sh". When I view the "Raw" file of it, the Browser shows me the link: &lt;code&gt;https://raw.githubusercontent.com/killDevils/PublicSource/master/bashKit.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, add a line at the top of .sh file (below shebang tag &lt;code&gt;#!/bin/bash&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; https://raw.githubusercontent.com/killDevils/PublicSource/master/bashKit.sh&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Source a file from a &lt;strong&gt;&lt;em&gt;PRIVATE&lt;/em&gt;&lt;/strong&gt; repo in GitHub
&lt;/h2&gt;

&lt;p&gt;First, please read my old post:&lt;a href="https://dev.to/killdevils/github-download-a-file-from-a-private-repository-in-github-869"&gt;GitHub | Download a file from a Private Repository in GitHub&lt;/a&gt;, get to know how to generate the link we need.&lt;/p&gt;

&lt;p&gt;For example, The link I got is &lt;code&gt;https://1234abc45678cde6543edca@raw.githubusercontent.com/killDevils/PrivateRepo/master/funkfunc.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, add a line at the top of .sh file (below shebang tag &lt;code&gt;#!/bin/bash&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;source&lt;/span&gt; &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; https://1234abc45678cde6543edca@raw.githubusercontent.com/killDevils/PrivateRepo/master/funkfunc.sh&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  🍻
&lt;/h1&gt;

&lt;p&gt;Hope this would help! Cheers! &lt;/p&gt;

</description>
      <category>bash</category>
      <category>source</category>
      <category>github</category>
    </item>
    <item>
      <title>Bash | my personal cheat list</title>
      <dc:creator>killDevils</dc:creator>
      <pubDate>Wed, 20 May 2020 06:41:12 +0000</pubDate>
      <link>https://dev.to/killdevils/bash-my-personal-cheat-list-d5g</link>
      <guid>https://dev.to/killdevils/bash-my-personal-cheat-list-d5g</guid>
      <description>&lt;p&gt;As a Concept Director, I don't have the chance to just dive into a single language. Switching between different languages causes forgetting basic tricks. Time is consumed by searching over codes in old repositories.&lt;/p&gt;

&lt;p&gt;The basic tricks are not worthy to write into individual posts, so list here would be a better way to record and look up. &lt;/p&gt;

&lt;p&gt;Sure, the list is growing as long as I am coding in Bash.&lt;/p&gt;

&lt;h2&gt;
  
  
  Switch to root
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sudo su&lt;/code&gt; change to root, but not environment variables.&lt;br&gt;
&lt;code&gt;sudo su -&lt;/code&gt; change to root as well as the environment variables.&lt;br&gt;
&lt;code&gt;sudo -i&lt;/code&gt; used not often&lt;/p&gt;
&lt;h2&gt;
  
  
  Curl
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;curl -s&lt;/code&gt; mute curl&lt;br&gt;
&lt;code&gt;curl -O&lt;/code&gt; Write output to a local file in current working directory, named like the remote file we get.&lt;/p&gt;
&lt;h2&gt;
  
  
  Create new file
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;touch /tmp/payTime&lt;/code&gt; an empty file called payTime created under /tmp.&lt;/p&gt;
&lt;h2&gt;
  
  
  Make new directory
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;mkdir /tmp/business&lt;/code&gt; made a folder called "business" under /tmp, if /tmp exists.&lt;br&gt;
&lt;code&gt;mkdir /tmp/company/business&lt;/code&gt; made a folder called "business" under /tmp/company, even /tmp and /company do not exist.&lt;/p&gt;
&lt;h2&gt;
  
  
  Quick go back to the working directory of current user
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cd ~&lt;/code&gt; or &lt;code&gt;cd&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Make a .sh file executable
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;chmod +x&lt;/code&gt; or &lt;code&gt;chmod a+x&lt;/code&gt; makes it executable for everyone.&lt;br&gt;
&lt;code&gt;chmod u+x&lt;/code&gt; makes it executable for current user.&lt;br&gt;
&lt;code&gt;chmod g+x&lt;/code&gt; makes it executable for current group.&lt;br&gt;
&lt;code&gt;chmod o+x&lt;/code&gt; makes it executable for others.&lt;/p&gt;
&lt;h2&gt;
  
  
  Cron
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;crontab -l&lt;/code&gt; list current user's existing cron jobs.&lt;br&gt;
&lt;code&gt;crontab -e&lt;/code&gt; edit.&lt;br&gt;
&lt;code&gt;crontab -r&lt;/code&gt; remove all cron jobs.&lt;/p&gt;
&lt;h2&gt;
  
  
  Variable
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;${var}&lt;/code&gt; = &lt;code&gt;$var&lt;/code&gt;. The former is really useful when the latter meets conflict with the content behind. e.g.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;folder&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/usr/share/"&lt;/span&gt;
&lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"password.txt"&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="nv"&gt;$folderfile&lt;/span&gt;  &lt;span class="c"&gt;#this would meet a big problem.&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;folder&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;file  &lt;span class="c"&gt;#this is good to use.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;code&gt;export var=0&lt;/code&gt; set a new environment variable in the current session of the current shell. Would dismiss in the next login.&lt;/p&gt;

&lt;h2&gt;
  
  
  awk
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;awk -F@&lt;/code&gt; regards @ as the divider.&lt;br&gt;
&lt;code&gt;awk '!\name\ &amp;amp;&amp;amp; \running\ {print $1}'&lt;/code&gt; ignore the lines contains "name", remain the lines contains running, then grab the first column.&lt;/p&gt;
&lt;h2&gt;
  
  
  Date and Time
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;date&lt;/code&gt; show current date and time in standard format.&lt;br&gt;
&lt;code&gt;date +"%Y-%m-%d %H:%M:%S"&lt;/code&gt; show in "2020-05-20 15:49:28" format.&lt;br&gt;
&lt;code&gt;date -d "+1 hour 30 minutes" +"%Y-%m-%d %H:%M:%S"&lt;/code&gt; show in "2020-05-20 15:49:28" format, plus 90 minutes based on current Time.&lt;br&gt;
&lt;code&gt;date +%s&lt;/code&gt; count the seconds from 1970-1-1 0:0:0 (Epoch Time).&lt;br&gt;
&lt;code&gt;date -d @1344127275 +"%Y-%m-%d %H:%M"&lt;/code&gt; count 1344127275 seconds from the Epoch Time, show in "2012-08-05 08:41:15" format (the timestamp Curiosity rover lands on Mars 🎉).&lt;/p&gt;
&lt;h2&gt;
  
  
  Four Operations
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;echo $((1+2*3-4/5))&lt;/code&gt; integer only. The result is also integer.&lt;br&gt;
&lt;code&gt;echo 1.2+2.3*3.4-4.5/5.6 | bc -l&lt;/code&gt; decimal is allowed. the result is 20 decimal digits.&lt;br&gt;
&lt;code&gt;printf %.3f $(echo 1.2+2.3*3.4-4.5/5.6 | bc -l)&lt;/code&gt; to round 20 decimal digits down to 3.&lt;/p&gt;
&lt;h2&gt;
  
  
  Mutt
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;mutt -e "set realname='Kill Devils'"&lt;/code&gt; show a custom name in mail instead of the string before @ of your email address.&lt;/p&gt;
&lt;h2&gt;
  
  
  Compare numbers
&lt;/h2&gt;

&lt;p&gt;Compare decimals:&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;if&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"50.01 &amp;gt;= 50.00"&lt;/span&gt; | bc &lt;span class="nt"&gt;-l&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"50.01 is greater equal than 50.00"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Compare integers:&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;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; 51 &lt;span class="nt"&gt;-ge&lt;/span&gt; 50 &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"51 is greater equal than 50"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Background job
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;bash update.sh &amp;amp;&lt;/code&gt; job would run in background, but would terminate when the current session is exit.&lt;br&gt;
&lt;code&gt;nohup bash update.sh &amp;amp;&lt;/code&gt; nohup = no hang up. job would not be affected by current session logging out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Redirection (stdin, stdout, stderr, screen. std = standard)
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;bash update.sh &amp;gt; output.out&lt;/code&gt; stdout redirects from screen to "output.out" file.&lt;br&gt;
&lt;code&gt;bash update.sh 2&amp;gt; output.err&lt;/code&gt; stderr redirects from screen to "output.err" file.&lt;br&gt;
&lt;code&gt;bash update.sh &amp;amp;&amp;gt; output.log&lt;/code&gt; both stdout and stderr redirect from screen to "output.log" file.&lt;br&gt;
&lt;code&gt;bash update.sh | tee output.log&lt;/code&gt; show everything on screen, redirect everything into "output.err" file as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Move files
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;mv -f&lt;/code&gt; force move, ignore conflicts.&lt;/p&gt;

</description>
      <category>bash</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Bash | How to show the external IP of your server</title>
      <dc:creator>killDevils</dc:creator>
      <pubDate>Tue, 19 May 2020 00:52:38 +0000</pubDate>
      <link>https://dev.to/killdevils/bash-how-to-show-the-external-ip-of-your-server-3d2n</link>
      <guid>https://dev.to/killdevils/bash-how-to-show-the-external-ip-of-your-server-3d2n</guid>
      <description>&lt;p&gt;When I was deploying a new instance on Google Cloud Platform, I often forgot the IP of it. Usually, I have to go back to Google Cloud Console and find it out in the list. &lt;/p&gt;

&lt;p&gt;For a easier management in the future, I wanna let the instance know its IP and write it down in a txt file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;curl icanhazip.com &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /usr/business/extIP
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now, each time the instance generate a daily report, it could &lt;code&gt;cat /usr/business/extIP&lt;/code&gt; and get the IP.&lt;/p&gt;

&lt;p&gt;Hope this helps! Cheers! 🍻&lt;/p&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>ip</category>
    </item>
    <item>
      <title>GitHub | Download a file from a Private Repository in GitHub</title>
      <dc:creator>killDevils</dc:creator>
      <pubDate>Sat, 16 May 2020 02:52:51 +0000</pubDate>
      <link>https://dev.to/killdevils/github-download-a-file-from-a-private-repository-in-github-869</link>
      <guid>https://dev.to/killdevils/github-download-a-file-from-a-private-repository-in-github-869</guid>
      <description>&lt;p&gt;I wrote a series of Bash scripts. They make my work on Google Cloud Platform (GCP) easier.&lt;/p&gt;

&lt;p&gt;Since the PORT 25 for mail service is strictly blocked by GCP, and at the same time, building mail service on my own is quite complex. So, under &lt;a href="https://cloud.google.com/compute/docs/tutorials/sending-mail"&gt;Google's Suggestion&lt;/a&gt;, I decided &lt;a href="https://cloud.google.com/compute/docs/tutorials/sending-mail/using-sendgrid"&gt;to use SendGrid&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;SendGrid utilizes a bot called GitGuardian to scan public repositories on GitHub, and would temporarily suspend your account if you accidentally pasted SendGrid's API key in it.&lt;/p&gt;

&lt;p&gt;So, better save the API key in private repositories.&lt;/p&gt;

&lt;h2&gt;
  
  
  To download a file from private repository
&lt;/h2&gt;

&lt;h4&gt;
  
  
  1. You need to generate a Personal Access Tokens.
&lt;/h4&gt;

&lt;p&gt;According to &lt;a href="https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line"&gt;this GitHub help page&lt;/a&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the upper-right corner of any page, click &lt;strong&gt;your profile photo&lt;/strong&gt;, then click &lt;strong&gt;Settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the left sidebar, click &lt;strong&gt;Developer settings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the left sidebar, click &lt;strong&gt;Personal access tokens&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;scopes&lt;/strong&gt;. To use your token to access repositories from the command line, select &lt;strong&gt;repo&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Generate new token&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Give your token a &lt;strong&gt;descriptive name&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's suppose your actual token is 1234567abcdefg&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Embed Token into the link.
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Open the file in GitHub web page and click "Raw"&lt;/li&gt;
&lt;/ol&gt;

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

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Copy the link of this raw file, maybe something like this:&lt;br&gt;
https:// raw.githubusercontent.com/&lt;strong&gt;GITHUB_ACCOUNT&lt;/strong&gt;/&lt;strong&gt;REPOSITORY_NAME&lt;/strong&gt;/&lt;strong&gt;BRANCH_NAME&lt;/strong&gt;/&lt;strong&gt;FILE_NAME&lt;/strong&gt;.&lt;strong&gt;EXTENTION_NAME&lt;/strong&gt;?token=&lt;strong&gt;SOME_NUMBERS_LETTERS&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reform the link as&lt;br&gt;
https:// &lt;strong&gt;1234567abcdefg@&lt;/strong&gt;raw.githubusercontent.com/&lt;strong&gt;GITHUB_ACCOUNT&lt;/strong&gt;/&lt;strong&gt;REPOSITORY_NAME&lt;/strong&gt;/&lt;strong&gt;BRANCH_NAME&lt;/strong&gt;/&lt;strong&gt;FILE_NAME&lt;/strong&gt;.&lt;strong&gt;EXTENTION_NAME&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As you see, "?token=&lt;strong&gt;SOME_NUMBERS_LETTERS&lt;/strong&gt;" are removed. Insert the token you generated from GitHub + @ right after "https://"&lt;/p&gt;

&lt;h2&gt;
  
  
  To use the link
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-O&lt;/span&gt; https://1234567abcdefg@raw.githubusercontent.com/GITHUB_ACCOUNT/REPOSITORY_NAME/BRANCH_NAME/FILE_NAME.EXTENTION_NAME
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Hope this would help! Cheers! 🍻&lt;/p&gt;

</description>
      <category>github</category>
    </item>
    <item>
      <title>Bash | Find out the usage of a certain PORT</title>
      <dc:creator>killDevils</dc:creator>
      <pubDate>Sat, 09 May 2020 11:31:00 +0000</pubDate>
      <link>https://dev.to/killdevils/bash-how-to-find-out-the-certain-port-usage-bgb</link>
      <guid>https://dev.to/killdevils/bash-how-to-find-out-the-certain-port-usage-bgb</guid>
      <description>&lt;p&gt;When I was trying to run acme.sh to generate SSL certification, I got an error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;Sat May  9 18:54:10 HKT 2020] tcp port 80 is already used by 
&lt;span class="o"&gt;[&lt;/span&gt;Sat May  9 18:54:10 HKT 2020] Please stop it first
&lt;span class="o"&gt;[&lt;/span&gt;Sat May  9 18:54:10 HKT 2020] _on_before_issue.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I believe it is expected to show the service which is using port 80 in the first line, but nothing at all. I have to find out my self.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;netstat &lt;span class="nt"&gt;-tulpn&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; :80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I got the output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;tcp6       0      0 :::80                   :::&lt;span class="k"&gt;*&lt;/span&gt;                    LISTEN      10541/apache2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Oh, yes, Apache2. I wanna shut it down temporally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop apache2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now, generate cert again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;~/.acme.sh/acme.sh &lt;span class="nt"&gt;--issue&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; mydomain.me &lt;span class="nt"&gt;--standalone&lt;/span&gt; &lt;span class="nt"&gt;--keylength&lt;/span&gt; ec-256
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>bash</category>
    </item>
  </channel>
</rss>
