<?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: pgrz</title>
    <description>The latest articles on DEV Community by pgrz (@pgrz).</description>
    <link>https://dev.to/pgrz</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%2F851141%2F63e809b6-2561-4299-8727-796463cbff1b.jpeg</url>
      <title>DEV Community: pgrz</title>
      <link>https://dev.to/pgrz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pgrz"/>
    <language>en</language>
    <item>
      <title>Checking port visibility without net tools</title>
      <dc:creator>pgrz</dc:creator>
      <pubDate>Thu, 21 Apr 2022 08:30:19 +0000</pubDate>
      <link>https://dev.to/pgrz/checking-port-visibility-without-net-tools-56l6</link>
      <guid>https://dev.to/pgrz/checking-port-visibility-without-net-tools-56l6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Note: these are my self-help notes. Please let me know if they're wrong :)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The only thing you have is pure bash - no net tools. How to check the port visibility on a remote machine?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1. Opening stream for the TCP connection&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;exec [stream number]&amp;lt;&amp;gt;/dev/tcp/[host]/[port]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;e.g.:&lt;br&gt;
&lt;code&gt;exec 5&amp;lt;&amp;gt;/dev/tcp/10.21.24.41/22&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;2. Sending something to that port&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;echo "hello" &amp;gt;&amp;amp;5&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;3. Reading the answer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat &amp;lt;&amp;amp;5&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In case the port 22 is open, we'll get something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;SSH-2.0-OpenSSH_7.4
Protocol mismatch.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;4. Closing the stream descriptor&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;exec 5&amp;lt;&amp;amp;-&lt;/code&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>bash</category>
    </item>
    <item>
      <title>Launching system from GRUB2 console</title>
      <dc:creator>pgrz</dc:creator>
      <pubDate>Thu, 21 Apr 2022 08:21:07 +0000</pubDate>
      <link>https://dev.to/pgrz/launching-system-from-grub2-console-2pgm</link>
      <guid>https://dev.to/pgrz/launching-system-from-grub2-console-2pgm</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Note: these are my self-help notes. Please let me know if they're wrong :)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A Linux system that isn't visible in Grub2 can be launched using Grub2 console.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;0. Entering the console&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To enter the grub2 console you need to press &lt;code&gt;c&lt;/code&gt; key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Choosing the device&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;ls&lt;/code&gt; command prints out all the disk devices formatted as &lt;code&gt;(hd0), (hd0,msdos1), (hd0,msdos2)&lt;/code&gt; which translates to &lt;code&gt;/dev/sda, /dev/sda1, /dev/sda2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You choose the disk using &lt;code&gt;set root=(hd0,1)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Choosing the kernel and system image&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now you can view the disk content using &lt;code&gt;ls&lt;/code&gt;. You should be looking for &lt;code&gt;vmlinuz*&lt;/code&gt; and &lt;code&gt;initrd*&lt;/code&gt; files in &lt;code&gt;/boot&lt;/code&gt; subdirectory.&lt;/p&gt;

&lt;p&gt;After finding them you need to set them:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;initrd /boot/initrd.img-3.13.0-29-generic&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;root&lt;/code&gt; argument isn't required but omitting it may result in errors when grub2 runs from another device like a pendrive or live cd.&lt;/p&gt;

&lt;p&gt;It's crucial to point to the same version in both commands. In case the system became unbootable after kernel upgrade you obviously need to specify the older version.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Booting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The final touch is the &lt;code&gt;boot&lt;/code&gt; command.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>grub</category>
    </item>
  </channel>
</rss>
