<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Windows - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Windows - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Thu, 18 Jun 2026 23:23:46 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/windows/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Find Any File on Windows Like a Linux User (using Windows Powershell) ]]>
                </title>
                <description>
                    <![CDATA[ Sometimes you might struggle to find a file or program when you have no idea where it could be saved or installed. And the Windows user interface may not always give you the results you want. If that' ]]>
                </description>
                <link>https://www.freecodecamp.org/news/find-any-file-on-windows-like-a-linux-user/</link>
                <guid isPermaLink="false">69c44ce410e664c5daef3e59</guid>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Powershell ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Scripting ]]>
                    </category>
                
                    <category>
                        <![CDATA[ automation ]]>
                    </category>
                
                    <category>
                        <![CDATA[ performance ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Piotr &quot;NotBlackMagic&quot; Opoka ]]>
                </dc:creator>
                <pubDate>Wed, 25 Mar 2026 16:00:00 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/uploads/covers/5e1e335a7a1d3fcc59028c64/527c9267-0583-49c4-9e90-89abcf186b9d.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Sometimes you might struggle to find a file or program when you have no idea where it could be saved or installed. And the Windows user interface may not always give you the results you want. If that's the case for you, you're in the right place.</p>
<p><code>Get-ChildItem</code> (also known as <code>gci</code>, <code>ls</code>, <code>dir</code> ) is a very powerful command. And one of its most iconic uses is to find/search for a file. It's more precise and more reliable than Windows Explorer. It even has better filtering options that show the results that are more relevant to you.</p>
<p>In this tutorial, you'll learn how to use <code>gci</code> and how to combine it with other commands so that it becomes an even more powerful tool. Remember to enable copy-pasting in Windows PowerShell, so it's easier for you to follow along. You can see how to enable it <a href="https://notblackmagic.hashnode.dev/enable-copy-pasting-in-windows-powershell-cli-in-3-steps">here</a>.</p>
<h3 id="heading-what-well-cover">What we'll cover:</h3>
<ol>
<li><p><a href="#heading-1-basic-explanation-of-the-get-childitem-command">Basic explanation of the Get-ChildItem command</a></p>
<ul>
<li><a href="#heading-most-used-examples-of-searching-by-gci-command">Most used examples of searching by gci command</a></li>
</ul>
</li>
<li><p><a href="#heading-2-setup-for-other-more-complex-examples">Setup for other more complex examples</a></p>
</li>
<li><p><a href="#heading-3-when-is-the-path-option-not-needed">When is the -Path option not needed?</a></p>
</li>
<li><p><a href="#heading-4-advanced-searching-combining-getchildren-with-the-whereobject-command">Advanced Searching – Combining Get-ChildItem with the Where-Object Command</a></p>
<ul>
<li><p><a href="#heading-41-how-to-search-through-only-a-particular-directory">4.1. How to search through only a particular directory</a></p>
</li>
<li><p><a href="#heading-42-how-to-search-while-excluding-a-particular-directory">4.2. How to search while excluding a particular directory</a></p>
</li>
<li><p><a href="#heading-43-searching-only-1-directory-from-many-with-exactly-the-same-name">4.3 Searching only 1 directory from many with exactly the same name</a></p>
</li>
<li><p><a href="#heading-44-filter-how-deep-how-many-folders-in-you-want-to-search-for-the-file">4.4 Filter how deep (how many folders in) you want to search for the file</a></p>
</li>
</ul>
</li>
<li><p><a href="#heading-5-how-to-search-through-hidden-files">How to Search Through Hidden Files</a></p>
</li>
<li><p><a href="#heading-6-how-can-you-know-all-the-properties-that-you-can-use-as-a-filter">How can you know all the properties that you can use as a filter?</a></p>
<ul>
<li><a href="#heading-how-to-retrieve-only-1-desired-property">How to retrieve only 1 desired property</a></li>
</ul>
</li>
<li><p><a href="#heading-7-i-dont-know-the-files-name-but-i-know-whats-inside-it-how-do-i-find-the-file-by-its-content">I don't know the file’s name, but I know what's inside it. How do I find the file by its content?</a></p>
</li>
<li><p><a href="#heading-8-i-cant-see-the-full-path-how-do-i-fix-this">I can't see the full path - how do I fix this?</a></p>
</li>
<li><p><a href="#heading-9-hard-to-read-open-the-results-in-the-text-editor-of-your-choice">Hard to read? Open the results in the text editor of your choice</a></p>
</li>
<li><p><a href="#heading-10-summary-the-ultimate-commands-for-searching-and-finding-whatever-you-need">Summary - the ultimate commands for searching and finding whatever you need</a></p>
</li>
</ol>
<h2 id="heading-1-basic-explanation-of-the-get-childitem-command">1. Basic Explanation of the <code>Get-ChildItem</code> Command</h2>
<p>Let's take a look at the example searching script to understand how it works:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Path "C:\path to\your directory\" -Filter "*whatImLookingFor*"
</code></pre>
<p><code>Get-ChildItem</code> (aliases: <code>dir</code>, <code>ls</code>, <code>gci</code>) lists the content of a folder or directory just like the Linux <code>ls</code> command does.</p>
<p>This command works by searching every single file and directory <strong>in the path specified.</strong> It shows you everything it found that <strong>matches the filter</strong>. It doesn't mean that this command doesn't look everywhere else – because it does.</p>
<p>So you specify the path that is the parent (folder), which means that every folder and file under it is its child. If you know some CSS and JavaScript, treat it the same way that these languages do.</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/0bd18776-72bc-46be-bbaa-b616c5ce1c3a.png" alt="Picture: a visual explanation of -depth and -recurse parameters. It shows &quot;Documents&quot; folder at the bottom, which is tagged both as Parent and Depth 0. It points upwords to its child folders and a child file. Those are tagged as Depth 0 children of our Documents folder. They are simultaneously tagged as Depth 1 parents, so files and folders. to which they are pointing upwards, are their Depth 1 children." style="display:block;margin:0 auto" width="821" height="656" loading="lazy">

<p>If you don't use <code>-Recurse</code> or <code>-Depth</code>, then the command works only in your current directory (parent Depth level 0) and searches for its children inside that directory (children Depth level 0).</p>
<p>If you use <code>-Recurse</code>, then the <code>gci</code> will search for what you want on ALL LEVELS. But by using<code>-Depth</code>, you can specify how deep you want it to look for a file/folder.</p>
<p>To recurse means "to repeat an operation". So, <code>-Recurse</code> means that <code>gci</code> will repeat the search for your file or folder in every child element of the <em>"Documents"</em> directory, and every directory inside it, all levels deep.</p>
<p>All of these files and folders are children of your <em>"Documents"</em> folder. If you delete the folder, you delete everything inside it too.</p>
<p><code>-Filter</code> filters the output of the command to only show what matches the filter (examples of how to use filter are further in the article).</p>
<p><code>-Path</code> tells where the command should be looking for files (by using "C:\", for example, you're telling it to look at the very basis of your computer). If you want to search in certain directory it would look like this:</p>
<pre><code class="language-powershell">Get-ChildItem -Path "C:\path to\your directory\"
</code></pre>
<p>OR</p>
<pre><code class="language-powershell">Get-ChildItem -Path "~\Documents\path to\your directory\"
</code></pre>
<p><code>~\</code> here is a shorthand for "inside current user's folder" or <strong>"C:\Users\YourUsername"</strong>.</p>
<p>Next, we can specify whether we'd like to look for a <strong>file</strong> or a <strong>folder</strong>, so we have fewer results to look at:</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "*whatImLookingFor*" -File
</code></pre>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "*whatImLookingFor*" -Directory
</code></pre>
<p>You might be wondering how you can stop the search if it takes too long. When you're using <code>-Recurse,</code> the output that you'll get might become quite overwhelming, especially if you didn't specify your command enough (more about that in <a href="#heading-3-when-is-the-path-option-not-needed">step 3</a> and <a href="#heading-4-advanced-searching-combining-getchildren-with-the-whereobject-command">step 4</a>). Luckily, you can stop any command in PowerShell after starting it with <strong>Ctrl + C</strong> OR <strong>Ctrl + Z</strong> OR <strong>Ctrl + X</strong>. All of them should work.</p>
<h2 id="heading-most-used-examples-of-searching-by-gci-command">Most Used Examples of Searching by <code>gci</code> Command</h2>
<p>Here are some handy examples of searching scripts that you can use:</p>
<p><strong>Example #1</strong>: search for all executive files on your PC (remember that you can stop this command with one of shortcuts, like <strong>Ctrl + C</strong>):</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "*.exe" -File
</code></pre>
<p>REMEMBER:<br>In order to paste commands into the PowerShell, you have to first enable it. <a href="https://notblackmagic.hashnode.dev/enable-copy-pasting-in-windows-powershell-cli-in-3-steps">Here's how</a>.</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768406611072/f23a475e-071d-42d6-b300-f442d7f926c9.png" alt="Picture: gci command pasted into PowerShell." style="display:block;margin:0 auto" width="1108" height="645" loading="lazy">

<p>This command will show you a very long list of executable files and their folders (as shown in the image below).</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768406617447/c787e9a7-b2b8-4149-84fa-1320f94c7e48.png" alt="Picture: used gci command shows all the executable files it can find." style="display:block;margin:0 auto" width="933" height="542" loading="lazy">

<p>These lists might be so long that it's impossible to find anything in them. That's why you'll learn how to use more advanced techniques of filtering in <a href="#heading-4-advanced-searching-combining-getchildren-with-the-whereobject-command">step 4</a> to see fewer unnecessary results that don't fit your criteria.</p>
<p><strong>Example #2</strong>: search for an executable file that has <em>"notepad"</em> in its name (or search for any program you need, basically):</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "notepad*.exe" -File
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768406643047/06e37fba-04d8-4806-839f-19982cd011ea.png" alt="Picture: gci command showing all executable &quot;notepad&quot; files." style="display:block;margin:0 auto" width="1100" height="568" loading="lazy">

<p>One of the results will show you the location of the file you want:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768406956329/e7582c25-7c96-4b01-aa36-8660d68a4d37.png" alt="Picture: gci command showing the path to the found executable file." style="display:block;margin:0 auto" width="560" height="106" loading="lazy">

<p>In our case it's the <code>C:\Windows\System32</code> folder.</p>
<p>You can mix it however you want! Thanks to that command, you don't have to remember much about your file and it will still work.</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "n*pad*.*xe"
</code></pre>
<p>So what if you see some errors while scanning the whole system. Should you worry?</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768406995588/3b23deb1-1530-4fa7-8f52-427386bc37e9.png" alt="Picture: gci command showing error messages while searching for files." style="display:block;margin:0 auto" width="823" height="287" loading="lazy">

<p>It's ok! Sometimes you might get lots of errors. They will most likely occur when a script scours the system folders/files. If you want to get rid of them, add <code>-ErrorAction SilentlyContinue</code>, like you see here:</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "notepad*.exe" -File -ErrorAction SilentlyContinue
</code></pre>
<p>You can try it now ;)</p>
<h2 id="heading-2-setup-for-other-more-complex-examples">2. Setup for Other More Complex Examples</h2>
<p>Now, let's look at even more use cases for this command. But first, we'll create a space where I can show you examples.</p>
<p>First, create new folder inside your <em>"Documents"</em> folder. Let's call it <em>"Items"</em>.</p>
<p>Inside it, create two text documents. Name one of them <em>"Item 1- Green Bracelet"</em> and the other <em>"Item 2- Blue Bracelet"</em> (Yes, make sure you write the first letter of each word in <strong>UPPER CASE</strong>).</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768407060476/eeb559d5-2627-4674-a780-e23f4e67f5a9.png" alt="Picture: example setup of files inside &quot;Items&quot; folder inside &quot;Documents folder&quot;." style="display:block;margin:0 auto" width="1135" height="288" loading="lazy">

<p>Copy these files now.</p>
<p>Go one folder back (you can use the <strong>Ctrl + UpArrow</strong> shortcut ) and create another folder next to <em>"Items"</em> called <em>"More items"</em>:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768407053259/06d23003-aaa5-457b-8356-af10327d3436.png" alt="Picture: example setup. New &quot;More items&quot; folder created next to the &quot;Items&quot; folder." style="display:block;margin:0 auto" width="1059" height="288" loading="lazy">

<p>Paste the copied files inside the "More items" folder and change their names, so they have only <strong>lower case</strong> letters (<em>"item 1- green bracelet"</em> and <em>"item 2- blue bracelet"</em> ).</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768407154078/314b476a-8062-4d77-82f0-0ce76cf4c39b.png" alt="Picture: example setup. All files inside &quot;More items&quot; folder have names with only lowercase letters." style="display:block;margin:0 auto" width="1071" height="287" loading="lazy">

<p>PRO TIP:<br>You can click once on a file with your mouse and then type the <strong>F2</strong> key on your keyboard in order to change their names.</p>
<h3 id="heading-3-when-is-the-path-option-not-needed">3. When is the <code>-Path</code> option not needed?</h3>
<p>You don't have to specify the path every time. You can always just move to the desired directory with the <code>cd</code> (change directory) command.</p>
<p>This command will move you to your <code>Documents</code> folder:</p>
<pre><code class="language-powershell">cd ~\Documents\
</code></pre>
<p>Now, you should be able to see PowerShell pointing to your <code>Documents</code> folder on the left of the screen:</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/1cd597e0-ae5e-4ea4-b066-b573a3cc2b4b.png" alt="Picture: PowerShell pointing to the Documents folder." style="display:block;margin:0 auto" width="485" height="139" loading="lazy">

<p>If you don't see this, then you can use double quotes <code>" "</code>, like in this command:</p>
<pre><code class="language-powershell">cd "~\Documents\"
</code></pre>
<p>Make sure that PowerShell is pointing to our desired folder. Now, the searching command looks like this without the <code>-Path</code> option:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" -File
</code></pre>
<p>Pretty simple, right?</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768407625727/e83b7cb3-9bdc-420b-b0ae-28fa9a5ceb42.png" alt="Picture: you can first use &quot;cd&quot; command to move to the directory you want. Then you don't have to use  &quot;Path&quot; option in your &quot;gci&quot; command." style="display:block;margin:0 auto" width="593" height="311" loading="lazy">

<p>As you can see in the image above, we first moved to our desired directory, so later we could perform the search inside it without specifying the <code>-Path</code> option/parameter.</p>
<p>But the <code>-Path</code> option is very useful, either when you're creating a script or you want to search for something without moving away from the current directory:</p>
<pre><code class="language-powershell">Get-ChildItem -Path ~\Documents\ -Recurse -Filter "*item*" -File
</code></pre>
<pre><code class="language-powershell">Get-ChildItem -Path ~\Documents\ -Recurse -Filter "*item*" -Directory
</code></pre>
<p>Here's an example. I'm inside the <code>System32</code> folder and I want to know whether the thing I'm looking for is inside the <code>Documents</code> folder without moving in there:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768407360312/60915425-8432-40c3-a395-a59e1b363667.png" alt="Picture: &quot;gci&quot; command can looks for a file in a specific directory without moving us to this directory. All thanks to &quot;Path&quot; option." style="display:block;margin:0 auto" width="640" height="205" loading="lazy">

<p>And it really is there!</p>
<p>From now on, because you already know what the <code>-Path</code> option is being used for, I won't be using it unless it's necessary.</p>
<h2 id="heading-4-advanced-searching-combining-get-childitem-with-the-where-object-command">4. Advanced Searching – Combining <code>Get-ChildItem</code> with the <code>Where-Object</code> Command</h2>
<p>Sometimes you might have several folders named exactly the same, but they're in different places. You might want to exclude them based on their content, which folder they are in, or based on their<code>-Depth</code> level (see the graphic with the explanation about <code>-Depth</code> level in <a href="#heading-1-basic-explanation-of-the-get-childitem-command">step 1</a>). That's what we're going to cover in the next few points.</p>
<p>For this part of the tutorial, make sure you've gone through <a href="#heading-2-setup-for-other-more-complex-examples">step 2</a> (but you can skip step 3 if you want).</p>
<h3 id="heading-41-searching-through-only-a-particular-directory">4.1. Searching through only a particular directory</h3>
<p>Let's say that we're now looking for the bracelets that we created in <strong>step 2</strong>. But, we want to see the results from only one folder. For that, we'll use case-sensitive search (<code>-clike</code>) to get only our preferred results. But <code>-clike</code> doesn't work with <code>gci</code> alone. We need to apply another filter with the <code>Where-Object { }</code> command:</p>
<pre><code class="language-powershell">Get-ChildItem -Path ~\Documents\ -Recurse -Filter "*item*" |   
Where-Object { $_.Name -clike "*Item*" }
</code></pre>
<p>OR (clearer version, without the <code>-Path</code> option):</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" |   
Where-Object { $_.Name -clike "*Item*" }
</code></pre>
<p>Let's review what's going on here:</p>
<ul>
<li><p><code>Get-ChildItem -Recurse -Filter "*item*"</code> searches for all files and folders with "item" in their name</p>
</li>
<li><p><code>|</code> – the "pipe" symbol is used to get the output of the previous command (the list of all files and folders filtered by <code>gci</code>) and send it to the next command (<code>Where-Object</code> is applying another filter to what is already filtered by <code>gci</code>).</p>
</li>
<li><p><code>Where-Object { }</code> is the command used for filtering the lists of objects. The filter is being specified inside the <code>{ }</code> curly brackets.</p>
</li>
<li><p><code>\(_</code> refers to all the separate objects. Treat it as <em>"ForEachObjectFromList".</em> And treat the whole sequence after the <code>|</code> as <em>"FindObjectsFromList that have a name with 'Item' "</em>.<br><code>\)_</code> is very often used with <code>Where-Object</code>, but also with some other commands.</p>
</li>
<li><p><code>.Name</code> – we choose a Name property to get from every object.</p>
</li>
<li><p><code>-clike</code> finds a match that is 100% correct. All letters must be the exact same case as the phrase we specified. <code>c</code> stands for "case sensitive" and it checks every letter to see if it's <strong>upper case</strong> or <strong>lower case</strong>.</p>
</li>
</ul>
<p>So, <code>Where-Object { $_.Name -clike "*Item*" }</code> is a filter that takes the <code>Name</code> parameter of every object from the list (created by <code>gci</code>) and checks with <code>-clike</code> if any <code>Name</code> has the word "Item" in it.</p>
<p>As you can see in the image below, now we'll get only the files with <strong>upper case</strong> names in our result:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408072301/d2ffaae0-f688-40c6-9c1e-4ddd37159146.png" alt="command looking for file in specific directory case-sensitive" style="display:block;margin:0 auto" width="697" height="391" loading="lazy">

<p>IMPORTANT:<br><code>-like</code> alone means that we're looking for a certain pattern, no matter what case the letters are. The <code>c</code> in <code>-clike</code> means that we look for the thing with exactly the same capitalization of the letters (both upper and lower case, hence the <em>"c"</em>).</p>
<p>If you want to see the files <strong>without the upper case</strong> first letter, you can do that by changing "*Item*" from our current command to "*item*":</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" |   
Where-Object { $_.Name -clike "*item*" }
</code></pre>
<p>Let's try it out!</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768407562860/84b82488-8ee5-4b23-ac8f-831d9c586c41.png" alt="Picture: command looking for files with only lowercase letters in their names" style="display:block;margin:0 auto" width="747" height="321" loading="lazy">

<h3 id="heading-42-how-to-search-while-excluding-a-particular-directory">4.2. How to search while excluding a particular directory</h3>
<p>In <strong>step 4.1</strong> we learned how to search only for files/folders with specific case-sensitive names in them. After applying only two changes to our previous code, we can exclude certain directories from our search.</p>
<p>Here's our starting command once again:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" |   
Where-Object { $_.Name -clike "*Item*" }
</code></pre>
<h4 id="heading-change-1">Change #1</h4>
<p>In the example above, <code>-clike</code> shows only files/folders <strong>including</strong> specific phrase in their names. If we change it to <code>-cnotlike</code>, we'll <strong>exclude</strong> from the search all files/folders with that specific phrase in their name.</p>
<p>Now our code looks like this:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" |   
Where-Object { $_.Name -cnotlike "*Item*" }
</code></pre>
<h4 id="heading-change-2">Change #2</h4>
<p>After the first change, <code>Where-Object { \(_.Name -cnotlike "*Item*" }</code> only excludes the names, not full paths. In order to avoid that, we need to exclude an actual path to these files. We can do that by changing <code>\)_.Name</code> to <code>$_.FullName</code>, which checks for a certain phrase in the whole path to the file <strong>and</strong> in the file's name.</p>
<p>Now, your command should look like this:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" |   
Where-Object { $_.FullName -cnotlike "*Item*" }
</code></pre>
<p>We excluded the "Items" folder from our search. You should now be able to see the files only from the "More items" directory. Try it out yourself!</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/547801a8-a825-4607-9dbe-42e3c4af238e.png" alt="Picture: excluding part of path with FullName -cnotlike." style="display:block;margin:0 auto" width="1054" height="371" loading="lazy">

<p>What if you want to exclude the "More items" directory instead? Just change the phrase inside the filter to something like this:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File |   
Where-Object { $_.FullName -cnotlike "*More*" }
</code></pre>
<p>We also changed the name of the file from "*item*" to "*green*" in our <code>gci</code> search (first line of code). That's why now we'll see only one bracelet in our result list:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408276671/f4043a3f-ba14-4ff4-be60-ad5c3e321003.png" alt="command looking for file with exclusion case-sensitive" style="display:block;margin:0 auto" width="1000" height="182" loading="lazy">

<p>The <code>gci</code> command has two filters applied. First, it searches for files with phrase "green" in their names. The second filter is the "Where-Object" command, which <strong>excludes</strong> anything that has the word "More" in its path. In our case, the "More items" folder got excluded.</p>
<p>We don't even need the case-sensitive filter in our case. The command will work the same when we <strong>exclude</strong> just a <strong>lowercase</strong> word "more". So let's change <code>-cnotlike "*More*"</code> to <code>-notlike "*more*"</code> and see if it's true:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File |   
Where-Object { $_.FullName -notlike "*more*" }
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408250133/f6dac0bd-fc74-4c24-8b4b-9ba780683956.png" alt="Picture: case-sensitive search working the same in current example as a not case-sensitive search." style="display:block;margin:0 auto" width="836" height="188" loading="lazy">

<p>As you can see, the result is the same! Despite different cases of the letters, we still got the right <strong>keyword</strong>. So, case-sensitive search isn't always needed&nbsp;– only when you want to be very specific.</p>
<p>Sometimes, being too specific might be bad and make your code not work as intended. To see what I mean, let's look at the example below. Let's apply case-sensitive search once again, but to our unchanged, lowercase keyword "more" and see if it still works:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File |   
Where-Object { $_.FullName -cnotlike "*more*" }
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408273177/ee37dcf7-8720-44b7-aa04-1c09e1cfbe52.png" alt="Picture: case-sensitive search doesn't filter out anything now, because it's too specific. &quot;More items&quot; folder omits the filter now." style="display:block;margin:0 auto" width="1011" height="271" loading="lazy">

<p>Case-sensitive search doesn't filter out anything now, because it's too specific. Both the "Items" and "More items" folders omit the filter now.</p>
<h4 id="heading-faq">FAQ:</h4>
<p>If the <code>Where-Object</code> command is what actually filters the output for us, shouldn't we drop (delete) the <code>-Filter</code> option from <code>gci</code>?</p>
<p>No, we should still use the <code>-Filter</code> option, because it already separates around 99% of the possible files, so the <code>Where-Object</code> command has to work roughly only on 1% of the objects. It makes this part of the command AT LEAST 100 times faster (more often 100,000 times or even faster).</p>
<p>You can try using this command in <code>-Path C:/</code> with and without the <code>-Filter</code> option. In my case, using the <code>-Filter</code> shortened the time needed for the whole sequence of commands to finish from 16 seconds to 8 seconds (first 7.99 seconds is used by <code>gci</code>, so that's why the time got shortened only by a half). That's what we call ✨<em>optimization</em>✨ :D</p>
<h3 id="heading-43-searching-only-1-directory-from-many-with-exactly-the-same-name">4.3 Searching only 1 directory from many with exactly the same name</h3>
<p>We've learned how to search for a phrase anywhere inside the path of a file. But what if we want to search inside exactly the "More items" folder? For that, we'll use the <code>-match</code> filter (which works similarly to the <code>-like</code> filter).</p>
<p>Our phrase will also use "\", instead of "\". This is because "\" is the symbol for a folder, but alone in programming it also has some other features, which we don't want.</p>
<p>This command will look for a match for the "More items" folder in the path of every file from the list. Then, it will show you this file if it matches.</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/028f1187-e371-4496-8152-df778337a465.png" alt="Picture: &quot;gci&quot; with a filter for an exact folder." style="display:block;margin:0 auto" width="908" height="155" loading="lazy">

<p>What if we want to check for two folders, one next to the other, simultaneously? Very easy! Just connect them with the sign for a folder "\". Here, the command will search inside the "More items" folder only if it's inside the "Documents" folder:</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/6faef3fa-e2a8-46ff-bd5c-7c9cc27c1ab8.png" alt="Picture: searching for &quot;DocumentsMore*&quot;" style="display:block;margin:0 auto" width="908" height="140" loading="lazy">

<p>As you can see, we didn't use "More items", only "More". You can shorten that filter how you want. It will still be applied to the whole path. See the example below:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File |
Where-Object { $_.FullName -match "s\\Mo*" }
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/817fb9cb-ddd3-4d9f-8ff5-2dbbc3eb7d0d.png" alt="Picture: filter works, even if it could be more specific" style="display:block;margin:0 auto" width="908" height="140" loading="lazy">

<p>Earlier, we used the <code>not</code> statement in <code>-like</code> filter to exclude certain files and directories. The same can be done with <code>-notmatch</code>:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File | 
Where-Object { $_.FullName -notmatch "ents\\Ite*" }
</code></pre>
<p>Be aware that we're now excluding the "Items" folder from the search, not "More items".</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/acf4d31f-9c8f-4092-b0bd-ed577ca982cf.png" alt="Picture: excluding &quot;Documentstems&quot; folders from search by using &quot;notmatch&quot; filter" style="display:block;margin:0 auto" width="908" height="140" loading="lazy">

<p>And, with <code>-cmatch</code> we can apply the same case-sensitive filter as with <code>-clike</code>:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File | 
Where-Object { $_.FullName -cmatch "green*" }
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/7db7d3bb-9a9e-4881-b0e9-4a119c3f93d8.png" alt="7db7d3bb-9a9e-4881-b0e9-4a119c3f93d8" style="display:block;margin:0 auto" width="908" height="140" loading="lazy">

<p>I hope you get the gist of it now.</p>
<h3 id="heading-44-filter-how-deep-how-many-folders-in-you-want-to-search-for-the-file">4.4 Filter how deep (how many folders in) you want to search for the file</h3>
<p>Sometimes you might have a very long path to some of your files. If you don't want to waste time searching every folder on your computer recursively, you can use <code>-Depth</code> option. It specifies how many folders to search inside your folder tree. I already showed you the picture of a folder tree in the beginning of this article, but you should take a look at it here once again.</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/7a433d89-cfe5-4bf6-8f6d-b7b812414a93.png" alt="Picture: a visual explanation of -depth and -recurse parameters. It shows &quot;Documents&quot; folder at the bottom, which is tagged both as Parent and Depth 0. It points upwords to its child folders and a child file. Those are tagged as Depth 0 children of our Documents folder. They are simultaneously tagged as Depth 1 parents, so files and folders. to which they are pointing upwards, are their Depth 1 children." style="display:block;margin:0 auto" width="821" height="656" loading="lazy">

<p>So, how does the <code>-Depth</code> parameter work?</p>
<p><code>-Depth 0</code> means that our command will search only the current folder. It will show results of all children of Depth level 0. Those results are:<br>1 "child file" and 2 "child folders".</p>
<p><code>-Depth 1</code> searches the current folder and its child-folders. It will show the results of all children of Depth level 1. Those results are:<br>1 "child file", 2 "child folders", 2 "grandchild files" and 1 "grandchild folder".</p>
<p><code>-Depth 2</code> searches the current folder and its child and grandchild folders. It will show results of all children of Depth level 2. Those results are:<br>1 "child file", 2 "child folders", 2 "grandchild files", 1 "grandchild folder" and 1 "great grandchild file".</p>
<p>Let's see the difference between these two commands:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" -Depth 0
</code></pre>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" -Depth 1
</code></pre>
<p>The first command will show you only the files and folders inside our current directory.<br>The second command will also search for them inside every folder found inside the current folder.</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408448152/2d875580-e463-4903-b99f-d3b457f5eb5a.png" alt="depth parameter explanation" style="display:block;margin:0 auto" width="612" height="583" loading="lazy">

<p>For the sake of practice, let's combine it with <code>Where-Object</code> to find the green bracelet:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" -Depth 1 | Where-Object { $_.name -clike"*green*" }
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408504470/4af154e6-9d24-43e4-b228-770da7de9151.png" alt="Picture: gci looking for file with set depth" style="display:block;margin:0 auto" width="812" height="162" loading="lazy">

<p>I hope that this example showed you how easy it is to use multiple options ( <code>-Depth</code>, <code>-Recurse</code>) and filters (<code>-Filter</code>, <code>Where-Object</code>).</p>
<h2 id="heading-5-how-to-search-through-hidden-files">5. How to Search Through Hidden Files</h2>
<p>Some files are not that easily accessible to the user. You can see some of the hidden files and folders in Windows Explorer (<a href="https://notblackmagic.hashnode.dev/how-to-see-hidden-files-and-folders-in-windows-file-explorer">here's how</a>). But sometimes it's easier to find what you need if you see <strong>only</strong> those hidden files. That's possible with PowerShell.</p>
<p>The options we're going to use for that are:</p>
<ul>
<li><p><code>-Force</code>: show files otherwise not accessible by the user, such as hidden files.</p>
</li>
<li><p><code>-Hidden</code>: show <strong>only</strong> those hidden files and directories.</p>
</li>
</ul>
<p>This example will search for hidden files in our user's folder:</p>
<pre><code class="language-powershell">gci -Path ~\ -Force -Hidden
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408531210/22319e7b-f9f1-40cb-8037-7abcb9225c3b.png" alt="Picture: gci with -Forece and -Hidden parameters showing hidden files and folders" style="display:block;margin:0 auto" width="1315" height="553" loading="lazy">

<p>Everything here is usually invisible to the typical user. But not for you now :D</p>
<p>The interesting thing is that there are more files not available to the user than the available ones. If you're brave enough, you can see them yourself (Remember! <strong>Ctrl + C</strong> stops the command!):</p>
<pre><code class="language-powershell">gci -Path ~\ -Force -Hidden -Recurse
</code></pre>
<h2 id="heading-6-how-can-you-know-all-the-properties-that-you-can-use-as-a-filter">6. How can you know all the properties that you can use as a filter?</h2>
<p>Up until now, we'vce used some common properties, like <code>Name</code> and <code>Fullname</code>. But there are many others that you might want to access, like <code>CreationTime</code> (date of creating the file) or <code>LastWriteTime</code> (date of last edit of the file).</p>
<p>In this section, I'll first show you how to see all the possible properties. After that, you'll learn how to retrieve only the property you want for scripting purposes.</p>
<p>Go through <strong>step 2</strong> above if you haven't already, because we're going to use the same files that we created before.</p>
<p>Move to the <code>Documents</code> folder in PowerShell.</p>
<p>I hope that this script looks familiar to you now. It searches for files with "item" in their names and checks if these names contain the word "green" (all lowercase letters):</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" | 
Where-Object { $_.Name -clike "*green*" }
</code></pre>
<p>We know that only one file should appear (if you don't trust me, just see for yourself). So, we're going to see every possible property we can use by appending (adding at the end) this fragment of code:<br><code>| Select-Object -Property *</code></p>
<p><code>Select-Object</code> (alias: <code>select</code>) is used for selecting different types of properties. By using an option <code>-Property</code> we tell it to show both values and names of all the properties.</p>
<p>For example:</p>
<p>Name of property: <code>FullName</code><br>Value of property: <code>~\Documents\More items\item 1- green bracelet.txt</code></p>
<p>The asterisk <code>*</code> at the end tells this command to show these names and values for every property possible.</p>
<p>The final version of this command looks like this:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*item*" | 
Where-Object { $_.Name -clike "*green*" } | 
Select-Object -Property *
</code></pre>
<p>Try finding the <code>FullName</code> property in there :D</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768408562185/710a4835-a415-4500-af4f-6371a83ae3b6.png" alt="getting all command options or properties" style="display:block;margin:0 auto" width="962" height="830" loading="lazy">

<p>This command showed us all possible properties that we can use for that 1 file that it found. If there were more files fitting the filter, then every single one of them would have a similar list of properties. But for different types of files you will get different results.</p>
<h3 id="heading-how-to-retrieve-only-1-desired-property">How to retrieve only 1 desired property</h3>
<p>You've already learned how to check for all possible properties. So, how do we use any of them? Just put one of them instead an asterisk <code>*</code> at the end of the command, like we put <code>CreationTime</code> in here:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File |
Where-Object { $_.Name -clike "*green*" } | 
Select-Object -Property CreationTime
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/060de2e6-909f-4679-987c-e715fb7ee19b.png" alt="Picture: Select-Object shows only the CreationTime property" style="display:block;margin:0 auto" width="1120" height="182" loading="lazy">

<p>You can use any other property for the sake of this exercise, like <code>LastWriteTime</code>:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File |
Where-Object { $_.Name -clike "*green*" } | 
Select-Object -Property LastWriteTime
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/8223f738-9467-4961-8518-82e010a6e425.png" alt="Picture: Select-Object shows only the LastWriteTime property" style="display:block;margin:0 auto" width="1112" height="184" loading="lazy">

<p>What if you want to retrieve only the value of the property without its name (because you already know its name and it also messes up your script)? You can retrieve just the value, by changing the <code>-Property</code> to <code>-ExpandProperty</code>:</p>
<pre><code class="language-powershell">Get-ChildItem -Recurse -Filter "*green*" -File |
Where-Object { $_.Name -clike "*green*" } | 
Select-Object -ExpandProperty LastWriteTime
</code></pre>
<p>See the result:</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/7f08ecfd-4a19-4276-9d2a-eac53d5cdb93.png" alt="Picture: Changing -Property to -ExpandProperty makes the script to show only the value of the property without its name. the" style="display:block;margin:0 auto" width="1114" height="170" loading="lazy">

<h2 id="heading-7-i-dont-know-the-files-name-but-i-know-whats-inside-it-how-do-i-find-the-file-by-its-content">7. I don't know the file’s name, but I know what's inside it. How do I find the file by its content?</h2>
<p>Sometimes it's easier to find a file by searching it by its content. Or perhaps you have lots of similar files and you'd like to check them quickly without opening and closing them. I'll show you some techniques that will let you achieve that in no time.</p>
<p>This command will search every file on your system for the specified word or phrase (in our case, the phrase is "match"):</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -File | 
Select-String -Pattern 'match' -List
</code></pre>
<p>Here's what's happening:</p>
<ul>
<li><p><code>Get-ChildItem -Path C:\ -Recurse -File</code>: as you already know, this part searches for every file on your computer.</p>
</li>
<li><p><code>|</code> – passes the list of files to the next command. So, the next command will search for a certain phrase only in the files listed by <code>gci</code>.</p>
</li>
<li><p><code>Select-String</code> – "String" is a common word in programming used to describe a word/phrase/some text. So, we select the phrase that we want to search for. That phrase is specified by the <code>-Pattern</code> parameter (in our case it's "match").</p>
</li>
<li><p><code>-List</code> tells the command to show only the first found match in every file (great if you want to just see the list of all found files).</p>
</li>
</ul>
<p>Here's an example output of our command:</p>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/cb91d732-c15a-4b10-a127-1a78af2efe63.png" alt="Picture: Select-String showing path to the file and the place in the file where the pattern was found." style="display:block;margin:0 auto" width="1119" height="127" loading="lazy">

<p>Of course, you have quite a lot of files, and some images may also appear in your search (like .svg files that are basically text files that tell the system how to draw an icon). So, it's always best to specify what type of file you're searching for. Let's look for the phrase "red" inside .svg files:</p>
<pre><code class="language-powershell">Get-ChildItem -Filter "*.svg" -Recurse | 
Select-String -Pattern 'red' -List
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/c1d33d66-014b-49af-9e8d-508a581d51fa.png" alt="Picture: gci looking for text inside svg graphic files." style="display:block;margin:0 auto" width="1300" height="250" loading="lazy">

<p>On the other hand, some text documents will never appear in your search (for example .doc and .docx documents are encoded in such a way that they're impossible to decode without Word).</p>
<p>But in regular text files, you can search for phrases with an emphasis on big and small letters with the <code>-CaseSensitive</code> option. Here, we're going to search for the phrase "github" with only lowercase letters:</p>
<pre><code class="language-powershell">Get-ChildItem -Filter "*.txt" -Recurse | 
Select-String -Pattern 'github' -List -CaseSensitive
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/affa057b-3fc4-402d-9f93-4a1b93bcb98f.png" alt="affa057b-3fc4-402d-9f93-4a1b93bcb98f" style="display:block;margin:0 auto" width="1116" height="325" loading="lazy">

<p>Other options that you'll often use with the <code>Select-String</code> command are:</p>
<ul>
<li><code>Select-String -AllMatch</code> will show you all matches found in every searched file (instead of only 1 match found per file, like with <code>-List</code>).<br><code>Select-String -Context 3</code> shows the three lines of text before and after the line in which the match is found.<br><code>Select-String -Raw</code> won't show you the paths, just the content of the files. This is great for automation and scripts. It's often combined with the <code>-Context</code> option.</li>
</ul>
<p>Let's see some of these options in action:</p>
<pre><code class="language-powershell">Get-ChildItem -Filter "*.txt" -Recurse | 
Select-String -Pattern 'github' -AllMatch -Context 3
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771434300827/4a61d396-755c-49e8-a1f5-f0fd24347b5c.png" alt="looking for file based on its content" style="display:block;margin:0 auto" width="1920" height="350" loading="lazy">

<p>Thanks to the <code>-Context</code> parameter, you can see a total of seven lines (three lines before and three lines after the match) in this file, one after another. This makes it easier to differentiate it from all the other matches found by <code>-AllMatch</code> that might be put in a very similar context.</p>
<p>If you ever feel like there's too much clutter on your screen, you can combine <code>Select-String</code> with <code>Select-Object</code> to get only the paths of the files with matched phrases.</p>
<p>The command below will search every .txt file on your computer for the phrase specified:</p>
<pre><code class="language-powershell">Get-ChildItem -Filter "*.txt" -Recurse | 
Select-String -Pattern 'github' -List
</code></pre>
<p>Let's add the <code>Select-Object -Property Path</code> filter at the end. Now, the command will only show the paths, so there's less clutter on your screen:</p>
<pre><code class="language-powershell">Get-ChildItem -Filter "*.txt" -Recurse | 
Select-String -Pattern 'github' -List | 
Select-Object -Property Path
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/71b9b173-3dd4-40a1-911f-0d494c6a44bb.png" alt="Picture: adding Select-Object makes the results more readable and easier to understand." style="display:block;margin:0 auto" width="1051" height="585" loading="lazy">

<p>Some of the paths are not fully visible. We'll fix that in the next step.</p>
<h2 id="heading-8-i-cant-see-the-full-path-how-do-i-fix-this">8. I can't see the full path - how do I fix this?</h2>
<p>Let's format the results with the <code>Format-Table -Wrap -AutoSize</code> command. <code>-Autosize</code> allows the result to take the whole available space. <code>-Wrap</code> allows wrapping (continuing the text in the next line when it doesn't fit in the space available), which creates more space if it's needed.</p>
<p>Here's an example:</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Filter "*.txt" -Recurse | 
Select-String -Pattern 'github' -List | 
Select -Property Path | 
Format-Table -Wrap -AutoSize
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/69289f73296ac6cbc0e5620b/bcea9d57-e966-4c41-8d24-bfb3acf95281.png" alt="bcea9d57-e966-4c41-8d24-bfb3acf95281" style="display:block;margin:0 auto" width="1057" height="426" loading="lazy">

<p>Now, you can see the whole paths (or any other results you need) even in PowerShell!</p>
<h2 id="heading-9-hard-to-read-open-the-results-in-the-text-editor-of-your-choice">9. Hard to read? Open the results in the text editor of your choice</h2>
<p>You can send the results of any script/command in two ways:</p>
<p><code>&gt; ~\Documents\command_output.txt</code><br>AND<br><code>| Out-File ~\Documents\command_output.txt</code></p>
<p>Both of these will create a file inside your <code>Documents</code> folder, which you can later open in any program of your choice and edit.</p>
<p>Just add whichever solution you prefer to the end of your command, like here:</p>
<pre><code class="language-powershell">Get-ChildItem -Filter "*.txt" -Recurse | 
Select-String -Pattern 'match' -List | 
Select -Property Path | 
Out-File ~\Documents\command_output.txt
</code></pre>
<p>In the image below, first you'll see the same command, but without exporting the results to another file. The second command, at the bottom of the image, will export the results to the other file without showing them in PowerShell:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771431975160/41f0445e-1a0c-41f6-83b5-446f21e9bea9.png" alt="Picture: gci looking for file based on its content, but showing only paths to the files with found matches." style="display:block;margin:0 auto" width="1920" height="650" loading="lazy">

<p>You'll see the results from second command after opening the file in any text editor:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771432401191/851770d9-6596-4081-b537-45bf8373ac44.png" alt="Picture: command results are possible to open in any text editor." style="display:block;margin:0 auto" width="1920" height="650" loading="lazy">

<p>But, what if you can't see the full path even in your text editor?</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771432650086/f21b1bf6-6aad-4799-a34b-c5889b8f8ee7.png" alt="Picture: command results don't show all information you need. They sometimes stop showing, if it's more then default settings allow for." style="display:block;margin:0 auto" width="700" height="650" loading="lazy">

<p>To address this, you can add <code>| Format-Table -Wrap -AutoSize</code> right before sending the results to the file:</p>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Filter "*.txt" -Recurse | 
Select-String -Pattern 'match' -List | 
Select -Property Path | 
Format-Table -Wrap -AutoSize |
Out-File ~\Documents\command_output.txt
</code></pre>
<p>And open the file to see the whole path!</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1771434628016/b8bebea1-f6db-4d12-a0f5-70ca18492b9b.png" alt="Picture: bug fixed. Now, you can see all the information." style="display:block;margin:0 auto" width="1920" height="350" loading="lazy">

<p>Just remember that you have to copy each line one by one. Where you see the arrows in the screenshot above is a "newline" character, which you have to delete. Only after doing that can you copy the whole path and paste it into Windows Explorer or into some script.</p>
<h2 id="heading-10-summary-the-ultimate-commands-for-searching-and-finding-whatever-you-need">10. Summary: the Ultimate Commands for Searching and Finding Whatever You Need</h2>
<p><a href="https://github.com/NotBlackMagician/NBM-cheat-sheets/blob/main/windows_powershell/NBM_cheat_sheet_Get-ChildItem_find_any_file_like_on_linux.txt">Here</a> you can download a free cheat sheet with explanations of the commands and examples in one place.</p>
<h3 id="heading-most-used-commands">Most used commands:</h3>
<ul>
<li>Case-sensitive search:</li>
</ul>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "*whatYouNeed*" |   
Where-Object { $_.Name -clike "*whatYouNeed*" } |   
Select-Object { $_.FullName } |
Format-Table -Wrap -AutoSize
</code></pre>
<ul>
<li>Alternatively, send the result to a file:</li>
</ul>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse -Filter "*whatYouNeed*" |   
Where-Object { $_.Name -clike "*whatYouNeed*" } |   
Select-Object { $_.FullName } |
Format-Table -Wrap -AutoSize |
Out-File ~\Documents\command_output.txt
</code></pre>
<ul>
<li>Search by file's content:</li>
</ul>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse | 
Select-String -Pattern 'what you remember' -AllMatch -Context 2 |
Format-Table -Wrap -AutoSize
</code></pre>
<ul>
<li>Alternatively, send the result to the file:</li>
</ul>
<pre><code class="language-powershell">Get-ChildItem -Path C:\ -Recurse | 
Select-String -Pattern 'what you remember' -CaseSensitive -AllMatch -Context 2 |
Format-Table -Wrap -AutoSize |
Out-File ~\Documents\command_output.txt
</code></pre>
<p>These commands should work for anything you want to find. I hope you understand now how they function after reading through this tutorial ;)</p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>If you want to learn more about these commands, I show you how to work with them in depth in my tutorial <a href="https://notblackmagic.hashnode.dev/learn-windows-powershell-commands-like-a-linux-user">“Learn PowerShell commands like a Linux user”</a>.</p>
<p>If what you found here helped you in any way, consider following me on my social media in order to help me reach further audience: <a href="https://social.linux.pizza/@SecretDevil">Mastodon</a>, <a href="https://www.linkedin.com/in/piotr-opoka-4320143a5/">LinkedIn</a>.</p>
<p>You can also rate me on <a href="https://github.com/NotBlackMagician">Github</a> and support me on <a href="https://ko-fi.com/piotropoka">Ko-fi!</a></p>
<p>Thank you for any support you're able to give. Have a great day!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Set Up CUDA and WSL2 for Windows 11 (including PyTorch and TensorFlow GPU) ]]>
                </title>
                <description>
                    <![CDATA[ If you’re working on complex Machine Learning projects, you’ll need a good Graphics Processing Unit (or GPU) to power everything. And Nvidia is a popular option these days, as it has great compatibility and widespread support. If you’re new to Machin... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-set-up-cuda-and-wsl2-for-windows-11-including-pytorch-and-tensorflow-gpu/</link>
                <guid isPermaLink="false">69309b9e8c594b8177306456</guid>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ WSL ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GPU ]]>
                    </category>
                
                    <category>
                        <![CDATA[ cuda ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Deep Learning ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Md. Fahim Bin Amin ]]>
                </dc:creator>
                <pubDate>Wed, 03 Dec 2025 20:20:46 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1764786287487/f0c28401-ce77-4873-b238-59fc6b737ce7.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you’re working on complex Machine Learning projects, you’ll need a good Graphics Processing Unit (or GPU) to power everything. And Nvidia is a popular option these days, as it has great compatibility and widespread support.</p>
<p>If you’re new to Machine Learning and are just getting started, then a free <a target="_blank" href="https://www.kaggle.com/">Kaggle</a> or <a target="_blank" href="https://colab.research.google.com/">Colab</a> might be enough for you. But that won’t be the case when you want to go deeper. You’ll need a GPU, which can get costly if you’re continuously using it on the cloud.</p>
<p>But there’s some good news: you can utilize your computer’s Nvidia GPU (GTX/RTX) quite easily and perform machine learning-related tasks right on your local machine. The cool thing is, it won’t cost you anything other than the electricity it uses!</p>
<p>When you’re running Machine Learning models on your local machines, the most suitable operating system is a Linux-based one, like Ubuntu. But Windows has improved a lot for this purpose. If you’re using the latest Windows 11, you can leverage Windows Subsystem for Linux (WSL) and use your GPU directly for Machine Learning-related workflows.</p>
<p>This process can be quite tricky, though, as can making two popular Machine Learning frameworks, TensorFlow and PyTorch, compatible with your system GPU in Windows 11. That’s why I have written this comprehensive guide to ease your pain.</p>
<p>In it, I’ll help you set up CUDA on Windows Subsystem for Linux 2 (WSL2) so you can leverage your Nvidia GPU for machine learning tasks.</p>
<p>By following these steps, you’ll be able to run ML frameworks like TensorFlow and PyTorch with GPU acceleration on Windows 11.</p>
<p>Keep in mind that this guide assumes you have a compatible Nvidia GPU. Make sure to check <a target="_blank" href="https://developer.nvidia.com/cuda-gpus">Nvidia's official compatibility list</a> before proceeding.</p>
<p>I have also prepared a video for you that’ll help you follow proper guidelines throughout this article.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/qOJ49nkU4rY" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<p>Also, if this tutorial helps you, then don’t forget to add a star to the GitHub repository <a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu-v2">CUDA-WSL2-Ubuntu-v2</a>. If you face any issues or have any suggestions/improvements, then please raise an issue in the GitHub repository. Currently, the live website is available at <a target="_blank" href="https://ml-win11-v2.fahimbinamin.com/">ml-win11-v2.fahimbinamin.com</a>.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ol>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-windows-terminal">Windows Terminal</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-windows-powershell-latest-amp-greatest">Windows PowerShell (Latest &amp; Greatest)</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-configure-windows-terminal">Configure Windows Terminal</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-configuration-of-my-computer">Configuration of my computer</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-cpu-virtualization">CPU Virtualization</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-install-wsl2">Install WSL2</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-install-latest-lts-ubuntu-via-wsl2">Install Latest LTS Ubuntu via WSL2</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-update-amp-upgrade-ubuntu-packages">Update &amp; Upgrade Ubuntu Packages</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-install-and-configure-miniconda">Install and Configure Miniconda</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-install-jupyter-amp-ipykernel">Install Jupyter &amp; Ipykernel</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-nvidia-driver">Nvidia Driver</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-install-cuda-dependencies">Install CUDA dependencies</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-cuda-toolkit">CUDA Toolkit</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-add-path-to-shell-profile-for-cuda">Add Path to Shell Profile for CUDA</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-nvcc-version">nvcc Version</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-cudnn-sdk">cuDNN SDK</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-tensorflow-gpu">TensorFlow GPU</a></p>
<ul>
<li><a class="post-section-overview" href="#heading-check-tensorflow-gpu">Check TensorFlow GPU</a></li>
</ul>
</li>
<li><p><a class="post-section-overview" href="#heading-pytorch-gpu">PyTorch GPU</a></p>
<ul>
<li><p><a class="post-section-overview" href="#heading-check-pytorch-gpu">Check PyTorch GPU</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-check-pytorch-amp-tensorflow-gpu-inside-jupyter-notebook">Check PyTorch &amp; TensorFlow GPU inside Jupyter Notebook</a></p>
</li>
</ul>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ol>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>Before you begin, make sure you have the following requirements met:</p>
<ul>
<li><p>Windows 11 operating system</p>
</li>
<li><p>Nvidia GPU (GTX/RTX series)</p>
</li>
<li><p>Administrator access to your PC</p>
</li>
<li><p>At least 30 GB of free disk space</p>
</li>
<li><p>Internet connection for downloads</p>
</li>
<li><p>Latest Nvidia drivers installed</p>
</li>
</ul>
<h2 id="heading-windows-terminal">Windows Terminal</h2>
<p>First, you’ll need to ensure that you have Windows Terminal installed properly in your operating system. It is the newest terminal application for users of command-line tools and shells like Command Prompt, PowerShell, and WSL. You can download it from the <a target="_blank" href="https://apps.microsoft.com/detail/9N0DX20HK701?hl=en-us&amp;gl=BD&amp;ocid=pdpshare">Microsoft Store</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094104150/c73ae561-6888-4eea-9419-186c6659a62f.png" alt="Preview of Windows Terminal on Windows 11" class="image--center mx-auto" width="1133" height="641" loading="lazy"></p>
<p>After ensuring that it’s installed properly, you can proceed to the next steps.</p>
<h2 id="heading-windows-powershell-latest-amp-greatest">Windows PowerShell (Latest &amp; Greatest)</h2>
<p>Windows PowerShell is a modern and updated command-line shell from Microsoft. You can use some Linux specific commands directly on it. It comes with built-in command suggestions. You can download it from the <a target="_blank" href="https://github.com/PowerShell/PowerShell/releases/">official GitHub page</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094138179/78315197-f4f2-4df4-b022-37cb9e74cda2.png" alt="Preview of Windows PowerShell on GitHub" class="image--center mx-auto" width="1519" height="904" loading="lazy"></p>
<p>Download the latest x64 installer and install it. After ensuring that it is installed properly, you can proceed to the next steps.</p>
<h2 id="heading-configure-windows-terminal">Configure Windows Terminal</h2>
<p>Now you’ll need to configure your Windows Terminal to use PowerShell as the default shell. It’s optional and you might skip this step. But I recommend doing it for a better experience.</p>
<p>Open Windows Terminal. Click on the down arrow icon in the title bar and select "Settings".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094162440/6ea767c8-da3b-4280-84f8-0eb2b0647a46.png" alt="Preview of Windows PowerShell settings window" class="image--center mx-auto" width="1166" height="660" loading="lazy"></p>
<p>In the Settings tab, under "Startup", find the "Default profile" dropdown menu. Select "PowerShell" from the list.</p>
<p>Now for the "Default terminal application", select "Windows Terminal".</p>
<p>By default, Windows PowerShell always shows the version number in the title bar. If you want to disable it, select the "PowerShell" profile from the left sidebar. Click on the "Command Line" field and add an <code>--nologo</code> argument at the end of the command. After this, the line becomes <code>"C:\Program Files\PowerShell\7\pwsh.exe" --nologo</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094185648/3641d5f0-ba34-44b9-8a63-86b53068d02e.png" alt="Preview of Windows PowerShell --nologo setting" class="image--center mx-auto" width="1170" height="654" loading="lazy"></p>
<p>If you don’t use other shells frequently and want to hide them in the dropdown, then you’ll need to select those profiles one by one from the left sidebar. Scroll down to the bottom and find the "Hide profile from dropdown" toggle and enable it. It will hide that specific shell from the dropdown menu.</p>
<p>For example, I am hiding the <strong>Azure Cloud Shell</strong> profile as I don't use it frequently:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094214632/73add1b7-bcdd-4368-86a6-975fa2f72b54.png" alt="Preview of hiding profiles in Windows Terminal" class="image--center mx-auto" width="1151" height="657" loading="lazy"></p>
<p>Now click on the "Save" button at the bottom right corner to apply the changes. Close the Windows Terminal for now.</p>
<h2 id="heading-configuration-of-my-computer">Configuration of My Computer</h2>
<p>I figured it’d be helpful to share my current computer’s configuration so you can have a clear idea of which setup I’m using in this guide. Here are the details:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Component</strong></td><td><strong>Specification</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>Processor</strong></td><td>AMD Ryzen 7 7700 8-Core Processor (8 Core 16 Threads)</td></tr>
<tr>
<td><strong>RAM</strong></td><td>64GB DDR5 6000MHz</td></tr>
<tr>
<td><strong>Storage</strong></td><td>1 TB Samsung 980 NVMe SSD, 4 TB HDD, 2 TB SATA SSD</td></tr>
<tr>
<td><strong>GPU</strong></td><td>NVIDIA GeForce RTX 3060 12GB GDDR6</td></tr>
<tr>
<td><strong>Operating System</strong></td><td>Windows 11 Pro Version 25H2</td></tr>
</tbody>
</table>
</div><p>Now that you have an idea about my computer’s configuration, we can proceed to the next steps.</p>
<h2 id="heading-cpu-virtualization">CPU Virtualization</h2>
<p>As we are going to use WSL2, we’ll need to make sure that the CPU virtualization is enabled. To check whether virtualization is enabled or not from Windows, simply open the Windows Task Manager. Go to the Performance tab and select CPU from the left sidebar. In the bottom right corner, you will see the Virtualization status. If it shows "Enabled", then you are good to go. If it shows "Disabled", then you need to enable it from the BIOS.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094252181/29efa40c-ec0a-4d99-adb7-50596348a1aa.png" alt="Preview of Virtualization enabled status in Windows Task Manager" class="image--center mx-auto" width="824" height="760" loading="lazy"></p>
<p>⚠️ You have to ensure that CPU Virtualization is enabled in your BIOS settings. Different manufacturers have different ways to access the BIOS. Usually, you can access the BIOS by pressing the Delete or F2 key during the boot process. Once in BIOS, look for settings related to "Virtualization Technology" or "Intel VT-x"/"AMD-V" and make sure it is enabled. Save the changes and exit the BIOS.</p>
<h2 id="heading-install-wsl2">Install WSL2</h2>
<p>Open the Windows Terminal or Windows PowerShell as an administrator. Run the following command to install WSL2 along with the latest Ubuntu LTS distribution:</p>
<pre><code class="lang-powershell">wsl.exe -<span class="hljs-literal">-install</span>
</code></pre>
<p>It will install Windows Subsystem for Linux 2 (WSL2). After the installation is complete, you will be prompted to restart your computer. Do so to finalize the installation.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094306994/41db30c0-ecb9-4436-a425-8a059b199c42.png" alt="Preview of WSL installation in Windows PowerShell" class="image--center mx-auto" width="1295" height="656" loading="lazy"></p>
<p>⚠️ If you encounter any issues during installation, refer to the <a target="_blank" href="https://learn.microsoft.com/en-us/windows/wsl/troubleshooting">official Microsoft documentation</a> for troubleshooting WSL installation problems.</p>
<h2 id="heading-install-latest-lts-ubuntu-via-wsl2">Install Latest LTS Ubuntu via WSL2</h2>
<p>Open the Windows Terminal or Windows PowerShell again with the administrator privileges. If you want to check the available Linux distributions to install via WSL, run the following command:</p>
<pre><code class="lang-powershell">wsl.exe -<span class="hljs-literal">-list</span> -<span class="hljs-literal">-online</span>
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094455888/8f1f2382-41cc-410f-a7b9-a47d3bb634b6.png" alt="Preview of available WSL distributions in Windows PowerShell" class="image--center mx-auto" width="1291" height="660" loading="lazy"></p>
<p>For installing any specific distribution, run the following command:</p>
<pre><code class="lang-powershell">wsl.exe -<span class="hljs-literal">-install</span> &lt;DistroName&gt;
</code></pre>
<p>We are going to install the latest LTS Ubuntu distribution. As of now, the latest LTS version is Ubuntu 24.04. But I prefer to install the <code>Ubuntu</code> directly as it always points to the latest LTS version. So, run the following command:</p>
<pre><code class="lang-powershell">wsl.exe -<span class="hljs-literal">-install</span> Ubuntu
</code></pre>
<p>You need to give it a default user account name. For me, I am going with <code>fahim</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094505280/9beb24de-54da-4e0c-993d-b15f985867e3.png" alt="Preview of Ubuntu installation in Windows PowerShell" class="image--center mx-auto" width="1666" height="858" loading="lazy"></p>
<p>It also comes with a nice GUI management tool for WSL.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094530944/89073fb9-881f-48bd-b5ef-a0b08f74e4c5.png" alt="Preview of WSL GUI management tool" class="image--center mx-auto" width="1114" height="724" loading="lazy"></p>
<p>You can configure a lot of stuff in it including restricting core, RAM, disk space and a lot of specifications from the settings GUI window.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094551095/66aea1e1-e204-4115-80e0-b3dea2d7a2ac.png" alt="Preview of WSL GUI settings window (Memory &amp; Processor)" class="image--center mx-auto" width="1919" height="1024" loading="lazy"></p>
<h2 id="heading-update-amp-upgrade-ubuntu-packages">Update &amp; Upgrade Ubuntu Packages</h2>
<p>Open your Ubuntu terminal from Windows Terminal. First, we need to update and upgrade the existing packages to their latest versions.</p>
<p>To update the Ubuntu system, simply use the following command:</p>
<pre><code class="lang-bash">sudo apt update -y
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094594281/be41e056-7e55-4139-b84b-6b7921a2d435.png" alt="Preview of apt update command in Ubuntu terminal" class="image--center mx-auto" width="1649" height="888" loading="lazy"></p>
<p>To upgrade all the packages at once, simply use the following command:</p>
<pre><code class="lang-bash">sudo apt upgrade -y
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094627958/b1c17b1c-5290-470b-aafe-5b89bb03bd01.png" alt="Preview of apt upgrade command in Ubuntu terminal" class="image--center mx-auto" width="1659" height="934" loading="lazy"></p>
<p>⚠️ Make sure that you have a stable internet connection during the update and upgrade process to avoid any interruptions.</p>
<h2 id="heading-install-and-configure-miniconda">Install and Configure Miniconda</h2>
<p>In Machine Learning, we need to manage multiple environments with different package versions. Conda is a popular package and environment management system that makes it easy to create and manage isolated environments for different projects. We will install Miniconda, a minimal installer for Conda, to manage our Python environments. But if you prefer Anaconda, you can install it instead.</p>
<p>Go to the official website of Miniconda. Currently the Miniconda installer is inside Anaconda <a target="_blank" href="https://www.anaconda.com/docs/getting-started/miniconda/install">here</a>. If the official website gets updated, you can always search for "Miniconda installer" on Google to find the latest version. Also, you can create an issue in the <a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu-v2/issues">official GitHub repository of this project</a> to notify me about it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094667031/7ee2c854-88b6-49ce-8c04-41bf0a052c90.png" alt="Preview of Miniconda official website" class="image--center mx-auto" width="1895" height="935" loading="lazy"></p>
<p>As we are installing it inside WSL, we have to select the macOS/Linux Installation. Then select Linux Terminal Installer and choose Linux x86 for downloading the installer.</p>
<pre><code class="lang-bash">wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
</code></pre>
<p>It will download the installer to your WSL directory. Then use the following command to install it properly:</p>
<pre><code class="lang-bash">bash ~/Miniconda3-latest-Linux-x86_64.sh
</code></pre>
<p>⚠️ Make sure that you are in the correct directory where the installer is downloaded. If you downloaded it to a different location, adjust the path accordingly. Also, replace bash with zsh or sh if you are using a different shell.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094706995/3a317eb9-0340-4a84-8826-45324c93dd2f.png" alt="Preview of Miniconda installation in WSL Ubuntu terminal" class="image--center mx-auto" width="1794" height="922" loading="lazy"></p>
<p>Make sure to choose the initialization option properly. I prefer to keep the conda env active whenever I open a new shell. Therefore, I chose "Yes".</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094727839/f3fc8902-0c37-432c-a912-a92810e89fd1.png" alt="Preview of Miniconda initialization option during installation" class="image--center mx-auto" width="1656" height="924" loading="lazy"></p>
<p>Make sure that the installation succeeds without any errors.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094754454/53dfd998-62c9-4c2a-a71e-0d33e123e027.png" alt="Preview of successful Miniconda installation in WSL Ubuntu terminal" class="image--center mx-auto" width="1652" height="914" loading="lazy"></p>
<p>For the changes to take effect, you can close and reopen the current shell. But you can also do that without closing and reopening the shell by applying the command below.</p>
<pre><code class="lang-bash"><span class="hljs-built_in">source</span> ~/.bashrc
</code></pre>
<p>⚠️ If you’re using a different shell like zsh or fish, make sure to source the appropriate configuration file (e.g., ~/.zshrc for zsh).</p>
<h2 id="heading-install-jupyter-amp-ipykernel">Install Jupyter &amp; Ipykernel</h2>
<p>I prefer to use Jupyter Notebook for running my machine learning experiments. It provides an interactive environment for coding and data analysis. We’ll install Jupyter Notebook and Ipykernel to run Jupyter notebooks in our conda environment. We will do that in all conda environments starting with the <strong>base</strong> environment. It also helps us to keep the conda environment kernel inside Jupyter Notebook.</p>
<p>First, make sure that you are in the base conda environment. You will see (base) on the left side of the terminal.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094812122/66ad5de8-7553-42da-b920-78d20c3bdc9a.png" alt="Preview of conda base environment in WSL Ubuntu terminal" class="image--center mx-auto" width="1917" height="1027" loading="lazy"></p>
<p>Now install Jupyter and Ipykernel both by applying the following command:</p>
<pre><code class="lang-bash">conda install jupyter ipykernel -y
</code></pre>
<p>Make sure that you accept the terms of service of Conda.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094839808/90fe3dcf-053d-4bc7-a031-22f81eb706ca.png" alt="Preview of Jupyter and Ipykernel installation in WSL Ubuntu terminal" class="image--center mx-auto" width="1659" height="927" loading="lazy"></p>
<p>Now, I will create a separate conda environment for both TensorFlow and the PyTorch GPU. You can directly install them in the base environment or in any other environment as per your preference. I am not specifying any specific Python version while creating the environment. It will automatically install the latest stable version of Python.</p>
<pre><code class="lang-bash">conda create -name ml -y
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094865498/ac9ef1f1-4494-4221-8376-5e257c4f9243.png" alt="Preview of creating a new conda environment named 'ml' in WSL Ubuntu terminal" class="image--center mx-auto" width="1659" height="925" loading="lazy"></p>
<p>To activate any specific conda environment, you have to use the following command:</p>
<pre><code class="lang-bash">conda activate &lt;conda-env-name&gt;
</code></pre>
<p>For example, if I want to activate my newly created <strong>ml</strong> environment, I will use this command:</p>
<pre><code class="lang-bash">conda activate ml
</code></pre>
<p>If you’re not sure which conda environments are installed in your system, you can check all available and installed conda environments in your system by running the following command:</p>
<pre><code class="lang-bash">conda env list
</code></pre>
<h2 id="heading-nvidia-driver">Nvidia Driver</h2>
<p>Ensure that you have the latest Nvidia drivers installed on Windows. WSL2 uses the Windows driver, so no separate driver installation is needed in Ubuntu. You can download the latest drivers from the <a target="_blank" href="https://www.nvidia.com/Download/index.aspx">official Nvidia website</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764094915617/cd9b0bfc-77a1-45f1-9dab-4349c8f489ef.png" alt="Preview of Nvidia driver download page" class="image--center mx-auto" width="1750" height="916" loading="lazy"></p>
<p>If you are just installing the latest GPU driver, then after installing the drivers, restart your computer to ensure the changes take effect. You can either use the GeForce Game Ready Driver or the NVIDIA Studio Driver. But I recommend using the Studio Driver for better stability with creative and ML applications.</p>
<h2 id="heading-install-cuda-dependencies">Install CUDA Dependencies</h2>
<p>You might face some issues if you do not have the CUDA dependencies installed properly. I recommend that you install the required dependencies before proceeding further:</p>
<pre><code class="lang-bash">sudo apt install gcc g++ build-essential
</code></pre>
<p>After installing the dependencies, you can then verify the CUDA installation if you had any issues earlier.</p>
<h2 id="heading-cuda-toolkit">CUDA Toolkit</h2>
<p>TensorFlow GPU is very picky about the CUDA version. So we need to install a specific version of CUDA Toolkit that is compatible with the TensorFlow version we are going to install.</p>
<p>To understand exactly which CUDA version is compatible with which TensorFlow version, you can check the official TensorFlow GPU support matrix <a target="_blank" href="https://www.tensorflow.org/install/pip">here</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095089103/87a44961-9426-4d20-95ac-cde06961b41a.png" alt="Preview of TensorFlow GPU support in official docs" class="image--center mx-auto" width="1879" height="931" loading="lazy"></p>
<p>At the time I’m writing this article, the TensorFlow GPU documentation says that we should have CUDA Toolkit 12.3. So I will ensure that I install exactly that version. You can simply click on that version link in the official docs and it will redirect you to the official Nvidia CUDA Toolkit download page. But if the link gets updated in the future, you can always search for "Nvidia CUDA Toolkit" on Google to find the latest version.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095106589/19689d63-5ebd-4783-8da4-e3dedd277efb.png" alt="Preview of Nvidia CUDA Toolkit official website" class="image--center mx-auto" width="1620" height="925" loading="lazy"></p>
<p>As TensorFlow GPU is asking for exact Version 12.3, I will select version 12.3.0 exactly.</p>
<p>In the CUDA Toolkit download page, make sure to choose the operating system as Linux, Architecture as x86_64, Distribution as WSL-Ubuntu, Version as 2.0 and the Installer type as runfile(local).</p>
<p>⚠️ As we are using Ubuntu in our WSL2, you can also choose Ubuntu as your operating system. But I prefer to choose WSL-Ubuntu for better compatibility.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095151533/b6996611-d4ce-4e07-9c73-30bdc93dbf19.png" alt="Preview of CUDA Toolkit 12.3 download page for WSL-Ubuntu" class="image--center mx-auto" width="1311" height="898" loading="lazy"></p>
<p>After selecting those, it will give you the download commands. You have to apply them sequentially. Make sure that you <strong>don't keep the checkmark in "Kernel Objects" during installing CUDA</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095169368/c2f81594-536f-4788-b765-1aab3b040fa7.png" alt="Preview of CUDA Toolkit 12.3 download commands for WSL-Ubuntu" class="image--center mx-auto" width="1895" height="1001" loading="lazy"></p>
<p>⚠️ Make sure to copy and paste the commands one by one in your WSL Ubuntu terminal to download and install the CUDA Toolkit properly. If you face any issues related to CUDA dependency, then quickly go through the <a class="post-section-overview" href="#heading-install-cuda-dependencies">Install CUDA dependencies</a> section, where I have explained how to install the CUDA dependencies properly.</p>
<h2 id="heading-add-path-to-shell-profile-for-cuda">Add Path to Shell Profile for CUDA</h2>
<p>After installing CUDA Toolkit, we need to add the CUDA binaries to our shell profile for easy access. This will allow us to run CUDA commands from any directory in the terminal.</p>
<p>Note that, depending on the shell you are using (bash, zsh, and so on), you need to add the CUDA path to the appropriate configuration file. Make sure to replace <strong>.bashrc</strong> with <strong>.zshrc</strong> or other configuration files if you are using a different shell.</p>
<p>To add the CUDA binary path, follow the command below:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">'export PATH=/usr/local/cuda-12.3/bin:$PATH'</span> &gt;&gt; ~/.bashrc
</code></pre>
<p>You have to use the updated path where you installed it. Your terminal will show it after installing the CUDA:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095215437/15768563-c956-472e-9633-95b3dd1cb7a3.png" alt="Preview of CUDA installation path in WSL Ubuntu terminal" class="image--center mx-auto" width="1912" height="1011" loading="lazy"></p>
<p>Now, you need to add the path inside the Library path. Just use the exact path where you installed CUDA. Your terminal will list the path properly.</p>
<pre><code class="lang-bash"><span class="hljs-built_in">echo</span> <span class="hljs-string">'export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64:$LD_LIBRARY_PATH'</span> &gt;&gt; ~/.bashrc
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095242744/3c708db4-d267-4043-aa11-d04d890904f9.png" alt="Preview of CUDA library path in WSL Ubuntu terminal" class="image--center mx-auto" width="1284" height="693" loading="lazy"></p>
<p>After adding those paths, you need to source the shell profile for the changes to take effect. You can do that by running the following command:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">source</span> ~/.bashrc
</code></pre>
<h2 id="heading-nvcc-version">nvcc Version</h2>
<p>NVCC stands for Nvidia CUDA Compiler. It is basically a compiler driver for the CUDA platform that allows developers to write parallel programs to run on Nvidia GPUs. As we have already installed the CUDA toolkit, we need to see whether the compiler is also properly activated. To check that, we need to verify the version.</p>
<p>Verify that CUDA is properly installed by checking the version:</p>
<pre><code class="lang-bash">nvcc --version
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095277858/2d1ded0a-01ac-4f78-9f6c-ac499d623207.png" alt="Preview of nvcc version check in WSL Ubuntu terminal" class="image--center mx-auto" width="1839" height="946" loading="lazy"></p>
<p>If the output shows the correct CUDA version, then you have successfully installed CUDA Toolkit in your WSL2 Ubuntu environment.</p>
<h2 id="heading-cudnn-sdk">cuDNN SDK</h2>
<p>The cuDNN (CUDA Deep Neural Network) SDK is a <a target="_blank" href="https://developer.nvidia.com/cudnn">GPU accelerated library of primitives for deep neural networks</a>, developed by Nvidia. It provides highly optimized building blocks for common deep learning operations, significantly speeding up the training and inference processes of AI models on Nvidia GPUs.</p>
<p>Note: Even though TensorFlow GPU suggests a specific cuDNN version, it’s often compatible with multiple versions. Because of this, I recommend downloading the latest cuDNN version that is compatible with your installed CUDA version. You can find the cuDNN download page <a target="_blank" href="https://developer.nvidia.com/cudnn-downloads">here</a>.</p>
<p>Select the Operating System as Linux, Architecture as x86_64, Distribution as Ubuntu, Version as 24.04, Installer Type as deb (local), Configuration as FULL. After selecting those, it will give you the download commands. You have to apply them sequentially.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095312370/1fca5959-f492-4160-8027-deec0674863b.png" alt="Preview of cuDNN download commands for Ubuntu 24.04" class="image--center mx-auto" width="1543" height="938" loading="lazy"></p>
<p>⚠️ Make sure to copy and paste the commands one by one in your WSL Ubuntu terminal to download and install the cuDNN SDK properly. If you face any issues related to CUDA dependency, then quickly go through the <a class="post-section-overview" href="#heading-install-cuda-dependencies">Install CUDA dependencies</a> section, where I have explained how to install the CUDA dependencies properly.</p>
<h2 id="heading-tensorflow-gpu">TensorFlow GPU</h2>
<p>Now, we are going to install TensorFlow GPU in our conda environment. Make sure that you have activated the conda environment where you want to install it. I’m going to install it in my previously created <strong>ml</strong> environment. To activate it, I’ll use the following command:</p>
<pre><code class="lang-bash">conda activate ml
</code></pre>
<p>⚠️ Make sure that you have activated the correct conda environment before installing TensorFlow GPU. You will see the environment name in the terminal prompt.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095398777/0c7d8813-eb6c-4e2e-bad9-1fc7d344d7a2.png" alt="Preview of activating 'ml' conda environment in WSL Ubuntu terminal" class="image--center mx-auto" width="1227" height="692" loading="lazy"></p>
<p>I will install ipykernel and jupyter in this new environment.</p>
<pre><code class="lang-bash">conda install jupyter ipykernel -y
</code></pre>
<p>Now, to install TensorFlow GPU, I will simply use the following command:</p>
<pre><code class="lang-bash">pip install tensorflow[and-cuda]
</code></pre>
<p>It might take a couple of minutes depending on the internet speed you have. Just have patience and wait for it to finish the installation.</p>
<h3 id="heading-check-tensorflow-gpu">Check TensorFlow GPU</h3>
<p>After installing TensorFlow GPU, we need to verify that it is working properly with GPU support. Open a Python shell in your Ubuntu terminal and run the following commands:</p>
<pre><code class="lang-bash">python3 -c <span class="hljs-string">"import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"</span>
</code></pre>
<p>If the output shows a list of available GPU devices, then TensorFlow GPU is successfully installed and working properly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095453933/ccda58fc-9ae9-4185-9c78-6196c98d8b7c.png" alt="Preview of TensorFlow GPU check in WSL Ubuntu terminal" width="1903" height="1029" loading="lazy"></p>
<h2 id="heading-pytorch-gpu">PyTorch GPU</h2>
<p>Now, we’re going to install PyTorch GPU in our conda environment. Make sure that you have activated the conda environment where you want to install it. I’m going to install it in my previously created ml environment. To activate it, I will use the following command:</p>
<pre><code class="lang-bash">conda activate ml
</code></pre>
<p>Installing PyTorch GPU is very straightforward. You can use the official PyTorch installation command generator <a target="_blank" href="https://pytorch.org/get-started/locally/">here</a>.</p>
<p>Make sure to select PyTorch Build as the latest Stable one, Your OS as Linux, Package as Pip, Language as Python. For the Compute Platform, select the CUDA version that matches your installed CUDA Toolkit. For me, it is CUDA 12.3. But, if you can not find the exact one then choose the closest. As CUDA 12.3 is not available for me now, I am choosing CUDA 12.6.</p>
<p>After selecting those, it will give you the installation command. You have to apply it in your WSL Ubuntu terminal.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095511862/6f631369-c8db-4681-9d1c-669ad88df69d.png" alt="Preview of PyTorch installation command generator" class="image--center mx-auto" width="1618" height="911" loading="lazy"></p>
<p>It might take a couple of minutes depending on the internet speed you have. Just have patience and wait for it to finish the installation.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095532246/56232263-36ea-4043-9881-df162965c514.png" alt="Preview of PyTorch GPU installation in WSL Ubuntu terminal" class="image--center mx-auto" width="1280" height="689" loading="lazy"></p>
<h3 id="heading-check-pytorch-gpu">Check PyTorch GPU</h3>
<p>After installing PyTorch GPU, verify that it is working properly with GPU support. Open a Python shell in your Ubuntu terminal and run the following commands:</p>
<pre><code class="lang-bash">python3 - &lt;&lt; <span class="hljs-string">'EOF'</span>
import torch
<span class="hljs-built_in">print</span>(torch.cuda.is_available())
<span class="hljs-built_in">print</span>(torch.cuda.device_count())
<span class="hljs-built_in">print</span>(torch.cuda.current_device())
<span class="hljs-built_in">print</span>(torch.cuda.device(0))
<span class="hljs-built_in">print</span>(torch.cuda.get_device_name(0))
EOF
</code></pre>
<p>The output should look similar to the screenshot, showing:</p>
<ul>
<li><p><strong>True</strong>: GPU is available for PyTorch</p>
</li>
<li><p><strong>1</strong>: Number of detected CUDA devices</p>
</li>
<li><p><strong>0</strong>: Index of the current active CUDA device</p>
</li>
<li><p>A device object representation</p>
</li>
<li><p><strong>NVIDIA GeForce RTX 3060</strong> (or your GPU name)</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095584921/69269152-7ea6-404b-b1ca-8534b51f2491.png" alt="Preview of PyTorch GPU check in WSL Ubuntu terminal" class="image--center mx-auto" width="1917" height="937" loading="lazy"></p>
<h3 id="heading-check-pytorch-amp-tensorflow-gpu-inside-jupyter-notebook">Check PyTorch &amp; TensorFlow GPU inside Jupyter Notebook</h3>
<p>Now that the environment is fully configured, we will verify GPU support directly inside Jupyter Notebook. This ensures both PyTorch and TensorFlow can successfully detect and use your GPU.</p>
<h4 id="heading-1-test-pytorch-gpu">1. Test PyTorch GPU</h4>
<p>Create a new Jupyter Notebook and run the following commands one by one:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> torch

print(torch.cuda.is_available())
print(torch.cuda.device_count())
print(torch.cuda.current_device())
print(torch.cuda.device(<span class="hljs-number">0</span>))
print(torch.cuda.get_device_name(<span class="hljs-number">0</span>))
</code></pre>
<p>If everything is configured correctly, you will see your GPU (for example <strong>NVIDIA GeForce RTX 3060</strong>) detected properly:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095624229/f94c97a0-2e44-45ad-a2a8-52f40c922482.png" alt="Preview of PyTorch GPU check inside Jupyter Notebook" class="image--center mx-auto" width="1861" height="743" loading="lazy"></p>
<h4 id="heading-2-test-tensorflow-gpu">2. Test TensorFlow GPU</h4>
<p>Next, run the following code to check whether TensorFlow detects your GPU:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

print(tf.config.list_physical_devices(<span class="hljs-string">'GPU'</span>))
</code></pre>
<p>You can also check the number of GPUs detected:</p>
<pre><code class="lang-python">print(<span class="hljs-string">"Num GPUs Available:"</span>, len(tf.config.list_physical_devices(<span class="hljs-string">'GPU'</span>)))
</code></pre>
<p>Finally, run TensorFlow’s built-in GPU validation (warnings are normal):</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-keyword">assert</span> tf.test.is_gpu_available()
<span class="hljs-keyword">assert</span> tf.test.is_built_with_cuda()
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764095666216/f9017979-b5c9-4b86-9f60-d9aaa2fe8ac1.png" alt="TensorFlow GPU initialization and CUDA validation output" class="image--center mx-auto" width="1638" height="935" loading="lazy"></p>
<p>If TensorFlow logs show your GPU model (such as <strong>RTX 3060</strong>), then TensorFlow GPU is successfully installed and fully working inside Jupyter Notebook.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Thank you so much for reading all the way through. I hope you have been able to configure your Windows 11 computer properly for running almost any kind of Machine Learning-based experiments.</p>
<p>To get more content like this, you can follow me on <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a> and <a target="_blank" href="https://x.com/Fahim_FBA">X</a>. You can also check <a target="_blank" href="https://www.fahimbinamin.com/">my website</a> and follow me on <a target="_blank" href="https://github.com/FahimFBA">GitHub</a> if you are into open source and development.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Free Up and Automatically Manage Disk Space for WSL on Windows 10/11 ]]>
                </title>
                <description>
                    <![CDATA[ Windows Subsystem for Linux (WSL) lets you run a Linux environment directly on Windows. This is particularly useful for web development where you can develop and test applications in a Linux environme ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-free-up-and-automatically-manage-disk-space-for-wsl-on-windows-1011/</link>
                <guid isPermaLink="false">6893e671640b08f689368ee6</guid>
                
                    <category>
                        <![CDATA[ WSL ]]>
                    </category>
                
                    <category>
                        <![CDATA[ wsl2 ]]>
                    </category>
                
                    <category>
                        <![CDATA[ disk management ]]>
                    </category>
                
                    <category>
                        <![CDATA[ disk ]]>
                    </category>
                
                    <category>
                        <![CDATA[ disk space ]]>
                    </category>
                
                    <category>
                        <![CDATA[ automation ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Powershell ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows 10 ]]>
                    </category>
                
                    <category>
                        <![CDATA[ windows 11 ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ brooklyn ]]>
                </dc:creator>
                <pubDate>Wed, 06 Aug 2025 23:34:09 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1754523230294/70893973-fddf-42a9-b41a-2a8f94a47e22.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Windows Subsystem for Linux (<a href="https://learn.microsoft.com/en-us/windows/wsl/install">WSL</a>) lets you run a Linux environment directly on Windows. This is particularly useful for web development where you can develop and test applications in a Linux environment without leaving Windows. You can even run <a href="https://contribute.freecodecamp.org/how-to-setup-wsl/">freeCodeCamp locally</a> with it!</p>
<p>But managing disk space can be a quite a challenge, as WSL uses virtual hard disks that do not automatically free up unused space.</p>
<p>This tutorial will guide you through the process of manually compacting your WSL virtual hard disks. We’ll automate this task using a PowerShell script, ensuring that your WSL environment remains efficient and clutter-free.</p>
<h2 id="heading-reclaim-your-space">Reclaim Your Space</h2>
<p>WSL uses a virtualization platform to install Linux distributions on your Windows system. Each distribution you add gets its own Virtual Hard Disk (VHD), which uses the ext4 file system (common in Linux). It’s saved on your Windows drive as an ext4.vhdx file.</p>
<p>Key issues here:</p>
<ul>
<li><p>Inefficient storage: by default, VHD files <strong>do not reclaim</strong> unused space. This means that when you delete a file in WSL, the associated disk space isn’t immediately freed up.</p>
</li>
<li><p>Disk space consumption: due to that inefficient storage, the <strong>VHD files can grow large</strong> thanks to that accumulated data, especially if you’re a WSL heavy user.</p>
</li>
<li><p>Need for maintenance: you may not know that you need to <strong>compact</strong> your VHD files in order to reclaim disk space.</p>
</li>
</ul>
<p>If you notice that your free disk space is shrinking even after deleting files and apps, WSL might be the reason. This tutorial will help you keep your WSL and Windows environment running smoothly.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a href="#heading-part-1-how-to-manually-compact-your-virtual-hard-disk">Part 1: How to Manually Compact Your Virtual Hard Disk</a></p>
<ul>
<li><p><a href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a href="#heading-step-1-verify-your-wsl-version-and-status">Step 1: Verify your WSL version and status</a></p>
</li>
<li><p><a href="#heading-step-2-list-all-installed-distributions-verbosely">Step 2: List all installed distributions verbosely</a></p>
</li>
<li><p><a href="#heading-step-3-locate-your-linux-virtual-hard-drive-vhdx-path">Step 3: Locate your linux Virtual Hard Drive (VHDX) path</a></p>
</li>
<li><p><a href="#heading-step-4-shut-down-all-wsl-instances">Step 4: Shut down all WSL instances</a></p>
</li>
<li><p><a href="#heading-step-5-compact-the-linux-virtual-hard-drive-using-diskpart">Step 5: Compact the Linux virtual hard drive using DiskPart</a></p>
</li>
<li><p><a href="#heading-step-6-restart-wsl-and-verify">Step 6: Restart WSL and verify</a></p>
</li>
</ul>
</li>
<li><p><a href="#heading-part-2-how-to-make-your-life-easier-with-automation">Part 2: How to Make Your Life Easier with Automation</a></p>
<ul>
<li><p><a href="#heading-prerequisites-1">Prerequisites</a></p>
</li>
<li><p><a href="#heading-step-1-find-out-installed-wsl2-distributions">Step 1: Find out installed WSL2 distributions</a></p>
</li>
<li><p><a href="#heading-step-2-select-a-distro-to-compact">Step 2: Select a distro to compact</a></p>
</li>
<li><p><a href="#heading-step-3-locate-the-ext4vhdx-file">Step 3: Locate the ext4.vhdx File</a></p>
</li>
<li><p><a href="#heading-step-4-the-confirmation-prompt">Step 4: The confirmation prompt</a></p>
</li>
<li><p><a href="#heading-step-5-shut-down-wsl-and-compact">Step 5: Shut Down WSL and compact</a></p>
</li>
<li><p><a href="#heading-step-6-run-a-diskpart-script">Step 6: Run a DiskPart script</a></p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-part-1-how-to-manually-compact-your-virtual-hard-disk"><strong>Part 1: How to Manually Compact Your Virtual Hard Disk</strong></h2>
<p>Let's start by going through the process manually. This section will guide you through checking your WSL version and associated Linux distributions, finding VHD files, shutting down WSL, and compacting the virtual disk.</p>
<h3 id="heading-prerequisites"><strong>Prerequisites</strong></h3>
<ul>
<li><p>Windows 10 (20H1/2004+) or Windows 11 with WSL2 installed</p>
</li>
<li><p>The PowerShell or Command Prompt running as <strong>Administrator</strong> (from the Windows menu, right click the icon and choose run as Administrator).</p>
</li>
</ul>
<h3 id="heading-step-1-verify-your-wsl-version-and-status"><strong>Step 1: Verify your WSL version and status</strong></h3>
<p>First, make sure you’re running on WSL version 2 (commonly referred as WSL2). The first version is outdated and WSL2 provides significant improvements. Open PowerShell (as Admin) or Command Prompt (as Admin) and run:</p>
<pre><code class="language-powershell">wsl -v

wsl --status
</code></pre>
<p>These commands display the WSL client version and whether your default distro is using WSL 2. Here’s the output of the <code>wsl -v</code> command:</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754250376279/ef11af4b-ba5b-43f9-9532-db2634eed154.png" alt="Command prompt displaying WSL version 2.5.9.0, with corrupted or incomplete text following &quot;Kernel version:&quot;, &quot;WSLg version:&quot;, and other version labels." width="421" height="143" loading="lazy">

<p>And here’s the output of the <code>wsl --status</code> command.</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754250364365/6cea2d97-0796-4320-8f84-58d1b5e62c5e.png" alt="Command line text showing &quot;C:sers>wsl --status&quot; with the information &quot;Default Distribution: Ubuntu&quot; and &quot;Default Version: 2&quot;." width="243" height="71" loading="lazy">

<h3 id="heading-step-2-list-all-installed-distributions-verbosely"><strong>Step 2: List all installed distributions verbosely</strong></h3>
<p>To see a detailed list of your WSL distributions (including which version each uses), run:</p>
<pre><code class="language-powershell">wsl.exe --list --verbose
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754250281542/1826814a-5516-483e-b8ab-6477fd950e21.png" alt="Output of  the WSL --list --verbose command." width="302" height="67" loading="lazy">

<p>Above you can see the output of the WSL <code>--list --verbose</code> command.</p>
<p>Look for your distro name (for example, “<em>Ubuntu</em>”) and note its WSL version. If it shows “Version 2”, you can proceed with compaction.</p>
<h3 id="heading-step-3-locate-your-linux-virtual-hard-drive-vhdx-path"><strong>Step 3: Locate your linux Virtual Hard Drive (VHDX) path</strong></h3>
<p>Each WSL distro’s files live in a <a href="https://en.wikipedia.org/wiki/VHD_(file_format)">VHDX file</a> on your Windows drive. To find the path for any Linux distribution, use this PowerShell snippet:</p>
<pre><code class="language-powershell">(Get-ChildItem `

-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss `

| Where-Object { $_.GetValue("DistributionName") -eq 'YOUR_DISTRO_NAME' }

).GetValue("BasePath") + "\ext4.vhdx"
</code></pre>
<p>Where you replace <code>YOUR_DISTRO_NAME</code> with yours (Ubuntu, Debian, Kali-linux..). Here’s the output of the command shown above in PowerShell (the filepath has been anonymized):</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754251303855/ea3b3880-5804-4f50-97c8-327ffd017084.png" alt="A PowerShell command is displayed, used to locate the ext4.vhdx file for the Ubuntu distribution. The command retrieves the Windows Subsystem for Linux (WSL) base path for Ubuntu." width="616" height="74" loading="lazy">

<p>This command reads the registry key for your linux distribution, then appends “\ext4.vhdx” to build the full file path.</p>
<p>Make sure you copy the whole line. We will need it in later stages.</p>
<h3 id="heading-step-4-shut-down-all-wsl-instances"><strong>Step 4: Shut down all WSL instances</strong></h3>
<p>Before you can compact any virtual drive, make sure WSL is completely shut down. In PowerShell or Command Prompt (still as Administrator), run:</p>
<pre><code class="language-powershell">wsl.exe --shutdown
</code></pre>
<h3 id="heading-step-5-compact-the-linux-virtual-hard-drive-using-diskpart"><strong>Step 5: Compact the Linux virtual hard drive using DiskPart</strong></h3>
<p>You successfully gathered all the needed information (about your system, the available distros, and their VHDX filepath) to proceed with the main task. In this step, you actually proceed with the compaction.</p>
<ol>
<li>Launch DiskPart in the same elevated (<em>admin</em>) shell:</li>
</ol>
<pre><code class="language-powershell">diskpart
</code></pre>
<p>DiskPart will open in a new window. It's a Windows command-line tool for managing disk partitions. Be cautious when using it, as incorrect actions can cause serious data loss.</p>
<ol>
<li>In the DiskPart prompt, select the VHDX file you found earlier. Replace the path as displayed below with your actual path (the line you copied before):</li>
</ol>
<pre><code class="language-powershell">select vdisk file="C:\Users\username\AppData\path\to\ext4.vhdx"
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754251748072/91795798-0896-4fcc-994c-0ab311955bee.png" alt="Screenshot of a command prompt window showing Microsoft DiskPart version information. A command is entered to select a virtual disk file, and a message confirms successful selection." width="920" height="150" loading="lazy">

<p>The above is the output of the select vdisk command (some data has been anonymized).</p>
<ol>
<li>Attach the virtual drive in read-only mode:</li>
</ol>
<p>Compaction only needs to scan the empty blocks in the file, not write to the Linux filesystem inside. Read-only mode guarantees that DiskPart only inspect the blocks for zero‐trimming without any chance of damaging or altering your Linux filesystem.</p>
<pre><code class="language-powershell">attach vdisk readonly
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754251937734/a90af720-1511-42cc-bc37-63439d855907.png" alt="Command prompt showing the output for &quot;DISKPART> attach vdisk readonly&quot; with a successful attachment message." width="462" height="107" loading="lazy">

<p>You can see in the screenshot above that the virtual hard drive has been successfully attached.</p>
<ol>
<li>Compact the disk:</li>
</ol>
<p>This frees up the disk space by shrinking the physical size of the <code>.vhdx</code> file to match the <strong>actual used data</strong> inside.</p>
<pre><code class="language-powershell">compact vdisk
</code></pre>
<p>This operation might take a while. When you see the <code>“DiskPart successfully compacted the virtual disk file”</code> message, proceed with the next step. In the image below, the virtual hard drive has been successfully compacted.</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754252148605/51cc9739-775b-4a84-a526-7c2a6d2a9722.png" alt="Terminal output showing &quot;DISKPART> compact vdisk&quot; with &quot;100 percent completed,&quot; indicating successful compaction of the virtual disk file." width="450" height="96" loading="lazy">

<ol>
<li>Detach the virtual drive:</li>
</ol>
<pre><code class="language-powershell">detach vdisk
</code></pre>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754252460797/e29387d7-4f03-4ddb-80f7-f14a5051b0fe.png" alt="Command prompt showing &quot;DISKPART> detach vdisk&quot; and a confirmation message that DiskPart successfully detached the virtual disk file." width="446" height="72" loading="lazy">

<p>There you go – the virtual hard drive has been successfully detached.</p>
<p>This command releases any locks on the virtual drive and effectively dismounts it. If you don't use this command, the file remains "in use," preventing WSL (or you) from accessing it until you reboot or manually force it closed.</p>
<p>6. Exit DiskPart:</p>
<pre><code class="language-powershell">exit
</code></pre>
<h3 id="heading-step-6-restart-wsl-and-verify"><strong>Step 6: Restart WSL and verify</strong></h3>
<p>Back in PowerShell or Command Prompt, you can relaunch your distro:</p>
<pre><code class="language-powershell">wsl -d YOUR_DISTRO_NAME
</code></pre>
<p>You can even try the Unix <code>df -h</code> command in your WSL prompt to check your new available disk spaces.</p>
<p>Congrats, you just achieved a maintenance task that can free up lots of gigabytes of storage over time. Now, it’s time to automate.</p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754321783829/4325a626-806e-47e7-9147-a76f4c91a93a.jpeg" alt="A minimalistic white rectangular button with a cable on a pink surface." style="display:block;margin:0 auto" width="640" height="360" loading="lazy">

<h2 id="heading-part-2-how-to-make-your-life-easier-with-automation"><strong>Part 2: How to Make Your Life Easier with Automation</strong></h2>
<p>Since it's often hard to remember exactly where your WSL distro is located and you probably won't use it very often, this PowerShell script will automate the entire process we covered in part 1. Here's a preview of the steps you'll follow:</p>
<ul>
<li><p>Detect installed WSL distributions.</p>
</li>
<li><p>Select one (and handle the cases there are more than one).</p>
</li>
<li><p>Locate the corresponding <code>ext4.vhdx</code> file.</p>
</li>
<li><p>Shut down WSL and use DiskPart to compact the virtual disk.</p>
</li>
</ul>
<h3 id="heading-prerequisites"><strong>Prerequisites</strong></h3>
<ul>
<li><p>Windows 10 (20H1/2004+) or Windows 11 with WSL 2 enabled.</p>
</li>
<li><p>PowerShell or Command Prompt (as Administrator).</p>
</li>
</ul>
<p>You’ll also need a code editor. The Windows notepad is enough for completing this task. You can also use an IDE (Integrated Development Environment) like VS Code or an ISE (Integrated Scripting Environment) like PowerShell ISE (included with Windows).</p>
<p>To test the script, download it from <a href="https://github.com/hyperphantasia/WSL-VHDX-Compact/blob/c5c2e346ab0dd1a8dbc6130f8d372af8022ddd60/wsl_compactor.ps1">GitHub</a>. Open an elevated PowerShell or Command Prompt and navigate to the script’s folder. With just the command below, you will be able to run it and free up some disk space:</p>
<pre><code class="language-powershell">powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\wsl_compactor.ps1
</code></pre>
<h3 id="heading-step-1-find-out-installed-wsl2-distributions"><strong>Step 1: Find out installed WSL2 distributions</strong></h3>
<p>One of the main challenges is to find the Linux distributions available on the host system. Let’s check the first block and see what’s it about:</p>
<pre><code class="language-powershell">$lxssKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss'
\(distros = Get-ChildItem \)lxssKey | ForEach-Object {
    \(p = Get-ItemProperty \)_.PSPath
    [PSCustomObject]@{
        Name     = $p.DistributionName
        BasePath = $p.BasePath
    }
}
</code></pre>
<p>WSL records each distribution under this windows registry key:</p>
<p><code>HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss</code></p>
<p>Each subkey has two important values:</p>
<ul>
<li><p><strong>DistributionName</strong> (for example, Ubuntu)</p>
</li>
<li><p><strong>BasePath</strong> (This is where the distribution files are stored. It’s the directory that contains the <code>ext4.vhdx</code> file.)</p>
</li>
</ul>
<p>The script uses <code>Get-ChildItem</code> and <code>Get-ItemProperty</code> to enumerate these subkeys and build a list of available Linux distributions.</p>
<pre><code class="language-powershell">if ($distros.Count -eq 0) {
Throw-And-Exit "No WSL distros found in the registry."
}
</code></pre>
<p>If no distributions are found, the script terminates and prints this error message on the terminal: <code>"No WSL distros found in the registry.”</code></p>
<h3 id="heading-step-2-select-a-distro-to-compact"><strong>Step 2: Select a distro to compact</strong></h3>
<p>Here, the process has two steps:</p>
<ul>
<li>If multiple distros are found, it displays all the distros with a numbered menu and prompts you to choose one:</li>
</ul>
<pre><code class="language-powershell">if ($distros.Count -gt 1) {
    Write-Host "Multiple distros detected. Please choose one:`n"

    for (\(i = 0; \)i -lt \(distros.Count; \)i++) {
        Write-Host "[\((\)i+1)] \((\)distros[$i].Name)"
    }
    \(selected = \)distros[[int]$choice - 1]
}
</code></pre>
<p>The computed menu will look like this:</p>
<pre><code class="language-markdown">Multiple distros detected. Please choose one:

[1] Ubuntu 20.04

[2] Debian

[3] Alpine
</code></pre>
<ul>
<li>If only one distribution is found on the host system, the script selects it automatically:</li>
</ul>
<pre><code class="language-powershell">else {
\(selected = \)distros[0]
}
</code></pre>
<p>When setting up a distribution, whether chosen manually by the user or selected automatically, <strong>the important information is the path to each distribution's virtual hard disk</strong>. This path is saved in two main variables: <code>'distro'</code> (which identifies the specific distribution) and <code>'basePath'</code> (which shows where its virtual disk is located).</p>
<pre><code class="language-powershell">\(distro = \)selected.Name
\(basePath = \)selected.BasePath

Write-Host "`nSelected distro: $distro" -ForegroundColor DarkYellow
Write-Host "BasePath: $basePath"
</code></pre>
<p>The lines above display an output that looks like this:</p>
<pre><code class="language-markdown">Selected distro: Ubuntu (or any other distro)
BasePath: C:\Users\&lt;User_name&gt;\AppData\Local\Packages\…
</code></pre>
<p>Like for all other steps, it’s important to consider the case of something going wrong, by throwing an error and exiting the program:</p>
<pre><code class="language-powershell">if (-not (Test-Path $basePath)) {
Throw-And-Exit "BasePath '$basePath' does not exist on disk."
}
</code></pre>
<h3 id="heading-step-3-locate-the-ext4vhdx-file"><strong>Step 3: Locate the ext4.vhdx File</strong></h3>
<p>In the first step, we collected the information we need about the available distributions and where they are stored on the Windows system. By choosing an entry (either manually or automatically), we can find the correct file. Sometimes, the ext4 file is located between the base path and a <em>LocalState</em> folder. This script manages both situations. It builds the usual locations where the file can be found.</p>
<p>They look like this:</p>
<ul>
<li><p><code>$BasePath\ext4.vhdx</code></p>
</li>
<li><p><code>$BasePath\LocalState\ext4.vhdx</code></p>
</li>
</ul>
<p>This can translate into something like this on your system (option 1):</p>
<pre><code class="language-markdown">C:\Users\Alice\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\ext4.vhdx
</code></pre>
<p>or like this (option 2):</p>
<pre><code class="language-markdown">C:\Users\Alice\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
</code></pre>
<p>(You might find out that your WSL2 distro is located in some other directory than “Packages” – but don’t worry, your BasePath will match the correct folders).</p>
<p>The idea is to build the two possible path options:</p>
<pre><code class="language-powershell">$possible = @(
Join-Path $basePath 'ext4.vhdx'
Join-Path $basePath 'LocalState\ext4.vhdx'
)
</code></pre>
<p>And pick the first one that actually contains the file:</p>
<pre><code class="language-powershell">\(vhdx = \)possible | Where-Object { Test-Path $_ } | Select-Object -First 1
</code></pre>
<p>Again, we throw an error message if no suitable file is found:</p>
<pre><code class="language-powershell">if (-not $vhdx) {
Throw-And-Exit "No ext4.vhdx found under '$basePath'."
}
</code></pre>
<h3 id="heading-step-4-the-confirmation-prompt"><strong>Step 4: The confirmation prompt</strong></h3>
<p>Disk management tools require caution and you need to understand the potential consequences of your actions. A confirmation prompt is always a good safeguard to prevent accidental data loss or unwanted system changes.</p>
<p>Before proceeding, the script shows you:</p>
<ul>
<li><p>a Distro name</p>
</li>
<li><p>its BasePath</p>
</li>
<li><p>the VHDX file path</p>
</li>
</ul>
<pre><code class="language-powershell">Write-Host "`nAbout to compact this WSL distro:" -ForegroundColor Magenta
Write-Host " Distro : $distro"
Write-Host " BasePath : $basePath"
Write-Host " VHDX file: $vhdx`n"
</code></pre>
<p>It then prompts <strong>“Are you sure you want to proceed? (Y/N)”:</strong></p>
<pre><code class="language-powershell">Write-Host "Are you sure you want to proceed? (Y/N) " -ForegroundColor DarkCyan -NoNewline

# Then read the response
$answer = Read-Host
</code></pre>
<p>You’re then prompted to Type Y (case-insensitive) to continue or anything else to cancel.</p>
<pre><code class="language-powershell">if ($answer.ToUpper() -ne 'Y') {
    Write-Warning "Operation canceled"
    exit
}
</code></pre>
<p>For the two steps above, I had to use a trick to print the question in color but a simple option (without colors) could be:</p>
<pre><code class="language-powershell">if ((Read-Host 'Are you sure you want to proceed? (Y/N)').ToUpper() -ne 'Y') { 
    Write-Warning 'Operation canceled'
    exit 
}
</code></pre>
<h3 id="heading-step-5-shut-down-wsl-and-compact"><strong>Step 5: Shut down WSL and compact</strong></h3>
<p>Before proceeding to the DiskPart utility, it’s important to stop all running WSL instances. Pass the shutdown command directly in PowerShell.</p>
<pre><code class="language-powershell">Write-Host "Shutting down WSL…" -ForegroundColor Cyan
wsl.exe –shutdown
</code></pre>
<p>A common mistake is to forget to launch PowerShell or the Command Prompt with Administrator rights. You can prevent this case with a message:</p>
<pre><code class="language-powershell">if ($LASTEXITCODE -ne 0) {
     Throw-And-Exit "Failed to shut down WSL (exit code $LASTEXITCODE). Are you running as Administrator?"
}
</code></pre>
<h3 id="heading-step-6-run-a-diskpart-script"><strong>Step 6: Run a DiskPart script</strong></h3>
<h4 id="heading-building-the-script">Building the script:</h4>
<p>The process is the same as in the manual part, but this time, we ‘inject’ the ready-to-go DiskPart commands into the script.</p>
<pre><code class="language-powershell">$dpScript = @"
select vdisk file="$vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit
"@
</code></pre>
<p>Before launching, there are two steps you need to take:</p>
<ol>
<li>The PowerShell script writes the lines above to a temporary file:</li>
</ol>
<pre><code class="language-powershell">$tempFile = [IO.Path]::GetTempFileName()
Set-Content -LiteralPath \(tempFile -Value \)dpScript -Encoding ASCII
</code></pre>
<p>This is the equivalent to the commands passed in the manual part:</p>
<p><code>select vdisk file="</code><a href="/home/C:/"><code>C:\</code></a><code>…\ext4.vhdx" # full path to the vdisk file</code></p>
<p><code>attach vdisk readonly</code></p>
<p><code>compact vdisk</code></p>
<p><code>detach vdisk</code></p>
<p><code>exit</code></p>
<ol>
<li>Compacting can take a while, especially if you’ve never de-cluttered your virtual drive before. It’s wise to show a warning before proceeding:</li>
</ol>
<pre><code class="language-powershell">Write-Host "Running DiskPart to compact the VHDX. Be patient, this might take a while..." -ForegroundColor Cyan
</code></pre>
<h4 id="heading-invoke-diskpart"><strong>Invoke DiskPart:</strong></h4>
<pre><code class="language-powershell"># Run DiskPart with the script saved to the temporary file and process each output line as it arrives
diskpart /s $tempFile | ForEach-Object {
    # Grab any "NN percent" type message from the line
    if ($_ -match '(\d+)\s+percent') {
        # Only print when the percentage actually changes
        Write-Host "\((\)Matches[1])% completed"
    }
    else {
        # Just echo all over line-types, verbatim
        Write-Host $_
    }
}
</code></pre>
<p>Several points to note here:</p>
<ul>
<li><p>It runs <code>diskpart /s $tempFile</code>: DiskPart reads and executes commands from the temporary file into the PowerShell loop for on-the-fly processing.</p>
</li>
<li><p>For a better user-experience: the snippet below does the trick of filtering out repeated status values by comparing <code>\(pct</code> with the sentinel <code>\)lastPct</code>, and only writing new lines when they differ.</p>
</li>
</ul>
<p>How?</p>
<p>Before entering the loop, we initialize:</p>
<pre><code class="language-powershell">$lastPct with -1
$lastPct = -1 # We initiate a sentinel value
</code></pre>
<p>We are having a guaranteed “first” value that no real percent (0–100) will equal. That way, as soon as you see the first 0 percent, 10 percent, or whatever, it differs from -1.</p>
<p>Then:</p>
<pre><code class="language-powershell">if ($_ -match '(\d+)\s+percent') {
    # Print only when the percentage changes
    Write-Host "\((\)Matches[1])% completed"
}
</code></pre>
<p>This guarantees that on the very first percentage update (say “0 percent” or “10 percent”), <code>\(pct –ne \)lastPct</code> will be <code>true</code>, so it emits the first line. Afterwards, <code>$lastPct</code> holds the last real percentage, and it only prints again when a new, different progress percentage comes in.</p>
<p>The output looks more clean:</p>
<pre><code class="language-markdown">10% completed
20% completed
…
</code></pre>
<p>Otherwise, it’ll flood the screen with dozens of identical “20 percent completed” (for example) updates.</p>
<p>Of course we handle the case of other values (non percent lines) normally:</p>
<pre><code class="language-powershell">else {
    # non-percent lines: print verbatim
    if ($_ -match '\S') {
        Write-Host $_
    }
}
</code></pre>
<p>Once the process is done, don’t forget to clean up the tempfile.</p>
<pre><code class="language-powershell">Remove-Item $tempFile -ErrorAction SilentlyContinue
</code></pre>
<p>By the end of the process, you should see something like this</p>
<pre><code class="language-markdown">Leaving DiskPart...
</code></pre>
<p>Okay, that’s it for the scripting! If you collected all the snippets so far, just save them with a <code>.ps1</code> file extension, or download the full example from this <a href="https://github.com/hyperphantasia/WSL-VHDX-Compact">GitHub repository</a>.</p>
<h3 id="heading-usage"><strong>Usage:</strong></h3>
<p>You now have a complete understanding of what's happening. Ready to get started? In Windows, open the Command Prompt or PowerShell <strong>as an administrator.</strong></p>
<ul>
<li><p>Navigate to the directory containing your <code>.ps1</code>&nbsp;script.</p>
</li>
<li><p>Execute the script with the following command, replacing <code>&lt;File_name_here&gt;</code> with your actual file name:</p>
</li>
</ul>
<pre><code class="language-powershell">powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\&lt;File_name_here&gt;.ps1
</code></pre>
<p>The <code>-NoProfile -ExecutionPolicy Bypass</code> parameters launch PowerShell in a clean, unrestricted environment that ignores user-specific settings and allows script execution without security restrictions. Don’t worry, in this case, it’s okay to do that.</p>
<p><em>Wait…wait…wait...</em></p>
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754315563256/a709192a-6626-4a12-b411-46c8591c5eb6.jpeg" alt="Screenshot of a command line interface showing the execution of a PowerShell script to compact a WSL (Windows Subsystem for Linux) distro. The script confirms the selected distro &quot;Ubuntu&quot; and proceeds to compact the VHDX file using DiskPart. Progress is shown in percentage increments, with final messages indicating successful completion of the compacting process." style="display:block;margin:0 auto" width="878" height="500" loading="lazy">

<p>Well bravo! You’ve just reclaimed all that unused space inside your WSL2 (almost) hands free!</p>
<p>Now, you can take it a step further by modifying this script to run completely automatically, without the confirmation prompt (step 4). You can also schedule it as a regular maintenance task using a task scheduler:</p>
<pre><code class="language-powershell">schtasks /create /tn "Schedule_name" /tr "powershell.exe -ExecutionPolicy Bypass -File C:\path\to\script.ps1" /sc monthly /d 15 /st 09:00
</code></pre>
<p>This is an example for a monthly execution where <code>/d 15</code> means 15th of each month and <code>/st 09:00</code> is a start time set at 9 am.</p>
<p>That's it! Remember, regular maintenance, whether you do it manually or automatically, is essential to prevent unnecessary disk space usage and ensure a smooth experience with WSL.</p>
<h3 id="heading-thanks-for-reading">Thanks for reading!</h3>
<p>You can find a list of my current projects on <a href="https://github.com/hyperphantasia?tab=repositories">GitHub</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Run LaTeX Projects Locally (for Free) On Windows ]]>
                </title>
                <description>
                    <![CDATA[ LaTeX is a high-quality typesetting system that is widely used in technical, academic, and scientific writing. It’s very popular in academia, especially in fields like mathematics, physics, computer science, and engineering. LaTeX is not a word proce... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-run-latex-projects-locally-for-free-on-windows/</link>
                <guid isPermaLink="false">67bde54468de46f577ed25f8</guid>
                
                    <category>
                        <![CDATA[ latex ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ research ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Md. Fahim Bin Amin ]]>
                </dc:creator>
                <pubDate>Tue, 25 Feb 2025 15:44:04 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1740494599916/ce7cfadb-985c-4245-9cc8-1ccba483ba69.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>LaTeX is a high-quality typesetting system that is widely used in technical, academic, and scientific writing. It’s very popular in academia, especially in fields like mathematics, physics, computer science, and engineering.</p>
<p>LaTeX is not a word processor like Microsoft Word – rather, it’s a document preparation system that allows you to focus on the content of your writing while it handles the formatting. If you use LaTeX to write your formal documents (like a CV, résumé, or research paper), then you don’t need to worry about the formatting and structure, as everything can be done using LaTeX scripts.</p>
<p>If you use LaTeX to write your academic or research papers, you might be familiar with website-based applications like <a target="_blank" href="https://www.overleaf.com/">Overleaf</a>. Overleaf is a website that allows anyone to read, write, and compile LaTeX scripts online.</p>
<p>These sites are okay for small tasks or compilations, or if you need only a little bit of free collaboration. But if you need to work on bigger projects or need to conduct many collaborative tasks, then the free tier may be insufficient. And in my opinion, the paid subscription costs too much.</p>
<p>But don’t worry: running LaTeX locally may be the perfect solution for you. I know this because I also faced a similar situation, and this simply changed my life! I also keep all of the tracks in Git (GitHub, GitLab, and so on) along with unlimited collaboration opportunities and compilation. And the great thing is, all of these are completely free as it’s all happening on my local machine.</p>
<p>So in this article, I am going to discuss the methods in detail. I have also created an in-depth video for you to understand how this works.</p>
<h3 id="heading-video-tutorial">Video Tutorial</h3>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/A45lWrndVHA" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<h2 id="heading-resources-youll-need">Resources You’ll Need:</h2>
<h3 id="heading-1-github-repository">1. GitHub Repository</h3>
<p>This entire guide is available in one of my GitHub projects named <a target="_blank" href="https://github.com/FahimFBA/Install-LaTeX">Install-LaTeX</a>. The live website is available <a target="_blank" href="https://fahimfba.github.io/install-latex/">here</a> (<a target="_blank" href="https://fahimfba.github.io/Install-LaTeX/">fahimfba.github.io/Install-LaTeX</a>) as well. I would highly appreciate it if you star (⭐) the repository. Also, you can create issues <a target="_blank" href="https://github.com/FahimFBA/Install-LaTeX/issues">there</a> if you face any problems. Any kind of good contribution is also welcome here.</p>
<h3 id="heading-2-operating-system">2. Operating System</h3>
<p>You can install LaTeX on any major operating system (Windows, MacOS, and Linux-based OSes). But in this article, I am only going to talk about the Windows operating system.</p>
<p>Here, I’m using the latest Windows 11 operating system, but the same procedure should be applicable to all of the Windows-based operating systems that are going to come out in the future. Windows 10 should also be okay too.</p>
<h3 id="heading-3-editor">3. Editor</h3>
<p>I am going to use the popular <a target="_blank" href="https://code.visualstudio.com/">Visual Studio Code</a> as my editor. It is a 100% free and robust editor that’s very popular among devs all over the world. If you don’t already have it, go ahead and install it before proceeding further.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972339481/729ecab1-b87e-43d6-baf5-dbda170bcefc.png" alt="VS Code" class="image--center mx-auto" width="1761" height="921" loading="lazy"></p>
<h3 id="heading-4-latex-compileride">4. LaTeX Compiler/IDE</h3>
<p>To work on LaTeX files, you’ll need a specific compiler. I am going to use <a target="_blank" href="https://miktex.org/">MikTeX</a>. There are other tools out there, but this is the best tool right now (according to me!). It is completely free and supports all major operating systems as well. It also has a built-in IDE, but we are going to use VS Code as our main editor.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972305065/8119b362-3c95-42a0-9458-be211d2ead35.png" alt="MiKTeX" class="image--center mx-auto" width="1631" height="905" loading="lazy"></p>
<p>Download the Windows executable file from the Download section.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972408494/71b39032-3adc-426e-8bd9-3a18dc454cf5.png" alt="Download MiKTeX" class="image--center mx-auto" width="1312" height="838" loading="lazy"></p>
<p>After the download is finished, install the executable. At the end of the installation, keep the tick in “Check for updates now”.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972492255/a59f7000-8137-46c5-89f1-4f7151a751b6.png" alt="Check for update" class="image--center mx-auto" width="524" height="403" loading="lazy"></p>
<p>You will find the MikTeX console in your taskbar. Open that.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972541856/e7bad89a-4920-4175-a361-ba8fb51f6b20.png" alt="MiKTeX console" class="image--center mx-auto" width="856" height="669" loading="lazy"></p>
<p>Go to the “Updates” tab and click “Update now”. It will install all of those packages.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972581283/6d585388-0218-4792-b78e-798c75dee6a6.png" alt="6d585388-0218-4792-b78e-798c75dee6a6" class="image--center mx-auto" width="821" height="645" loading="lazy"></p>
<p>At the end, it will prompt you to close the console. Click “OK”. Open MiKTeX again.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972610846/926b5aba-0a3a-4c80-a103-fef5a5aafc38.png" alt="926b5aba-0a3a-4c80-a103-fef5a5aafc38" class="image--center mx-auto" width="841" height="663" loading="lazy"></p>
<p>That’s it for this tool.</p>
<h3 id="heading-5-perl">5. Perl</h3>
<p>The commands we are going to execute for building the LaTeX files are dependent on Perl. As the Windows operating system doesn’t come with a built-in Perl compiler, we are going to install the <a target="_blank" href="https://strawberryperl.com/">Strawberry Perl</a>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972724660/7a6ad623-c2cc-45bd-bac6-08afdd5512c1.png" alt="Perl" class="image--center mx-auto" width="1902" height="897" loading="lazy"></p>
<p>Download the latest MSI package from it.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972749178/33c95897-37af-4be7-a24f-3520c3c1486e.png" alt="Download Strawberry perl" class="image--center mx-auto" width="1361" height="815" loading="lazy"></p>
<p>Install the executable after it gets finished downloading the application.</p>
<p>We need to add Perl’s path to the system environment. To do that, go into the location where it has been installed. By default, it gets installed inside <code>C:\Strawberry\perl\bin</code> directory. Copy the path.</p>
<p>Now search for “env” in the Windows search bar until you find something called “Edit the system environment variable”.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972898818/7cfdab3a-9ad0-47a7-b0ed-7721b589de97.png" alt="env" class="image--center mx-auto" width="810" height="678" loading="lazy"></p>
<p>Now click on “Environment Variables…”.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739972945973/832e011b-0841-4318-a9b8-8b7a8ae42819.png" alt="System Properties" class="image--center mx-auto" width="434" height="485" loading="lazy"></p>
<p>Now select “Path” from “System variables” and click “Edit”.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739973034756/df3d91f0-907e-42bf-9f1d-883172abd268.png" alt="System variables" class="image--center mx-auto" width="656" height="605" loading="lazy"></p>
<p>Click “New”. Paste the path. Now exit every windows sequentially by clicking on “OK” in each window.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739973087965/b73dd5e2-5c35-4399-a645-cb92ba43fe7b.png" alt="add var inside system path" class="image--center mx-auto" width="541" height="497" loading="lazy"></p>
<h2 id="heading-visual-code-studio-extensions">Visual Code Studio Extensions</h2>
<p>We need some extensions in VS Code to streamline our workflow.</p>
<p>First, let’s get <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop">LaTeX Workshop</a>. It is the core extension for working with LaTeX files inside VS Code Studio.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739973174197/2311c19b-d56e-4363-a3c0-75a9b0a323ee.png" alt="2311c19b-d56e-4363-a3c0-75a9b0a323ee" class="image--center mx-auto" width="791" height="518" loading="lazy"></p>
<p>Next, you’ll need <a target="_blank" href="https://marketplace.visualstudio.com/items?itemName=stkb.rewrap">Rewrap</a>. It is an amazing tool that lets you wrap longer lines. It helps you work in a long line in separate lines without breaking any structure or sentence.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739973216887/86bacaa6-77ff-441c-acca-08ee6a74d354.png" alt="86bacaa6-77ff-441c-acca-08ee6a74d354" class="image--center mx-auto" width="797" height="641" loading="lazy"></p>
<h2 id="heading-build-the-latex-file">Build the LaTeX File</h2>
<p>Whenever you want to build any LaTeX file inside VS Code studio, simply open that file in it. Then open the command palette using <code>Ctrl</code> + <code>Shift</code> + <code>P</code>.</p>
<p>Search for “LaTeX Workshop: Build with recipe” and go there. It will start building the file. Whenever it prompts you to install any missing package, untick the box that says “Always show this dialog” and press “Install”. I do this because clicking on “Install” on hundreds of prompt windows for building a LaTeX file is very difficult for me.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1739973393900/0ec3a626-38bb-4fbd-8f98-658cb6bc4853.png" alt="package installation" class="image--center mx-auto" width="516" height="371" loading="lazy"></p>
<p>After it finishes building the LaTeX file, you will get the output PDF file inside VS Code. You can open the PDF file directly in VS Code.</p>
<p>If you want to go into any specific line in the code from the output PDF file like Overleaf, simply click on that specific portion in the PDF by pressing the <code>Ctrl</code> key. It will immediately take you to the code part where it belongs.</p>
<p>That’s it! It’s now running on your local machine and there are no restrictions or limitation to it, literally! Also, for collaboration and keeping track of the history, using Git is the best option, like I do.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Thanks for reading this short tutorial. I hope it helped you interact more easily with LaTeX.</p>
<p>You can follow me on <a target="_blank" href="https://github.com/FahimFBA">GitHub</a>, <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>, and <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">You</a><a target="_blank" href="https://youtube.com/@FahimAmin">Tube</a> to get more content like this. Also, my <a target="_blank" href="https://www.fahimbinamin.com/">website</a> is always available for you!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Compress Files to ".gz" on the Windows Operating System ]]>
                </title>
                <description>
                    <![CDATA[ You may often need to compress files and folders for various reasons. And "Gzip" compression is a good choice for many scenarios.  Recently, I have faced an issue where I needed to compress a lot of files individually, and manual intervention to comp... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-convert-files-to-gzip-on-windows/</link>
                <guid isPermaLink="false">66b902c3558588891017dd82</guid>
                
                    <category>
                        <![CDATA[ compression ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Md. Fahim Bin Amin ]]>
                </dc:creator>
                <pubDate>Fri, 01 Mar 2024 19:15:53 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/freeCodeCamp---Fahim.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>You may often need to compress files and folders for various reasons. And "Gzip" compression is a good choice for many scenarios. </p>
<p>Recently, I have faced an issue where I needed to compress a lot of files individually, and manual intervention to compress each file one by one using traditional 7zip became a hassle.</p>
<p>If you are in love with the Windows operating system like I am (I know, I know, sometimes Windows can become quite a pain. Maybe I like the pain and also like to resolve issues all by myself, who knows!), then you may also face issues in batch processing compressing multiple files to the <code>.gzip</code> format.</p>
<p>There are multiple ways to compress a file into the <code>.gzip</code> format. The main issue is that most of the ways do not support batch processing the conversion. In this article, I will talk about two of the decent ways you can do this.</p>
<h2 id="heading-method-1-using-7zip-no-batch-processing">Method 1: Using 7zip (No Batch Processing)</h2>
<p><a target="_blank" href="https://www.7-zip.org/">7zip</a> is a free software available for Windows, Linux, and ARM64. Installing 7zip in the Windows operating system is very simple and straightforward.</p>
<p>If you simply want to compress any single file to <code>.gzip</code> format, you need to simply select that file and add it to the 7zip archive. In the GUI, you can select the Archive format as "gzip" and that's it!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/2024-02-21_12-36.png" alt="Image" width="600" height="400" loading="lazy">
<em>gzip in 7zip</em></p>
<h2 id="heading-method-2-using-gzip-from-chocolatey-batch-processing-is-the-main-benefit-of-this">Method 2: Using <code>gzip</code> from Chocolatey (Batch Processing is the Main Benefit of This)</h2>
<p>There are several tools that we can use to compress files and folders on our computers. However, Linux-based operating systems come with a lot of tools and there are a lot of CLI (Command Line Interface) type tools that we can also use to compress multiple files altogether in a batch. </p>
<p>If you use Linux based operating system, then you might have also used GZip. Gzip is a file format and software application that compresses and decompresses files. It also makes files smaller and allows for faster network transfers. However, there are not any official installers of GZip for the Windows operating system.</p>
<p>But, we can install "gzip" directly on Windows and work like we're in a Linux OS. I prefer to download GZip via <a target="_blank" href="https://chocolatey.org/">Chocolatey</a>, a very good package manager for the Windows operating system. </p>
<blockquote>
<p>Chocolatey is a machine-level, command-line package manager and installer for software on Microsoft Windows. It uses the NuGet packaging infrastructure and Windows PowerShell to simplify the process of downloading and installing software.</p>
</blockquote>
<p>If you are using Chocolatey for the first time, then you need to install it first. All of the methods are explained in detail on their official website: <a target="_blank" href="https://chocolatey.org/install">https://chocolatey.org/install</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/2024-02-21_12-48.png" alt="Image" width="600" height="400" loading="lazy">
<em>Chocolatey Installation</em></p>
<p>Open your Terminal and run the command for installing "gzip".</p>
<pre><code class="lang-powershell">choco install gzip
</code></pre>
<p>Write "Yes" when it asks for your permission. After a few seconds, you should be ready to use it.</p>
<p>Let's say I want to batch-compress a lot of files into ".gzip". I can open my terminal and go to that directory (where my raw files are that I want to compress using gzip) using the <code>cd path/to/where/I/have/the/files</code> command. </p>
<p>Or, I can simply open my terminal directly using the "Open In Terminal" context menu in that specific directory where I have the files that I want to compress using gzip. Then I can simply use the following command.</p>
<pre><code class="lang-powershell">gzip * <span class="hljs-literal">-r</span>
</code></pre>
<p>This will iterate through every folder and subfolder in that specific location and compress all of the files to <code>.gzip</code> recursively (the <code>-r</code> flag). Keep in mind that it will <strong>replace</strong> all your files to <code>.gzip</code> in that directory.</p>
<p><strong>But</strong>, if you also want to keep the original files side by side during the batch compression process, you can use the command below.</p>
<pre><code class="lang-bash">gzip * -r -k
</code></pre>
<p>Here, the <code>-k</code> flag indicates the <code>--keep</code> option to keep the original files.</p>
<p><strong>If</strong> you want to use all your CPU cores in parallel, then follow the command below.</p>
<pre><code class="lang-bash">parallel gzip ::: *
</code></pre>
<p>You have to add the necessary suffixes to suit your needs obviously in this process.</p>
<p>That's it!</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I hope you have gained some valuable insights from this article.</p>
<p>If you have enjoyed the procedures step-by-step, then don't forget to let me know on <a target="_blank" href="https://twitter.com/Fahim_FBA">Twitter/X</a> or <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>. I would appreciate it if you could endorse me for some relevant skillsets of mine on <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>.</p>
<p>You can follow me on <a target="_blank" href="https://github.com/FahimFBA">GitHub</a> as well if you are interested in open source. Make sure to check <a target="_blank" href="https://fahimbinamin.com/">my website</a> (<a target="_blank" href="https://fahimbinamin.com/">https://fahimbinamin.com/</a>) as well.</p>
<p>Thank you so much!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Install MySQL and MySQL Workbench on Windows ]]>
                </title>
                <description>
                    <![CDATA[ If you want to learn MySQL, starting with a good client is super helpful – especially when you are just beginning your journey. There are a lot of clients out there for your MySQL-based needs, like XAMPP, DataGrip, and others. Among all of them, I pr... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-install-mysql-workbench-on-windows/</link>
                <guid isPermaLink="false">66b902ea3639976bd84355b9</guid>
                
                    <category>
                        <![CDATA[ database ]]>
                    </category>
                
                    <category>
                        <![CDATA[ MySQL ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Md. Fahim Bin Amin ]]>
                </dc:creator>
                <pubDate>Fri, 30 Jun 2023 18:23:15 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/06/boitumelo-phetla-0DJHJcpwN9Q-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you want to learn MySQL, starting with a good client is super helpful – especially when you are just beginning your journey.</p>
<p>There are a lot of clients out there for your MySQL-based needs, like XAMPP, DataGrip, and others. Among all of them, I prefer the <a target="_blank" href="https://www.mysql.com/products/workbench/">MySQL Workbench</a>. It is completely free, by the way.</p>
<p>In this tutorial, I will show you how you can install and configure your Windows machine for this MySQL and MySQL workbench from scratch. </p>
<p>If you enjoy learning from videos as well, then don't worry as I have also created a step-by-step video just for you:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/kZf_h-Phfds" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<h2 id="heading-how-to-install-mysql-workbench">How to Install MySQL Workbench</h2>
<h4 id="heading-download-mysql-workbench">➡️ Download MySQL Workbench</h4>
<p>Make sure to visit only the <a target="_blank" href="https://www.mysql.com/products/workbench/">official website</a> for downloading the MySQL Workbench. You do not want to get into shoddy websites and download the wrong file that infects your favorite machine, right?</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-32.png" alt="Image" width="600" height="400" loading="lazy">
<em>Find the official website for MySQL Workbench: https://www.mysql.com/products/workbench/</em></p>
<p>Now click on the "DOWNLOADS" tab.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-32_1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Scroll down until you find <code>MySQL Community (GPL) Downloads »</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-32_2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Click on <code>MySQL Community (GPL) Downloads »</code>. After that, on the new page, click "MySQL installer for Windows".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-32_3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>From the dropdown menu, select your operating system as "Microsoft Windows". Then download the file which is larger in size.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-33.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>A <code>.msi</code> file will be downloaded. That is our installer file to install MySQL and MySQL workbench.</p>
<h4 id="heading-install-both-mysql-and-mysql-workbench">➡️ Install both MySQL and MySQL Workbench</h4>
<p>Simply double click on the installer file. It will reload the necessary components and open the installer GUI selection window. Choose the setup type as custom and click "Next".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-34_1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Select Custom</em></p>
<p>A new page will appear. Make sure to select the latest "MySQL Server", "MySQL Workbench" and "MySQL Shell". Selecting and clicking on the right side arrow will take the product name in the "Products to be installed section". Then click "Next".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-34-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Install necessary components</em></p>
<p>Click "Execute" to install the three necessary components. The process might take some time depending on your internet speed and computer configuration. After it gets finished, simply click "Next".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-35.png" alt="Image" width="600" height="400" loading="lazy">
<em>Execute</em></p>
<p>In the Product Configuration window, simply click "Next". It will install the three selected components for us.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-37.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next</em></p>
<p>Keep everything as it is and simply click "Next". It will configure the MySQL Server.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-37_1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next</em></p>
<p>Keep everything as it is and simply click "Next". It will apply the TCP/IP connectivity for our MySQL server.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-37_2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next</em></p>
<p>Now give it a Root password. For testing purposes, I am using a very simple "1111" as my password, but I would recommend not doing the same. Also, make sure to remember the password as you will need it when you want to work in MySQL Workbench. Click "Next".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-37_3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next</em></p>
<p>Keep everything as it is, and simply click "Next". It will make sure to setup our root password for the MySQL workbench.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-38.png" alt="Image" width="600" height="400" loading="lazy">
<em>Root password</em></p>
<p>We want to run the service as a Standard System Account for our operating system. Therefore, keep everything as it is, and simply click "Next".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-38_1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next</em></p>
<p>Select the option to grant full access to the user running the Windows Service and then click "Next."</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-38_2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next</em></p>
<p>Then click "Execute". This will grant the full access to the user running the Windows service and the administrator group only, but the other users and groups will not have its access. </p>
<p>So if you have multiple user accounts in your computer, then they will not be able to access the MySQL server/Workbench. If you want then you can change the settings here based on your need.</p>
<p>As I have only one user account in my Windows machine, I can safely keep the first option selected.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-38_3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Execute</em></p>
<p>It might take some time. Then when you will receive a green check box in all configuration steps, simply click "Finish".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-38_4.png" alt="Image" width="600" height="400" loading="lazy">
<em>Finish</em></p>
<p>The configuration has beep applied successfully. Simply click "Next".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-39.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next</em></p>
<p>Click "Finish" to complete the installation.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-39_1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Finish</em></p>
<p>It will open the MySQL Workbench and MySQL Shell. Simply close all of them now.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-39_1-L.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-configuration">➡️ Configuration</h2>
<p>Now we need to configure the path variables for our operating system. Go to the drive where you have installed your Windows operating system. Like others, I have also installed my operating system on the "C" drive. </p>
<p>Therefore, I am going to the "C" drive and opening the "Program Files" directory.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-40.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Go to the "MySQL" folder.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-40_1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Then go to the MySQL Server folder.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-40_2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Go to the "bin" folder.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-40_3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Copy the path/address. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-40_4.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now open the Environment Variables settings. Simply click on the Windows button and type "env". </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-40_5.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Click "Environment Variables".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-41.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Select the "Path" and click "Edit".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-41_1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Click "New". A new blank box will appear. Paste the path/address that you copied earlier. Do not close the window now as we need to do the same thing for the MySQL Shell folder.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-41_2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now, we need to do the same thing for the MySQL Shell also. Open the MySQL Shell folder now.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-41_3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Go to the "bin" folder.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-41_4.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Copy the path/directory.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-42.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now apply the same process as you did earlier. Click "New" on the Edit environment variable window. Paste the path/directory in the new blank box.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-42_1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now click "OK".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-42_2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Click "OK" again.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-42_3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>And click "OK" one more time.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-42_4.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-finishing-up">➡️ Finishing Up</h2>
<p>Our task is now finished. You can now open the MySQL Workbench.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-43.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Simply click on the Local instance. It will ask for the root password. Enter the password. If you do not want to go into the same hassle of entering a password every time, check the box on save password in the vault. Click "OK".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-43_1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This is your default MySQL Workbench workspace.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-43_2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Workbench workspace</em></p>
<p>If you want then you can also hide the SQL Additions tab by clicking on the colored box.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-43_3.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>For getting the Schemas, click on the "Schemas" tab from the navigator.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-43_4.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Your MySQL Workbench is also ready for any kind of development process. You can also use MySQL from your terminal as well.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_10-43_5.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/2023-06-28_11-32.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Thank you for reading the entire article.</p>
<p>If you have any questions, feel free to reach out to me using <a target="_blank" href="https://twitter.com/Fahim_FBA">Twitter</a> or <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>.</p>
<p>Also, make sure to follow me on <a target="_blank" href="https://github.com/FahimFBA">GitHub</a>!</p>
<p>You can also <a target="_blank" href="https://www.youtube.com/@FahimAmin?sub_confirmation=1">subscribe to my YouTube channel</a> for more helpful video content.</p>
<p>If you are interested then you can also check my website: <a target="_blank" href="https://fahimbinamin.com/">https://fahimbinamin.com/</a></p>
<p>Have a great day! 😊</p>
<p>Cover: Photo by <a target="_blank" href="https://unsplash.com/@writecodenow?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Boitumelo Phetla</a> on <a target="_blank" href="https://unsplash.com/photos/0DJHJcpwN9Q?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use Linux on a Windows Machine – 5 Different Approaches ]]>
                </title>
                <description>
                    <![CDATA[ As a developer, you might need to run both Linux and Windows side by side. Luckily, there are a number of ways you can get the best of both worlds without getting different computers for each operating system.  In this article, we'll explore a few wa... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/5-ways-to-use-linux-on-a-windows-machine/</link>
                <guid isPermaLink="false">66adea1ec537123a64ede7f8</guid>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ WSL ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Zaira Hira ]]>
                </dc:creator>
                <pubDate>Fri, 09 Jun 2023 15:03:52 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/06/5-ways-to-use-Linux-on-a-Windows-machine.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>As a developer, you might need to run both Linux and Windows side by side. Luckily, there are a number of ways you can get the best of both worlds without getting different computers for each operating system. </p>
<p>In this article, we'll explore a few ways to use Linux on a Windows machine. Some of them are browser-based or cloud-based that do not need any installation prior to using them.</p>
<p>Here are the methods we'll be discussing:</p>
<ul>
<li>Dual boot</li>
<li>Windows Subsystem for Linux (WSL)</li>
<li>Virtual Machines (VM)</li>
<li>Browser-based solutions</li>
<li>Cloud-based solutions</li>
</ul>
<h2 id="heading-option-1-dual-boot-linux-windows">Option 1: "Dual-boot" Linux + Windows</h2>
<p>With dual boot, you can install Linux alongside Windows on your computer, allowing you to choose which operating system to use at startup. </p>
<p>This requires partitioning your hard drive and installing Linux on a separate partition. With this approach, you can only use one operating system at a time.</p>
<p>If this sounds like the way you want to go, <a target="_blank" href="https://www.freecodecamp.org/news/how-to-dual-boot-windows-10-and-ubuntu-linux-dual-booting-tutorial/">here is a useful tutorial</a> on setting up dual boot on Windows 10.</p>
<h2 id="heading-option-2-use-windows-subsystem-for-linux-wsl">Option 2: Use Windows Subsystem for Linux (WSL)</h2>
<p>Windows Subsystem for Linux provides a compatibility layer that lets you run Linux binary executables natively on Windows.</p>
<p>Using WSL has some advantages:</p>
<ul>
<li>The setup for WSL is simple and not time consuming.</li>
<li>It is lightweight compared to VMs where you have to allocate resources from the host machine.</li>
<li>You don't need to install any ISO or virtual disc image for Linux machines which tend to be heavy files.</li>
<li>You can use Windows and Linux side by side.</li>
</ul>
<p>If this sounds like the right option for you, <a target="_blank" href="https://www.freecodecamp.org/news/how-to-install-wsl2-windows-subsystem-for-linux-2-on-windows-10/">here is a detailed guide</a> on how to install and use WSL.</p>
<h2 id="heading-option-3-use-a-virtual-machine-vm">Option 3: Use a Virtual Machine (VM)</h2>
<p>A virtual machine (VM) is a software emulation of a physical computer system. It allows you to run multiple operating systems and applications on a single physical machine simultaneously. Here's a detailed explanation of VMs:</p>
<p>You can use virtualization software such as Oracle VirtualBox or VMware to create a virtual machine running Linux within your Windows environment. This allows you to run Linux as a guest operating system alongside Windows.</p>
<p>VM software provides options to allocate and manage hardware resources for each VM, including CPU cores, memory, disk space, and network bandwidth. You can adjust these allocations based on the requirements of the guest operating systems and applications.</p>
<p>Here are some of the options available for virtualization:</p>
<ul>
<li><a target="_blank" href="https://www.virtualbox.org/">Oracle virtual box</a></li>
<li><a target="_blank" href="https://multipass.run/">Multipass</a></li>
<li><a target="_blank" href="https://www.vmware.com/content/vmware/vmware-published-sites/us/products/workstation-player.html.html">VMware workstation player</a></li>
</ul>
<h2 id="heading-option-4-use-a-browser-based-solution">Option 4: Use a Browser-based Solution</h2>
<p>Browser based solutions are particularly useful for quick testing, learning, or accessing Linux environments from devices that don't have Linux installed.</p>
<p>You can either use online code editors or web based terminals to access Linux. Note that you usually don't have full administration privileges in these cases. </p>
<h3 id="heading-online-code-editors">Online code editors</h3>
<p>Online code editors offer editors with built-in Linux terminals. While their primary purpose is coding, you can also utilize the Linux terminal to execute commands and perform tasks.</p>
<p><a target="_blank" href="https://replit.com/">Replit</a> is an example of an online code editor, where you can write your code and access the Linux shell at the same time.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/replit.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Replit provides a code editor and a Linux shell.</em></p>
<h3 id="heading-web-based-linux-terminals">Web-based Linux terminals</h3>
<p>Online Linux terminals allow you to access a Linux command-line interface directly from your browser. These terminals provide a web-based interface to a Linux shell, enabling you to execute commands and work with Linux utilities. </p>
<p>One such example is <a target="_blank" href="https://jslinux.org/">JSLinux</a>. The screenshot below shows a ready to use Linux environment:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/jslinux.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Accessing Linux via JSLinux</em></p>
<h2 id="heading-option-5-use-a-cloud-based-solution">Option 5: Use a Cloud-based Solution</h2>
<p>Instead of running Linux directly on your Windows machine, you can consider using cloud-based Linux environments or virtual private servers (VPS) to access and work with Linux remotely. </p>
<p>Services like Amazon EC2, Microsoft Azure, or DigitalOcean provide Linux instances that you can connect to from your Windows computer. Note that some of these services offer free tiers, but they are not usually free in the long run.</p>
<h2 id="heading-how-to-choose-the-correct-method">How to Choose the Correct Method</h2>
<p>The choice is totally dependent on your use case. But there are some factors that may help you decide which option works the best for you. Let's discuss them:</p>
<ul>
<li>Access level/elevated privilege: If you require full administrative privileges, it is better to skip the browser-based solutions. WSL, dual booting, VMs, and cloud-based solutions provide you with full administrative control.</li>
<li>Cost: Cloud-based solutions offer services against a subscription fee. This cost varies depending on the choice of operating system, hardware specs of the machine, traffic, and so on. If you are on a tight budget, cloud-based solutions might not be the best.</li>
<li>Scalability: If you are just starting, but plan to do resource exhaustive development in the future, you can always scale up the physical specs of your machine. Some options that support upgrading are cloud-based solutions and VMs. You can add more processors or increase the RAM as per your needs.</li>
<li>Current system's hardware specs: If your current system has lower RAM and storage, running VMs can make the system heavy. It would be better to opt for cloud-based or browser based solutions.</li>
<li>Switching: If you don't plan to use Windows and Linux side by side, dual-boot can be a really good option. It offers a complete and focused Linux experience.</li>
</ul>
<h2 id="heading-my-setup">My Setup</h2>
<p>I am using Ubuntu VM installed through VMWare workstation player. It is doing a great job as I can frequently switch between two operating systems. It was also simple to setup and I can enjoy the admin privileges as well!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/06/my-set.gif" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>I hope you found this article helpful. What’s your favorite thing you learned from this tutorial? I would love to connect with you on any of these <a target="_blank" href="https://zaira_.bio.link/">platforms</a>. 📧</p>
<p>See you in the next tutorial, happy coding 😁</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Setup a Windows Machine for Machine Learning/Deep Learning Using an Nvidia Graphics Card (CUDA) ]]>
                </title>
                <description>
                    <![CDATA[ If you are learning machine learning / deep learning, you may be using the free Google Colab. But you might wonder if the free version is adequate.  If you can afford a good Nvidia Graphics Card (with a decent amount of CUDA cores) then you can easil... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-setup-windows-machine-for-ml-dl-using-nvidia-graphics-card-cuda/</link>
                <guid isPermaLink="false">66b90301dd7c39d8be3aeb5d</guid>
                
                    <category>
                        <![CDATA[ Deep Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ WSL ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Md. Fahim Bin Amin ]]>
                </dc:creator>
                <pubDate>Tue, 30 May 2023 14:58:31 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/05/arseny-togulev-MECKPoKJYjM-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you are learning machine learning / deep learning, you may be using the free <a target="_blank" href="https://colab.research.google.com/">Google Colab</a>. But you might wonder if the free version is adequate. </p>
<p>If you can afford a good Nvidia Graphics Card (with a decent amount of CUDA cores) then you can easily use your graphics card for this type of intensive work. </p>
<p>A lot of developers use Linux for this. But, I do not like Linux as a desktop operating system (do not get offended, as it is my personal preference. And yes, Linux is the best for server-related stuff). </p>
<p>Also, if you own the latest Nvidia GPU, then you're probably already familiar with the hassle regarding the graphics driver and so on.</p>
<p>For all these reasons, I was thinking about trying something different: utilizing the new Windows 11 operating system to use the CUDA cores from my Graphics Card. </p>
<p>I followed a lot of videos but couldn't implement it after trying many times, unfortunately. There was some gap in the latest version of PyTorch with the Windows 11 kernel in CUDA. Still, after researching a lot, I have found out that WSL2 should work just fine.</p>
<p>After trying for more than a few days, I have successfully managed to set up everything necessary and can use my graphics card's CUDA cores in my Windows machine! An interesting thing is, in this process, you do not need to download or use Microsoft Visual Studio 2022 and download huge 30/35GB files just to install the recommended compilers and so on.</p>
<p>Because of this, I wrote a complete handbook on my GitHub (here's the repo: <a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu">CUDA-WSL2-Ubuntu</a>, and here's the website: <a target="_blank" href="https://fahimfba.github.io/CUDA-WSL2-Ubuntu">fahimfba.github.io/CUDA-WSL2-Ubuntu</a>).</p>
<p>I am writing the same handbook here as well. So, here we go! 🎉</p>
<h2 id="heading-my-computer-specification">My Computer Specification</h2>
<p>For this guide, I have used my Desktop workstation. If you are also interested in the current specification that I used for this task, here you go:</p>
<ul>
<li>Processor: Ryzen 5 3500X 6 Core and 6 Threads</li>
<li>RAM: 32GB DDR4 3200MHz (16 GB + 8 GB + 8 GB)</li>
<li>GPU: Zotac Nvidia GeForce RTX 3050 8GB GDDR6</li>
<li>Motherboard: Gigabyte B450M Aorus Elite</li>
<li>Storage: Gigabyte 240GB SATA SSD</li>
<li>Monitor: MSI Optix G24 Gaming Curved 75Hz</li>
</ul>
<p>I will be using Windows 11 Pro (Version 22H2) and WSL2 (of course!).</p>
<h2 id="heading-step-1-make-sure-you-have-solid-internet-and-electricity">Step 1: Make Sure You Have Solid Internet and Electricity</h2>
<p>This whole process can take a lot of time. So make sure you're properly connected to the internet and have consistent electricity. For me, it took almost 7 hours in total. You will also need to download some pretty huge packages along the way. </p>
<p>Also, make sure that you have installed the latest Nvidia driver after downloading the official driver from <a target="_blank" href="https://www.nvidia.com/download/index.aspx">the official website of Nvidia</a>. Make sure that you have installed all the updates of your Windows 11.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/win_update.png" alt="Image" width="600" height="400" loading="lazy">
<em>windows update</em></p>
<h2 id="heading-step-2-download-latest-powershell">St<strong>ep 2: Download Latest PowerShell</strong></h2>
<p>I will be using the latest PowerShell. You can download that from the Microsoft store, but I will download it from the official website as the store might create some problems later. </p>
<p>Go to <a target="_blank" href="https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows">the official website</a>. This normally redirects you to the latest version of PowerShell available at that moment. For me, the latest version is 7.3 (24 May 2023). For you, it might be the updated version. Don't worry about that. Simply download the latest stable version.</p>
<ol>
<li>Click on the <strong>Download PowerShell</strong> button.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/1-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Download Powershell button</em></p>
<ol start="2">
<li>Find the latest PowerShell of <code>win-x64.msi</code>. Download that.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/2-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>latest PowerShell msi file</em></p>
<ol start="3">
<li>The installation process is pretty straightforward. But I will be guiding you throughout the entire process. Double click on the downloaded file. Then click <code>Next</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/3-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>msi software</em></p>
<ol start="4">
<li>Keep everything as it is and click <code>Next</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/4-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next step</em></p>
<ol start="5">
<li>I still prefer to keep everything as it is and simply click <code>Next</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/5-4.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next step</em></p>
<ol start="6">
<li>I still prefer to keep everything as it is and simply click <code>Next</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/6-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Next step</em></p>
<ol start="7">
<li>Click <code>Install</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/7-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Install</em></p>
<ol start="8">
<li>Now click <code>Finish</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/8-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Finish</em></p>
<h2 id="heading-step-3-check-your-windows-terminal">Step 3: Check Your Windows Terminal</h2>
<p>I really like the Windows Terminal, as I can simply switch to any other WSL OSes (Ubuntu, Kali, Git Bash, and so on) whenever I want. But before proceeding further, I have to make sure that my current Windows Terminal is the updated one.</p>
<ol>
<li>Open the <strong>Microsoft Store</strong> and search for <code>Windows Terminal</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/9-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Windows Terminal on Microsoft Store</em></p>
<ol start="2">
<li><p>Click on <code>Update</code> if it needs an update.</p>
</li>
<li><p>Make sure that you are on the latest updated Windows Terminal already.</p>
</li>
<li><p>Now open the Windows Terminal, because we have to change some settings first. Click on <code>Open Settings</code>.</p>
</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/10-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Windows Terminal Settings Customization</em></p>
<ol start="5">
<li>If you do not see the <code>Open Settings</code> prompt, then simply click the drop-down arrow, and click on <code>Settings</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/11-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Settings</em></p>
<ol start="6">
<li>From <code>Startup</code>, make sure that the <strong>Default profile</strong> is set on <code>PowerShell</code> (the new PowerShell we installed in Step 2). The <code>Default terminal application</code> should be set on <code>Windows Terminal</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/12-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Default startup config</em></p>
<ol start="7">
<li>Then click <code>Save</code> and exit the terminal.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/13-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Save</em></p>
<h2 id="heading-step-4-hardware-virtualization">Step 4: Hardware Virtualization</h2>
<p>In order to use WSL, we have to make sure that our CPU virtualization is enabled. You can check the status through your task manager. If it is disabled, then make sure to enable the virtualization through BIOS. </p>
<p>You will find a lot of YouTube videos about this, but make sure that you are following the correct one that matches your motherboard brand and model.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/14-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Virtualization</em></p>
<h2 id="heading-step-5-install-wsl-and-ubuntu-lts">Step 5: Install WSL and Ubuntu LTS</h2>
<p>Now we need to install the WSL2 and Ubuntu LTS.</p>
<ol>
<li>Open the Windows Terminal as an <strong>Administrator</strong>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/15-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Open terminal as an administrator</em></p>
<ol start="2">
<li>For installing <strong>WSL</strong>, use the command <code>wsl --install</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/16-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>VMP install</em></p>
<ol start="3">
<li>Then, it would automatically install the latest LTS version of Ubuntu.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/18-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Ubuntu install</em></p>
<ol start="4">
<li>After the tasks get finished, it will prompt you for rebooting your PC. Save other work and simply restart your computer.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/19-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Reboot PC</em></p>
<ol start="5">
<li>After restarting the PC, it would automatically open the terminal and ask you for the username and password for your Linux OS.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/20-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>After rebooting PC</em></p>
<ol start="6">
<li>Give the Username and Password. Make sure to use the same Password on Retype Password!</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/21-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>username and password</em></p>
<ol start="7">
<li>After a while, it will install the necessary components.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/22-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Complete Ubuntu</em></p>
<ol start="8">
<li>Now, make sure that <strong>WSL2</strong> becomes the default WSL in this terminal. Apply the command, <code>wsl --set-default-version 2</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/23-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>WSL 2 default</em></p>
<ol start="9">
<li>If you want to check the WSL OSes status (how many OSes are available, how many of them are running or stopped), use the command, <code>wsl --list --verbose</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/24-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>OSes status</em></p>
<p>Here, it is telling me that I have <strong>Ubuntu</strong> installed on my WSL version 2 and it is currently stopped.</p>
<ol start="10">
<li>However, after working on a WSL OS, if you want to shut down the OS, then you can use the command <code>wsl -t distro_name</code>. For me, it is Ubuntu, so I used <code>wsl -t Ubuntu</code>. <code>t</code> represents the <strong>termination</strong> command here.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/25-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Terminate command</em></p>
<ol start="11">
<li>If you have multiple OSes in WSL, and if you want to run any specific distribution, then use the command <code>wsl --distribution distribution_name</code>. For example, if I want to run Ubuntu specifically, the command would be <code>wsl --distribution Ubuntu</code>. If you only have one distribution, then you do not necessarily need to worry about this at all.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/26-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>run specific distro</em></p>
<ol start="12">
<li>You can simply use <code>exit</code> to exit a distro from the terminal. It might not necessarily shut down the distribution. You can specifically use the termination command for that. But some regularly used commands are here.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/27-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>regularly used command</em></p>
<ol start="13">
<li>After installing a distribution, you would also be able to see and go there by using the drop-down menu from the Windows Terminal.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/28-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>the drop-down menu for other distributions</em></p>
<h2 id="heading-step-6-configure-ubuntu-lts">Step 6: Configure Ubuntu LTS</h2>
<p>We need to update and install some apps now.</p>
<ol>
<li>Open Ubuntu by using any method inside the Windows Terminal. You can obviously use the dedicated <strong>Ubuntu App</strong>. But I always prefer the Terminal as I can use multiple different distributions and command line applications here altogether.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/29.png" alt="Image" width="600" height="400" loading="lazy">
<em>start Ubuntu</em></p>
<ol start="2">
<li>Update the system by using the command <code>sudo apt update</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/30.png" alt="Image" width="600" height="400" loading="lazy">
<em>update</em></p>
<ol start="3">
<li><p>If you get errors in updating/upgrading saying it can't reach the server then change the nameserver with the command <code>echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf &gt; /dev/null</code>.</p>
</li>
<li><p>After updating, upgrade the system using <code>sudo apt upgrade</code>.</p>
</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/31.png" alt="Image" width="600" height="400" loading="lazy">
<em>Upgrade</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/32.png" alt="Image" width="600" height="400" loading="lazy">
<em>Upgrade system</em></p>
<p>You can clear the terminal by using the <code>clear</code> command.</p>
<ol start="5">
<li>CUDA works with C. So we need to install the gcc compiler first. Use the command <code>sudo apt install gcc --fix-missing</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/33.png" alt="Image" width="600" height="400" loading="lazy">
<em>gcc</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/34.png" alt="Image" width="600" height="400" loading="lazy">
<em>gcc installing</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/35.png" alt="Image" width="600" height="400" loading="lazy">
<em>finishing installation</em></p>
<h2 id="heading-step-7-install-cuda">Step 7: Install CUDA</h2>
<p>Now it is time to install CUDA from the <a target="_blank" href="https://developer.nvidia.com/cuda-downloads">official website of Nvidia</a>.</p>
<p>Make sure to select the following:</p>
<ul>
<li><strong>Operating System</strong>: Linux <br></li>
<li><strong>Architecture</strong>: x86_64 <br></li>
<li><strong>Distribution</strong>: WSL-Ubuntu <br></li>
<li><strong>Version</strong>: 2.0 <br></li>
<li><strong>Installer Type</strong>: deb(local) <br> </li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/36.png" alt="Image" width="600" height="400" loading="lazy">
<em>Nvidia - CUDA</em></p>
<p>This will provide the necessary commands.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/37.png" alt="Image" width="600" height="400" loading="lazy">
<em>commands CUDA</em></p>
<p>Now your task is to apply each command serially in the WSL Ubuntu terminal. Make sure to use the first command twice. It normally resolves the problem of keyring later.</p>
<p>Also, keep in mind that these commands might get changed later. So always follow the official website. For this guideline, I will be using the exact command I used to set up the CUDA in my machine.</p>
<ol>
<li><code>wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/38.png" alt="Image" width="600" height="400" loading="lazy">
<em>1st command</em></p>
<p>I used the same command again after finishing the previous transactions.</p>
<ol start="2">
<li><code>wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/39.png" alt="Image" width="600" height="400" loading="lazy">
<em>1st command</em></p>
<ol start="3">
<li><code>sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/40.png" alt="Image" width="600" height="400" loading="lazy">
<em>2nd Command</em></p>
<ol start="4">
<li><code>wget https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda-repo-wsl-ubuntu-12-1-local_12.1.1-1_amd64.deb</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/41.png" alt="Image" width="600" height="400" loading="lazy">
<em>3rd command</em></p>
<p>This normally takes a lot of time as it downloads a large file (above 2GB file size).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/42.png" alt="Image" width="600" height="400" loading="lazy">
<em>large file</em></p>
<ol start="5">
<li><code>sudo dpkg -i cuda-repo-wsl-ubuntu-12-1-local_12.1.1-1_amd64.deb</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/43.png" alt="Image" width="600" height="400" loading="lazy">
<em>4th command</em></p>
<ol start="6">
<li><code>sudo cp /var/cuda-repo-wsl-ubuntu-12-1-local/cuda-*-keyring.gpg /usr/share/keyrings/</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/44.png" alt="Image" width="600" height="400" loading="lazy">
<em>5th command</em></p>
<ol start="7">
<li>Then update the system using <code>sudo apt-get update</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/45.png" alt="Image" width="600" height="400" loading="lazy">
<em>update system</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/46.png" alt="Image" width="600" height="400" loading="lazy">
<em>updating</em></p>
<ol start="8">
<li><code>sudo apt-get -y install cuda</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/47.png" alt="Image" width="600" height="400" loading="lazy">
<em>install CUDA</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/48.png" alt="Image" width="600" height="400" loading="lazy">
<em>finish CUDA installation</em></p>
<h2 id="heading-step-8-post-installation">Step 8: Post Installation</h2>
<p>The <a target="_blank" href="https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html">official CUDA installation guide from Nvidia</a> tells us to add <code>export PATH=/usr/local/cuda-12.1/bin${PATH:+:${PATH}}</code> to the <strong>PATH</strong> variable.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/49.png" alt="Image" width="600" height="400" loading="lazy">
<em>path</em></p>
<p>I have changed the CUDA version <code>cuda-12.1</code> according to my installed CUDA version. Make sure to do the same for your updated CUDA version.</p>
<p>Do the following to do that:</p>
<ol>
<li>Open Ubuntu in the Windows Terminal.</li>
<li>Go to the root directory using <code>cd ~</code>. Then open the <code>bashrc</code> in nano using <code>nano .bashrc</code></li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/50.png" alt="Image" width="600" height="400" loading="lazy">
<em>root</em></p>
<ol start="3">
<li>Go to the end of the file and copy-paste the path there. For me, the path is <code>export PATH=/usr/local/cuda-12.1/bin${PATH:+:${PATH}}</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/51.png" alt="Image" width="600" height="400" loading="lazy">
<em>path</em></p>
<p>Then use <code>Ctrl</code> + <code>X</code> to close. Make sure to use <code>Y</code> to save in the same file.</p>
<ol start="4">
<li>To apply the changes, use <code>source ~/.bashrc</code>. You can check the path using <code>echo $PATH</code>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/52.png" alt="Image" width="600" height="400" loading="lazy">
<em>path check</em></p>
<h2 id="heading-step-9-nvidia-cuda-toolkit">Step 9: Nvidia CUDA Toolkit</h2>
<p>Install the Nvidia Cuda Toolkit using <code>sudo apt install nvidia-cuda-toolkit</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/53.png" alt="Image" width="600" height="400" loading="lazy">
<em>toolkit 1</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/54.png" alt="Image" width="600" height="400" loading="lazy">
<em>toolkit 2</em></p>
<p>You can check the Driver and CUDA versions using <code>nvidia-smi</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/55.png" alt="Image" width="600" height="400" loading="lazy">
<em>smi</em></p>
<p>Also, make sure to check whether the Nvidia Cuda Compiler Driver has been installed or not by using <code>nvcc -V</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/56.png" alt="Image" width="600" height="400" loading="lazy">
<em>nvcc</em></p>
<h2 id="heading-step-9-confirm-that-python-is-installed">Step 9: Confirm that Python is Installed</h2>
<p>Now, make sure that you have Python 3 installed in your system. You can check the version using <code>python3 --version</code>. If that says that "python3 is not found" or something like that, then install Python.</p>
<p>Install <strong>PIP</strong> using <code>sudo apt-get install python3-pip</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/57.png" alt="Image" width="600" height="400" loading="lazy">
<em>pip install</em></p>
<h2 id="heading-step-10-install-pytorch">Step 10: Install PyTorch</h2>
<p>For installing PyTorch, go to <a target="_blank" href="https://pytorch.org/get-started/locally/">the official website of PyTorch</a>. Then make sure to select the relevant sections. After that, it will provide you with a command. You have to use the command in your Ubuntu terminal.</p>
<p>For me, the selections were:</p>
<ul>
<li>PyTorch Build: Stable (2.0.1) - Make sure to select the latest stable version always</li>
<li>Your OS: Linux</li>
<li>Package: Pip</li>
<li>Language: Python</li>
<li>Computer Platform: CUDA 11.8 - Make sure to select the latest available CUDA version</li>
</ul>
<p>After that, I got the command <code>pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/58.png" alt="Image" width="600" height="400" loading="lazy">
<em>PyTorch command</em></p>
<p>I simply used that exact command in my Ubuntu terminal.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/59.png" alt="Image" width="600" height="400" loading="lazy">
<em>PyTorch command</em></p>
<p>It also downloads a large file that can take a lot of time if you have a slower internet connection like I do!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/60.png" alt="Image" width="600" height="400" loading="lazy">
<em>PyTorch download</em></p>
<h2 id="heading-step-11-cuda-availability">Step 11: CUDA Availability</h2>
<p>You can directly check whether your CUDA has been installed or not by running two lines of Python code in the terminal.</p>
<ul>
<li>Run Python in the terminal using <code>python3</code>.</li>
<li>Import torch using <code>import torch</code>.</li>
<li>Check the CUDA availability using <code>torch.cuda.is_available()</code>.</li>
</ul>
<p>If it returns <code>True</code>, then you have successfully finished installing CUDA on your system!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/61.png" alt="Image" width="600" height="400" loading="lazy">
<em>cuda yes</em></p>
<h2 id="heading-step-12-nvidia-developer-settings">Step 12: Nvidia Developer Settings</h2>
<p>You have to enable the Nvidia Developer Settings for using CUDA via WSL. Simply follow this process:</p>
<ol>
<li>Open the <strong>Nvidia Control Panel</strong>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/62.png" alt="Image" width="600" height="400" loading="lazy">
<em>Nvidia control panel</em></p>
<ol start="2">
<li>Click "Agree and Continue".</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/63.png" alt="Image" width="600" height="400" loading="lazy">
<em>agree</em></p>
<ol start="3">
<li>In the Nvidia Control Panel, Click Desktop &gt; Enable Developer Settings. If the "Enable Developer Settings" does not have any check mark, then click on that to enable that feature.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/64.png" alt="Image" width="600" height="400" loading="lazy">
<em>not check mark</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/65.png" alt="Image" width="600" height="400" loading="lazy">
<em>check mark</em></p>
<ol start="4">
<li>The <strong>Developer</strong> section will be visible. Click on <strong>Manage GPU Performance Counters</strong>.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/66.png" alt="Image" width="600" height="400" loading="lazy">
<em>GPU counters</em></p>
<ol start="5">
<li>Check the radio button on "Allow access to the GPU performance counters to all users".</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/67.png" alt="Image" width="600" height="400" loading="lazy">
<em>check</em></p>
<ol start="6">
<li>Click "Apply" and "Yes" to approve the changes permanently.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/68.png" alt="Image" width="600" height="400" loading="lazy">
<em>approve changes</em></p>
<ol start="7">
<li>At the end, it should look like this. </li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/69.png" alt="Image" width="600" height="400" loading="lazy">
<em>final</em></p>
<ol start="8">
<li>You can again check the CUDA availability like earlier.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/70.png" alt="Image" width="600" height="400" loading="lazy">
<em>cuda availability</em></p>
<h2 id="heading-step-12-install-jupyter-notebook">Step 12: Install Jupyter Notebook</h2>
<p>I normally prefer the Jupyter Notebook. You can install it in various ways, like <code>pip install notebook</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/71.png" alt="Image" width="600" height="400" loading="lazy">
<em>notebook 1</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/72.png" alt="Image" width="600" height="400" loading="lazy">
<em>notebook 2</em></p>
<p>But I prefer the command <code>pip install jupyter notebook</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/73.png" alt="Image" width="600" height="400" loading="lazy">
<em>jupyter notebook</em></p>
<p>To open a Jypyter Notebook, you can simply use <code>jupyter notebook</code> in the terminal.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/74.png" alt="Image" width="600" height="400" loading="lazy">
<em>notebook cli</em></p>
<p>The notebook will open instantly and you can use the given URL to open that in your web browser:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/75.png" alt="Image" width="600" height="400" loading="lazy">
<em>open the notebook in the browser</em></p>
<h2 id="heading-step-13-run-some-tests">Step 13: Run Some Tests</h2>
<p>I ran two codes to check the performance of my CUDA.</p>
<ol>
<li>Open a Python3 script in the notebook.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/76.png" alt="Image" width="600" height="400" loading="lazy">
<em>open script</em></p>
<ol start="2">
<li>I used the following code to check whether it is using my CPU or CUDA from my GPU:</li>
</ol>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">if</span> torch.cuda.is_available():
    device = torch.device(<span class="hljs-string">"cuda"</span>)
<span class="hljs-keyword">else</span>:
    device = torch.device(<span class="hljs-string">"cpu"</span>)
print(<span class="hljs-string">"using"</span>, device, <span class="hljs-string">"device"</span>)
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/77.png" alt="Image" width="600" height="400" loading="lazy">
<em>cuda</em></p>
<ol start="3">
<li>For the performance comparison between my CPU and GPU (CUDA), I used the following code:</li>
</ol>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> time

matrix_size = <span class="hljs-number">32</span>*<span class="hljs-number">512</span>

x = torch.randn(matrix_size, matrix_size)
y = torch.randn(matrix_size, matrix_size)

print(<span class="hljs-string">"************* CPU SPEED *******************"</span>)
start = time.time()
result = torch.matmul(x, y)
print(time.time() - start)
print(<span class="hljs-string">"verify device:"</span>, result.device)

x_gpu = x.to(device)
y_gpu = y.to(device)
torch.cuda.synchronize()

<span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(<span class="hljs-number">3</span>):
    print(<span class="hljs-string">"************* GPU SPEED *******************"</span>)
    start = time.time()
    result_gpu = torch.matmul(x_gpu, y_gpu)
    torch.cuda.synchronize()
    print(time.time() - start)
    print(<span class="hljs-string">"verify device:"</span>, result_gpu.device)
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/78.png" alt="Image" width="600" height="400" loading="lazy">
<em>CPU vs GPU</em></p>
<p>I also made side by side comparisons between the <a target="_blank" href="https://colab.research.google.com/">Google Colab</a> and my computer. You can check them as well.</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Try</td><td>Google Colab</td><td>My Computer</td></tr>
</thead>
<tbody>
<tr>
<td>1</td><td><a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu/blob/main/GoogleCollab1.ipynb">Google Colab</a></td><td><a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu/blob/main/CUDA%20_TEST_Fahim1.ipynb">My PC</a></td></tr>
<tr>
<td>2</td><td><a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu/blob/main/GoogleCollab2.ipynb">Google Colab</a></td><td><a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu/blob/main/CUDA%20_TEST_Fahim2.ipynb">My PC</a></td></tr>
</tbody>
</table>
</div><p>The result already states that my PC is working better than the Google Colab.</p>
<h2 id="heading-step-14-remove-the-cuda-deb-file">Step 14: Remove the CUDA Deb File</h2>
<p>If you think that you do not need the CUDA deb file anymore, then you can remove that using the following command:</p>
<pre><code class="lang-bash">rm filename
</code></pre>
<p>For me it was this:</p>
<pre><code class="lang-bash">rm cuda-repo-wsl-ubuntu-12-1-local_12.1.1-1_amd64.deb
</code></pre>
<p>It does not remove the CUDA from your system. It just removes the deb file from your system.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/05/79.png" alt="Image" width="600" height="400" loading="lazy">
<em>remove deb</em></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I hope that you have successfully installed CUDA on your Windows 11 system using WSL2. If you have any questions, feel free to reach out to me using <a target="_blank" href="https://twitter.com/Fahim_FBA">Twitter</a> or <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>.</p>
<p>Also, make sure to follow me on <a target="_blank" href="https://github.com/FahimFBA">GitHub</a> and star (⭐) the <a target="_blank" href="https://github.com/FahimFBA/CUDA-WSL2-Ubuntu">repository</a>!</p>
<p>You can also <a target="_blank" href="https://www.youtube.com/@FahimAmin?sub_confirmation=1">subscribe to my YouTube channel</a> for more helpful video content.</p>
<p>If you are interested then you can also check my website: <a target="_blank" href="https://fahimbinamin.com/">https://fahimbinamin.com/</a></p>
<p>Thank you for reading the entire article till now. Have a great day! 😊</p>
<p>Cover image: Photo by <a target="_blank" href="https://unsplash.com/@tetrakiss?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Arseny Togulev</a> on <a target="_blank" href="https://unsplash.com/photos/MECKPoKJYjM?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Enter "Safe Boot" On Windows Operating Systems ]]>
                </title>
                <description>
                    <![CDATA[ If you're using the Windows operating system, you might have heard the phrase "Rebooting to the safe boot" or something like that. In this tutorial, I'll explain what that means and how you can do it on your Windows machine. What is Safe Boot or Safe... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-enter-safe-boot-on-windows-operating-systems/</link>
                <guid isPermaLink="false">66b902d3d7a98b87028af89b</guid>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Md. Fahim Bin Amin ]]>
                </dc:creator>
                <pubDate>Mon, 28 Nov 2022 18:55:40 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/11/pexels-eduardo-dutra-2115217.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you're using the Windows operating system, you might have heard the phrase "Rebooting to the safe boot" or something like that.</p>
<p>In this tutorial, I'll explain what that means and how you can do it on your Windows machine.</p>
<h2 id="heading-what-is-safe-boot-or-safe-mode-for-windows">What is Safe Boot or Safe Mode for Windows?</h2>
<p>Safe Boot or Safe Mode starts the Windows operating system in an elementary state where it uses a minimal set of files and drivers. </p>
<p>You might want to reboot to the safe boot for many reasons, from identifying any software/driver-related problems to doing something safely which might not be possible in your default mode of Windows.</p>
<h2 id="heading-how-to-enable-safe-boot">How to Enable Safe Boot</h2>
<p>Firstly, you need to open the <strong>run</strong> program from your operating system. You can simply click on the search box from your taskbar, or you can also use the shortcut keys, <code>Windows Key</code> + <code>R</code>. </p>
<p>Then type <code>msconfig</code> and press the <strong>Enter</strong> key, or simply click <strong>OK</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--1-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>It will open the <strong>System Configuration</strong> window.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--2-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Simply go into the <strong>Boot</strong> section.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--3-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Check for the "Safe boot" option. You have to enable it. Simply check the box like in the image below:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--4-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Then you can just click "Apply", and then click "OK".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--5-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Make sure that you have saved all of your work because you need to restart your computer. Click "Restart". It will reboot your current operating system into safe mode.</p>
<h2 id="heading-how-to-disable-safe-boot">How to Disable Safe Boot</h2>
<p>After finishing your task on the safe boot, you'll want to disable the safe boot to continue your regular boot, right? </p>
<p>For that, we will follow all the processes mentioned above, but kind of in the reverse. Don't worry, as I am going to show you each step again.</p>
<p>Open the <strong>Run</strong> window again. I prefer the shortcut keys, <code>Windows Key</code> + <code>R</code>. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--6-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Type <code>msconfig</code> and click <strong>OK</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--7-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>It will open the <strong>System Configuration</strong> window once more. Go to the <strong>Boot</strong> section.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--8-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Make sure to uncheck the box for "Safe boot". Then click "Apply" and then click "OK".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/11/Screenshot--10-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Make sure that you have saved all of your tasks, and click "Restart". Your computer will be rebooted into the default mode once again.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Thanks for reading the entire article. If it helps you then you can also check out other articles of mine at <a target="_blank" href="https://www.freecodecamp.org/news/author/fahimbinamin/">freeCodeCamp</a>.</p>
<p>If you want to get in touch with me, then you can do so using <a target="_blank" href="https://twitter.com/Fahim_FBA">Twitter</a>, <a target="_blank" href="https://www.linkedin.com/in/fahimfba/">LinkedIn</a>, and <a target="_blank" href="https://github.com/FahimFBA">GitHub</a>. </p>
<p>You can also <a target="_blank" href="https://www.youtube.com/@FahimAmin?sub_confirmation=1">SUBSCRIBE to my YouTube channel</a> (Code With FahimFBA) if you want to learn various kinds of programming languages with a lot of practical examples regularly.</p>
<p>If you want to check out my highlights, then you can do so at my <a target="_blank" href="https://www.polywork.com/fahimbinamin">Polywork timeline</a>.</p>
<p>You can also <a target="_blank" href="https://fahimbinamin.com/">visit my website</a> to learn more about me and what I'm working on.</p>
<p>Thanks a bunch!</p>
<p><a target="_blank" href="https://www.pexels.com/photo/person-in-front-of-laptop-on-brown-wooden-table-2115217/">The cover image has been taken from pexels (by Eduardo Dutra).</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Build a Cross-Platform Application with Next.js and Tauri ]]>
                </title>
                <description>
                    <![CDATA[ Tauri is a new Rust-based framework that builds an x86_64 cross-platform application for Windows, macOS, and Linux.  In this tutorial, we'll use Tauri and Next.js to build a desktop-based cross-platform application and publish it to the Snap store an... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/build-a-cross-platform-app-with-next-and-tauri/</link>
                <guid isPermaLink="false">66d0389e15ea3036a9539968</guid>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                    <category>
                        <![CDATA[ macOS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Next.js ]]>
                    </category>
                
                    <category>
                        <![CDATA[ node ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Rust ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Rajdeep Singh ]]>
                </dc:creator>
                <pubDate>Tue, 18 Oct 2022 16:38:44 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/10/Tauri-and-nextjs--1-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Tauri is a new Rust-based framework that builds an x86_64 cross-platform application for Windows, macOS, and Linux. </p>
<p>In this tutorial, we'll use Tauri and Next.js to build a desktop-based cross-platform application and publish it to the Snap store and AppImage.</p>
<p>So why is building a cross-platform app, that works on Windows, Mac, and Linux, important these days? Well, it helps companies target a larger audience and increase their revenue, without having to build three separate apps.</p>
<p>Many companies and developers use Next.js as a front-end when building a website. In this tutorial, we'll use Next and Tauri to build a desktop-based cross-platform application that'll be available on Windows, macOS, and Linux. </p>
<h3 id="heading-demo-of-the-project">Demo of the project</h3>
<p>To build this cross-platform application, you need <a target="_blank" href="https://tauri.app/">Tauri</a>, <a target="_blank" href="https://en.wikipedia.org/wiki/Markdown">markdown</a>, <a target="_blank" href="https://www.npmjs.com/package/contentlayer">Contentlayer</a>, <a target="_blank" href="http://pnpm.io/">pnpm</a>, and <a target="_blank" href="https://nextjs.org/">Next.js</a>. If you check how my application looks, you can install the application with <a target="_blank" href="https://snapcraft.io/docs/snap-tutorials">snap-cli</a>, <a target="_blank" href="https://appimage.org/">AppImage</a>, or download the application via the link and install it.</p>
<p>Let's see what these tools do:</p>
<ul>
<li>we'll use Next.js for building the frontend part of the website </li>
<li>the markdown npm package helps convert markdown files into HTML </li>
<li>the Contentlayer npm package helps us manage markdown files in the project.</li>
<li>we'll use Tauri to build the cross-platform application binary</li>
<li>and finally, we'll use pnpm as our Node package manager.</li>
</ul>
<pre><code><span class="hljs-comment">// Install with snap</span>
snap install <span class="hljs-keyword">static</span>-blog-app

or

<span class="hljs-comment">// install with AppImage</span>
<span class="hljs-attr">https</span>:<span class="hljs-comment">//github.com/officialrajdeepsingh/static-blog-app/releases/download/v0.0.2/static-blog-app_0.0.2_amd64.AppImage</span>

or

<span class="hljs-comment">// Install on macOS</span>
<span class="hljs-attr">https</span>:<span class="hljs-comment">//github.com/officialrajdeepsingh/static-blog-app/releases/download/v0.0.2/static-blog-app_0.0.2_x64.dmg</span>

or

<span class="hljs-comment">// Install on Windows</span>
<span class="hljs-attr">https</span>:<span class="hljs-comment">//github.com/officialrajdeepsingh/static-blog-app/releases/download/v0.0.2/static-blog-app_0.0.2_x64_en-US.msi</span>
</code></pre><h2 id="heading-table-of-contents">Table of contents:</h2>
<ul>
<li><a class="post-section-overview" href="#heading-what-is-nextjs">What is Next.js?</a></li>
<li><a class="post-section-overview" href="#heading-what-is-tauri">What is Tauri?</a></li>
<li><a class="post-section-overview" href="#heading-computer-architecture">Computer Architecture</a></li>
<li><a class="post-section-overview" href="#heading-how-to-create-a-new-project-with-nextjs-and-tauri">How to Create a New Project with Next.js and Tauri</a></li>
<li><a class="post-section-overview" href="#heading-how-to-build-an-application-with-tauri">How to Build an Application with Tauri</a></li>
<li><a class="post-section-overview" href="#heading-how-to-build-an-application-for-the-snap-store-or-snapcraft">How to Build an Application for the Snap Store or Snapcraft</a></li>
<li><a class="post-section-overview" href="#heading-how-to-build-a-cross-platform-application-with-github-actions">How to Build a Cross-Platform Application with GitHub Actions</a></li>
<li><a class="post-section-overview" href="#heading-how-to-publish-the-app">How to Publish the App</a></li>
<li><a class="post-section-overview" href="#heading-faq">FAQ</a></li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-what-is-nextjs">What is Next.js?</h2>
<p><a target="_blank" href="https://nextjs.org/">Next</a> is a framework base on React. It has many features that let you build a website and enhance the user experience.</p>
<p>To learn more about Next, you can <a target="_blank" href="https://www.freecodecamp.org/news/nextjs-tutorial/">read this helpful tutorial I found</a> on freeCodeCamp written by Reed Barger.</p>
<h2 id="heading-what-is-tauri">What is Tauri?</h2>
<p><a target="_blank" href="https://tauri.app/">Tauri</a> is a new framework that helps you build cross-platform desktop applications. Tauri is built based on the Rust language. Rust is faster, more secure, and has fewer memory issues than other languages.</p>
<p>Tauri has many features, but I'll mention some of the important ones for a front-end developer.</p>
<ol>
<li>Tauri supports HTML, CSS, and JavaScript.</li>
<li>Tauri supports a lot of front-end frameworks and libraries, for example, React.js, Next.js, Vite, and Svelte kit.</li>
<li>With Tauri, you don't need to learn GTK, GJS, and app build commands or AppImage builder.</li>
<li>Tauri provides JavaScript API support. You can use it inside JS easily. For example, the window API helps all tasks related to the window. </li>
<li>You can quickly build a cross-application bundler size with one command.</li>
<li>Tauri provides an update handler to update older Tauri versions to the newest. You do not need to use other services and libraries to achieve the self-update functionality.</li>
<li>In Tauri, you call Rust functions within JavaScript.</li>
</ol>
<p>Tauri improves the development experience by providing an inbuilt JavaScript, npm, and Rust CLI tool, plugins, and the tauri-action GitHub workflow. </p>
<p>All these tools help you write code faster and create a production-ready app in less time. But the big thing Tauri provides is beginner-ready, easily understandable documentation. </p>
<p><a target="_blank" href="https://www.gtk.org/">GTK</a> is a free and open-source cross-platform widget toolkit for creating graphical user interfaces for applications.</p>
<p><a target="_blank" href="https://gjs.guide/">GJS</a> is a JavaScript library for Gnome to build application interfaces. GJS is built on the <a target="_blank" href="https://spidermonkey.dev/">SpiderMonkey</a> JavaScript engine.</p>
<h2 id="heading-computer-architecture">Computer Architecture</h2>
<p>Every operating system comes with different architecture. Building cross-platform applications or performing <a target="_blank" href="https://rust-lang.github.io/rustup/cross-compilation.html#cross-compilation">cross-compilation</a> is not easy. Based on the architecture, you can understand where the application is run. In other words, which architecture requires running our applications like i386, ARM, or x86_64?</p>
<p>The most common architectures in the computer science world are <a target="_blank" href="https://en.wikipedia.org/wiki/ARM_architecture_family">ARM</a>, <a target="_blank" href="https://en.wikipedia.org/wiki/I386">i386</a>, and <a target="_blank" href="https://en.wikipedia.org/wiki/X86-64">AMD (x86_64)</a>. Less technical users might know it as 64 or 32-bit architecture.</p>
<p>Rust uses different types of architecture to install itself. In my case, my laptop hardware support x86_64  and I have Ubuntu installed. On Ubuntu x86_64, the default <code>stable-x86_64-unknown-linux-gnu</code> Rust toolchain is used to build Tauri applications. </p>
<p>The Rust toolchain builds <a target="_blank" href="https://en.wikipedia.org/wiki/X86-64">AMD (x86_64)</a> applications. That is why Tauri builds cross-platform application (for Windows, macOs, and Linux distros) but does not build cross-architecture ones (builds applications for all ARM, i386, and x86_67 architecture). </p>
<h3 id="heading-how-to-check-your-architecture-in-linux-by-command">How to check your architecture in Linux by command:</h3>
<pre><code class="lang-bash">cat /etc/debian_version

    or 

dpkg --print-architecture

    or

uname -m

    or

arch
</code></pre>
<h3 id="heading-how-to-check-which-toolchain-tauri-is-using">How to check which toolchain Tauri is using:</h3>
<p>The toolchain is a utility provided by Rust itself. You can install different toolchains with the <code>rustup</code> command.</p>
<p>You can use different types of Rust toolchains according to your computer's architecture. You can easily check which toolchain is installed in your operating system with the <code>tauri npm</code>, <code>yarn</code>, or <code>pnpm</code> command. </p>
<p>In my project, I'm using pnpm to create a new project, so I use the <code>pnpm</code> command. Again, based on the toolchain, we build apps for different architectures. </p>
<p>The default Ubuntu (x86_64) is based on the <code>stable-x86_64-unknown-linux-gnu</code> toolchain. The Rust <code>stable-x86_64-unknown-linux-gnu</code> toolchain builds only AMD-based applications. </p>
<p>The Rust toolchain is different according to the operating system and distro you're using. The default Rust toolchain is installed when you install Rust on your computer.</p>
<p>Here are the commands to check your architecture:</p>
<pre><code>pnpm tauri info

or

yarn tauri info

or

npm run tauri info
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2022/10/pnpm-tauri-info.png" alt="pnpm tauri info command output" width="600" height="400" loading="lazy">
<em>pnpm tauri info command output</em></p>
<p>Tauri officially supports macOS, Windows, and Linux distros and you can't build mobile applications with Tauri (you'll face lots of issues, and after resolving them all you'll end up building your mobile app directly).</p>
<p>I found a <a target="_blank" href="https://www.youtube.com/watch?v=wp6s2sm_7VE">great tutorial on the Rust toolchain as well as cross-compilation</a>. The tutorial guides you and provides you with a deeper understanding of the Rust toolchain.</p>
<p>You can use the <code>rustup</code> command to install a different type of toolchain if you'd like. To learn more about the Rust toolchain and the <code>rustup</code> command, I'd suggest starting with the <a target="_blank" href="https://rust-lang.github.io/rustup/concepts/toolchains.html">Rust toolchain docs</a>.</p>
<h2 id="heading-how-to-create-a-new-project-with-nextjs-and-tauri">How to Create a New Project with Next.js and Tauri</h2>
<p>You can create a Tauri app with bash, cargo, PowerShell npm, yarn, or pnpm. We'll use pnpm to create a new Tauri set-up in this tutorial. pnpm is the new package manager for Node.js.</p>
<h3 id="heading-create-the-ui-template-in-tauri">Create the UI template in Tauri</h3>
<p>You can use different types of front-end frameworks for the Tauri app, for example, Vue, React, Svelte, Solid, Next.js, Preact, Angular, and Svelte. I've chosen to use Nextjs as the front-end template for our Tauri app in this tutorial.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/Screenshot-from-2022-10-11-12-44-05.png" alt="Image" width="600" height="400" loading="lazy">
<em>pnpm - choose your UI template</em></p>
<h3 id="heading-create-a-new-application-with-pnpm">Create a new application with pnpm</h3>
<p>You can use any other node package manager to create a new app like yarn or npm. I choose the pnpm node package manager, because pnpm is fast compared to yarn and npm.  </p>
<pre><code class="lang-bash">pnpm create tauri-app
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/create-tauri-app.png" alt="create tauri-app with nextjs" width="600" height="400" loading="lazy">
<em>Create tauri-app with nextjs</em></p>
<p>Now Tauri has created the my-demo app successfully. You can directly change the directory (folder) <code>cd my-demo</code> with the change directory (cd) command. Then you can run the <code>pnpm install</code> command to install all the dependencies required for the project. Finally, run the <code>tauri dev</code> command to lunch a new Tauri application window.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/tauri-dev.png" alt="Run local development server in tauri" width="600" height="400" loading="lazy">
<em>Run local development server in tauri</em></p>
<p>After downloading and compiling the code, you can see a new window open in your system using the <code>pnpm tauri dev</code> command.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/Screenshot-from-2022-10-11-14-03-45.png" alt="Open a new window by tauri" width="600" height="400" loading="lazy">
<em>Open a new window by tauri</em></p>
<p>The default Tauri folder structure comes with <code>pnpm create tauri-app</code>:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/tauri-folder-struture.png" alt="Tauri default folder structure" width="600" height="400" loading="lazy">
<em>Tauri default folder structure</em></p>
<ol>
<li>You use the <code>next.config.js</code> file for Next.js configuration.</li>
<li>The <code>next-env.d.ts</code> file automatically generates for TypeScript</li>
<li>The <code>package.json</code> file contains all information for npm, yarn, and pnpm.</li>
<li>The <code>pnpm-lock.yaml</code> file is created by pnpm to store all package information with the version.</li>
<li>The <code>README.MD</code> file contains all the information about the project.</li>
<li>The <code>src</code> folder contains all the Next.js code with pages, components, and CSS files.</li>
<li>You use the <code>src-tauri</code> folder for Rust and Rust configuration.</li>
<li><code>src-tauri/icons</code> contains all icons for the app.</li>
<li><code>src-tauri/Cargo.lock</code> generated by cargo to store all package information.</li>
<li><code>src-tauri/Cargo.toml</code> generated by cargo and store all packages and confirmation for the project.</li>
<li><code>src-tauri/src</code> used to write the Rust code.</li>
<li><code>src-tauri/target</code> generated by the <code>pnpm tauri dev</code> command. It contains all the binary for the project.</li>
<li><code>tauri.config.json</code> file used for Tauri configuration.  </li>
</ol>
<h3 id="heading-create-the-ui-for-the-app-with-nextjs">Create the UI for the app with Next.js</h3>
<p>I'm using my <a target="_blank" href="https://github.com/officialrajdeepsingh/contentlayer">old Next.js static site</a> and I'll convert it into a desktop application. The Next static website code is available on <a target="_blank" href="https://github.com/officialrajdeepsingh/contentlayer">GitHub so you can easily download it</a>.</p>
<p>First, I need to copy my old posts along with the public, components, and pages folders and paste them into the new Tauri project. Then I'll remove the bootstrap CSS, and use Tailwind CSS to design the application's layout. </p>
<p>I already explained the process step-by-step on <a target="_blank" href="https://medium.com/nextjs/install-tailwind-css-in-next-js-37a56bd64fa7">how to install TailwindCSS with Next in this article</a>. You can read and follow the same setup to install Tailwind if you don't have it installed already.</p>
<h3 id="heading-generate-an-icon-for-the-application">Generate an icon for the application</h3>
<p>The icon is important for the application. The user will click on the icon to open your application in Windows, macOS, and Linux.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/Screenshot-from-2022-10-11-17-57-45.png" alt="Serach your application in ubuntu" width="600" height="400" loading="lazy">
<em>Ubuntu static-blog-app icon</em></p>
<p>Generating icons for applications with various types and sizes can be complicated. You need icons for Windows, macOS, and Linux. Every operating system has its own guidelines for icons.</p>
<p>Tauri comes with a CLI tool that generates cross-operating system icons for applications based on icon configuration in Tauri. Here's the command to generate the icons:</p>
<pre><code class="lang-bash">pnpm tauri icon path-of-image
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/create-icon-for-app.png" alt="Image" width="600" height="400" loading="lazy">
<em>Generating icons</em></p>
<p>You can use an online website to generate icons for Tauri, and then add all icons into the <code>tauri-app/src-tauri/icons</code> folder.</p>
<p>You can change the icon configuration in the <code>tauri-app/src-tauri/tauri.conf.json</code> file:</p>
<pre><code class="lang-json"><span class="hljs-string">"icon"</span>: [
        <span class="hljs-string">"icons/32x32.png"</span>,
        <span class="hljs-string">"icons/128x128.png"</span>,
        <span class="hljs-string">"icons/128x128@2x.png"</span>,
        <span class="hljs-string">"icons/icon.icns"</span>,
        <span class="hljs-string">"icons/icon.ico"</span>
],
</code></pre>
<h2 id="heading-how-to-build-an-application-with-tauri">How to Build an Application with Tauri</h2>
<p>To build the application in Tauri, you need to run only one command in the terminal. Tauri automatically generates the build applications. </p>
<p>The first application is for the <code>.deb</code> Debian-based distro and the second application is appImage. The application build file changes from operating system to operating system.</p>
<p><a target="_blank" href="https://appimage.org/">AppImage</a> is a universal application distribution for the cross-Linux distro. So you create one AppImage and run your application on any distro. </p>
<pre><code class="lang-bash">pnpm tauri build
</code></pre>
<p>The first time you run the <code>tauri build</code> command, you may face a bundle identifier error in the terminal.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/_bundle-identifier-error-in-tauri.png" alt="Image" width="600" height="400" loading="lazy">
<em>Bundle identifier error</em></p>
<p>To solve the bundle identifier error, first open the <code>my-demo/src-tauri/tauri.conf.json</code> file and find <code>identifier</code>. Then change the <code>"identifier": "com.tauri.dev"</code> value according to your app. Make sure the <code>identifier</code> value is unique across the application.</p>
<pre><code class="lang-json"><span class="hljs-string">"identifier"</span>: <span class="hljs-string">"com.officialrajdeepsingh.blog"</span>,
</code></pre>
<p>After changing the <code>identifier</code> in the <code>tauri.conf.json</code> file, <strong>rerun</strong> the <code>pnpm tauri build</code> command.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/tauri-building-application.png" alt="Image" width="600" height="400" loading="lazy">
<em>Run tauri build command</em></p>
<p>After successfully running the <code>tauri build</code> command, Tauri generates two files:</p>
<ol>
<li>my-demo_0.0.0_amd64.deb</li>
<li>my-demo_0.0.0_amd64.AppImage</li>
</ol>
<p>The bot file binary works only for the <strong>amd64</strong> architecture and doesn't work on the <strong>arm</strong> and <strong>i386</strong> architecture.</p>
<p>The file extension tells us where we use it.</p>
<ol>
<li><code>.deb</code> file extension is used for Debian.</li>
<li><code>.AppImage</code> file extension is used for all Linux distros to install the app.</li>
<li><code>.dmg</code> file extension is used for macOS.</li>
<li><code>.msi</code> file extension is used for Windows.</li>
<li><code>.snap</code> file extension is used for the Linux distro.</li>
</ol>
<h3 id="heading-install-deb-and-appimage-locally">Install <code>.deb</code> and <code>.AppImage</code> locally</h3>
<p>To test for both binary  <code>my-demo_0.0.0_amd64.deb</code> and <code>my-demo_0.0.0_amd64.AppImage</code>, first install them locally and check that everything is working fine.</p>
<p><strong><code>.deb</code> file</strong></p>
<pre><code class="lang-bash">❯ dpkg -i static-blog-app_0.0.2_amd64
</code></pre>
<p><strong><code>.AppImage</code> file</strong></p>
<p>Firstly add the file permission for executing and then run the file.</p>
<p><strong>Step 1</strong>: run <code>chmod +x my-demo_0.0.0_amd64.AppImage</code></p>
<p><strong>Step 2</strong>: run <code>./my-demo_0.0.0_amd64.AppImage</code> hit enter to run <code>AppImage</code> base binary.</p>
<p>Tauri automatically generates both <code>.deb</code> and <code>.AppImage</code> files with their own file names.</p>
<p>Both files use the same naming conversion syntax all around the world. This file name conversion is not for Tauri. The Flatpak builder and Snapcraft also use the same kind of file naming syntax.</p>
<pre><code class="lang-bash">Syntax

&lt;name-of-appliciation&gt; &lt;version&gt; &lt;architecture&gt; &lt;File extension&gt;

Example
1. my-demo_0.0.0_amd64.deb
2. my-demo_0.0.0_amd64.AppImage
</code></pre>
<h2 id="heading-how-to-build-an-application-for-the-snap-store-or-snapcraft">How to Build an Application for the Snap Store or Snapcraft</h2>
<p>Snapcraft or the Snap store is a Linux application distribution. It helps distribute your applications across Linux distros. Users can install your application with one click and the use of a command line (Terminal).</p>
<p>Snapcraft is maintained and built by Canonical (Ubuntu). Canonical provides all Linux application distributions and does not work for macOS and Windows.</p>
<p>Before building a snap, first you need to install <a target="_blank" href="https://snapcraft.io/docs/snapcraft-overview">Snapcraft</a>.</p>
<pre><code class="lang-bash">sudo apt-get update
sudo snap install snapcraft --classic
</code></pre>
<h3 id="heading-how-to-build-an-application-for-the-snap-store">How to build an application for the Snap store</h3>
<p>I will guide you with a simple way to generate the snap file for Snapcraft. The snap file is a binary file, similar to the <code>.deb</code>  file. The Snap store uses a special <code>.snap</code> extension for the file. That indicates that it's a snap application installed on a linux distro.</p>
<p>You can also develop your first snap app quickly if you are a beginner – simply follow these steps (we'll go through each one by one):</p>
<ol>
<li>Install the <a target="_blank" href="https://www.npmjs.com/package/tauri-snap-packager">tauri-snap-packager</a> npm package</li>
<li>Add configuration in the <code>package.json</code> file</li>
<li>Build the snap</li>
<li>Handle any errors</li>
<li>How to fix the tauri-snap-packager takes too much time error</li>
</ol>
<h3 id="heading-install-tauri-snap-packager-npm-package">Install tauri-snap-packager npm package</h3>
<p>Firstly install the <a target="_blank" href="https://www.npmjs.com/package/tauri-snap-packager">tauri-snap-packager</a> npm package in your project. The <a target="_blank" href="https://www.npmjs.com/package/tauri-snap-packager">tauri-snap-packager</a> npm package helps you create a snapcraft configuration file.</p>
<pre><code class="lang-bash">npm install --save-dev tauri-snap-packager

<span class="hljs-comment"># Or with yarn</span>

yarn add --dev tauri-snap-packager

<span class="hljs-comment"># Or with pnpm</span>

pnpm add tauri-snap-packager
</code></pre>
<h3 id="heading-add-configuration-in-the-packagejson-file">Add configuration in the package.json file</h3>
<p>After installation, complete the tauri-snap-package npm package. Now configure the  <code>"tauri-snap": "tauri-snap-packager"</code> tauri-snap-package script in the <code>package.json</code> file.</p>
<pre><code class="lang-json"><span class="hljs-string">"scripts"</span>: {
    <span class="hljs-attr">"dev"</span>: <span class="hljs-string">"next dev -p 1420"</span>,
    <span class="hljs-attr">"build"</span>: <span class="hljs-string">"next build &amp;&amp; next export -o dist"</span>,
    <span class="hljs-attr">"tauri"</span>: <span class="hljs-string">"tauri"</span>,
    <span class="hljs-attr">"lint"</span>: <span class="hljs-string">"next lint"</span>,

    <span class="hljs-attr">"tauri-snap"</span>: <span class="hljs-string">"tauri-snap-packager"</span>

  },
</code></pre>
<h3 id="heading-build-the-snap">Build the snap</h3>
<p>Now you run the <code>pnpm tauri-snap</code> command in your project folder. <code>tauri-snap</code> automatically creates a snap folder in <code>src-tauri/target</code>. Inside the snap folder <code>pnpm tauri-snap</code> creates a new <code>snapcraft.yaml</code> file with all the configurations. All the configuration is based on your Tauri configuration.</p>
<pre><code class="lang-src-tauri/target/snap/snapcraft.yaml">name: static-blog-app
base: core18
version: 0.0.2
summary: Tauri app.
description: Awesome Tauri app.
grade: devel
confinement: strict
source-code: https://github.com/officialrajdeepsingh/static-blog-app
apps:
  static-blog-app:
    command: static-blog-app
    extensions:
      - gnome-3-34
    desktop: static-blog-app.desktop
parts:
  dump-binary:
    plugin: dump
    source: ./target/release
    source-type: local
    stage:
      - lib
      - icons
      - static-blog-app
      - static-blog-app.desktop
    prime:
      - lib
      - icons
      - static-blog-app
      - static-blog-app.desktop
    stage-packages:
      - libc6
</code></pre>
<h3 id="heading-how-to-fix-the-errors">How to fix the errors</h3>
<p>You'll get an error while validating <code>snapcraft.yaml</code> with the <code>pnpm tauri-snap</code> command.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/Issues-while-validating-snapcraft.yaml--1-.png" alt="Issues while validating snapcraft.yaml" width="600" height="400" loading="lazy">
<em>Issues while validating snapcraft.yaml</em></p>
<p>Your application name may contain some words that are not allowed, like spaces, numbers, uppercase letters, and so on. For example, Static-blog-website does not allow you to use your name with a capital letter. Simply use a small case word for a name like static-blog-website.</p>
<p>You might also see an error <code>you need 'multipass' set-up to build snaps</code> when running the <code>pnpm tauri-snap --trace-warnings</code> command.</p>
<p>The <code>--trace-warnings</code> Node.js flag helps debug or trace the error.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/You-need-multipass-.png" alt="You need 'multipass' set-up to build snaps" width="600" height="400" loading="lazy">
<em>You need a multipass set-up to build snaps error.</em></p>
<p>To solve the error, you must install the <a target="_blank" href="https://multipass.run/">multipass package</a> in Ubuntu. The tauri-snap-package uses the Snapcraft command as a background to build a snap file. So Snapcraft requires multipass to build a snap package.</p>
<pre><code>sudo snap install multipass
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2022/10/install-multipass.png" alt="Install multipass in ubuntu" width="600" height="400" loading="lazy">
<em>Install multipass in ubuntu</em></p>
<h3 id="heading-tauri-snap-packager-takes-too-much-time">Tauri-snap-packager takes too much time.</h3>
<p>If the <a target="_blank" href="https://www.npmjs.com/package/tauri-snap-packager">tauri-snap-packager</a> takes too much time to build the snap binary or you feel your application is stuck and does not show any output in the terminal, then just stop the command. The tauri-snap-packager isn't working for you, so you can use the <code>snapcraft</code> command.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/build-snap-by-tauri-snap.png" alt="Create a snap configuration with Tauri-snap-packager " width="600" height="400" loading="lazy">
<em>Create a snap configuration with Tauri-snap-packager</em></p>
<p>This error means that the <code>pnpm tauri-snap</code> the command is not working and it takes too much time. It's likely because the tauri-snap-package npm package isn't working correctly. </p>
<p>To solve this issue, <strong>run the snapcraft command in the same folder where your snap folder was created</strong>. Before running the snapcraft command, first, install the snapd command tool. Snapd is a REST API daemon for managing snap packages. To learn more about snapd, I <a target="_blank" href="https://codeburst.io/how-to-install-and-use-snap-on-ubuntu-18-04-9fcb6e3b34f9">found a great article</a> written by Oyetoke Tobi Emmanuel.</p>
<pre><code>snap install --channel stable snapd
</code></pre><p>After installation is complete, run the <code>snapcraft</code> command in the <code>tauri-app/src-tauri/target</code> folder. The <code>target</code> folder is generated by the <code>pnpm tauri dev</code> command. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/snap-_core18_-has-no-updates-available.png" alt="Face common error with snapcraft command." width="600" height="400" loading="lazy">
<em>Face common error with snapcraft command</em></p>
<p>You may get a snap "core18" has no updates available error with Snapcraft. <strong>But the core18 is not a big issue.</strong> Simply update your distro package with the <code>sudo apt-get update &amp;&amp; sudo apt-get upgrade</code> command, then restart your terminal or laptop. <a target="_blank" href="https://www.youtube.com/watch?v=PNii2y97D0s&amp;ab_channel=BassoniaTv">Here's a youtube tutorial</a> that can help you solve your core18 error problem.</p>
<p>"Snapd has not logged" means that first, you need to login into your <a target="_blank" href="https://snapcraft.io/">snapcraft account</a>. For login run <code>snapcraft login</code>.</p>
<p>After you solve the core 18 issue, now run the <code>snapcraft</code> command again and build your snap binary file.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/snapcraft.png" alt="Build a new binary with snapcraft" width="600" height="400" loading="lazy">
<em>Create a binary with snapcraft</em></p>
<p>The Snapcraft creates a new binary <code>static-blog-app_0.0.0_amd64.snap</code> file. Now the <code>static-blog-app_0.0.0_amd64.snap</code> file is ready to publish on the Snapcraft website or snap store.</p>
<h3 id="heading-how-to-install-static-blog-app000amd64snap-locally-in-the-system">How to install static-blog-app_0.0.0_amd64.snap locally in the system</h3>
<p>If you install the <code>static-blog-app_0.0.0_amd64.snap</code> file locally with the following command, you might find the signatures metadata error.</p>
<pre><code class="lang-bash">sudo snap install ./static-blog-app_0.0.0_amd64.snap
</code></pre>
<p><strong>Here's the error:</strong></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/install-locally-snap-file.png" alt="cannot find signatures metadata error for snap" width="600" height="400" loading="lazy">
<em>cannot find signatures metadata error for snap</em></p>
<p>To solve this error, you need to run the snap command with the <code>--dangerous</code> flag.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/install-snap-locally-package-with-snap.png" alt="Install snap locally package" width="600" height="400" loading="lazy">
<em>Install snap locally package</em></p>
<h2 id="heading-how-to-build-a-cross-platform-application-with-github-actions">How to Build a Cross-Platform Application with GitHub Actions</h2>
<p>GitHub Actions is a <strong>continuous integration and continuous delivery (CI/CD)</strong> platform or pipeline that allows you to automate tasks like building, testing, and deployment. </p>
<p>You can triage GitHub actions on certain events like somebody pushing new code to the GitHub repository and running tests on the code. If the test passes then the code gets added to the main or master branch. </p>
<p>If you want to build cross-platform applications for Windows, macOS, and Linux, the easiest way is using the GitHub actions workflow. This workflow runs on a specific event like push, pull, and so on.</p>
<p>To try this out, you'll need to create a new action in your project. First, create a new <code>.github/workflows</code> folder. After in the <code>workflows</code>, create a file with any name with a <code>.yml</code> extension.</p>
<p>The Tauri app provides a <a target="_blank" href="https://github.com/tauri-apps/tauri-action">GitHub action configuration</a>. With Tauri actions, you can quickly build cross-platform applications for Windows, macOS, and Linux distros with the GitHub workflow.</p>
<pre><code class="lang-my-demo/.github/workflows/build.yml">name: Build application
on:
  push:
    branches:
      - 'main'
  workflow_dispatch:

jobs:
  release:
    strategy:
      fail-fast: false
      matrix:
        platform: [macos-latest, ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Install Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 16

      - uses: pnpm/action-setup@v2.0.1
        name: Install pnpm
        id: pnpm-install
        with:
          version: 7.13.1
          run_install: false

      - name: Get pnpm store directory
        id: pnpm-cache
        run: |
          echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

      - uses: actions/cache@v3
        name: Setup pnpm cache
        with:
          path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
          key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
          restore-keys: |
            ${{ runner.os }}-pnpm-store-

      - name: Rust setup
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable

      - name: Install dependencies (ubuntu only)
        if: matrix.platform == 'ubuntu-latest'
        run: |
          sudo apt-get update
          sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
      - name: Install app dependencies and build web
        run: yarn &amp;&amp; yarn build

      - name: Build the app
        uses: tauri-apps/tauri-action@v0
        env:
          GITHUB_TOKEN: ${{ secrets.STATIC_BLOG_APP }}
        with:
          tagName: v__VERSION__ # tauri-action replaces \_\_VERSION\_\_ with the app version
          releaseName: 'v__VERSION__'
          releaseBody: 'See the assets to download this version and install.'
          releaseDraft: true
          prerelease: false
</code></pre>
<p>Following the GitHub action, you can build your application on every push after successfully building the application and show all files in the GitHub release assets section. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/asset-folder.png" alt="Show all applications in the assets section" width="600" height="400" loading="lazy">
<em>Show all applications in the assets section.</em></p>
<h2 id="heading-how-to-publish-the-app">How to Publish the App</h2>
<p>Publishing the package is the core of this article. A lot of people build their own Linux applications. But then they can't figure out how to submit the app on various distributions like Snapcraft, AppImage, and Homebrew.</p>
<p>So now I'll show how to submit a static-blog-app to Snapcraft and AppImage. </p>
<h3 id="heading-how-to-publish-the-app-into-the-snap-store-or-snapcraft">How to publish the app into the snap store or snapcraft</h3>
<p>To publish a new package on the snap store, make sure you have a <code>.snap</code> binary available. Otherwise, first, build the <code>.snap</code> binary for the application (which we already went over above).</p>
<p>Go to the <code>target</code> or whatever folder where you created the <code>.snp</code> binary. Then run the <code>snapcraft</code> command. Make sure you first log in with your Snapcraft account. For login, run <code>snapcraft login</code>. Then run the following command with the argument I mentioned:</p>
<p>Syntax:</p>
<pre><code>snapcraft upload &lt;Opation&gt; name-<span class="hljs-keyword">of</span>-file
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2022/10/devel-in-snap.png" alt="Publish a new package to snapcraft" width="600" height="400" loading="lazy">
<em>Publish a new package to snap in devel release</em></p>
<p>After successfully getting into your account, then you can add or change the information regarding your package icon, name, and so on.</p>
<pre><code class="lang-bash">snapcraft upload --release=stable ./static-blog-app_0.0.0_amd64.snap
</code></pre>
<p>In the <code>devel</code> mode, you'll see a message on the application installation page. <code>devel</code> means development mode.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/static-app-in-devmode.png" alt="Application in development mode" width="600" height="400" loading="lazy">
<em>Application in development mode</em></p>
<p>By default, your package publishes all the information collected by <code>src-tauri/target/snap/snapcraft.yaml</code> in the edge release. To understand more about the Snapcraft release system, you can read the <a target="_blank" href="https://snapcraft.io/docs/release-management">release documentation</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/staticblogappforlinux.png" alt="Image" width="600" height="400" loading="lazy">
<em>Go to the dashboard and add or update all the information regarding the app.</em></p>
<p>Make sure to use a banner image with a size of 720 x 240 for the snap.</p>
<h3 id="heading-how-to-publish-your-application-on-snapcraft">How to publish your application on Snapcraft</h3>
<p>When you upload your application to your Snapcraft account, your application is private. To change how it's published, drag your available release into one of the release channels. </p>
<p>Go to the dashboard&gt; my snap&gt; select your snap&gt; releases, and according to your requirements, add your application to one of the provided releases. The default is edge release. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/releases-in-snap.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-how-to-add-an-application-to-a-stable-release">How to add an application to a stable release</h3>
<p>To change the application to a stable release, go to the snap configuration <code>src-tauri/target/snap/snapcraft.yaml</code> file and update your  <code>grade: devel</code> to <code>grade: stable</code>:</p>
<pre><code class="lang-yaml"><span class="hljs-string">....</span>

<span class="hljs-attr">grade:</span> <span class="hljs-string">stable</span>

<span class="hljs-string">....</span>
</code></pre>
<p>Now your application goes to stable release or channel and re-uploads your application.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/publish-in-snap-1.png" alt="Publish a snap image in stable release" width="600" height="400" loading="lazy">
<em><b>The</b> application automatically goes to a stable release<b> if you do not mention- release tags</b>.</em></p>
<p>Now you've successfully released your application in a stable release. </p>
<h3 id="heading-how-to-update-your-snap-application">How to update your snap application</h3>
<p>For updating the snap application, you need to make changes in the <code>tauri/target/snap/snapcraft.yaml</code> file in the version section.</p>
<pre><code class="lang-snapcraft.yaml">...

version: 0.0.1

or 
version: 1.0.0

or

version: 0.1.0

...
</code></pre>
<p>Now rebuild your application with the <code>snapcraft</code> command.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/update-application.png" alt="Rebuild your application" width="600" height="400" loading="lazy">
<em>Rebuild your application</em></p>
<p>After successfully building your application, re-upload your latest build, and your application will be updated on the snap store website. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/upload-latest-v-ersion-of-snap.png" alt="Update your application in snapcraft" width="600" height="400" loading="lazy">
<em>Update your application in snapcraft</em></p>
<h3 id="heading-how-to-publish-applications-in-appimage">How to publish applications in AppImage</h3>
<p>AppImage helps you distribute your application across Linux distros. You don't need to install AppImage for it to work in your system.</p>
<p>Publishing the application on AppImage is a straightforward process. First, you need an AppImage URL and a GitHub account.</p>
<p>First, go to the <a target="_blank" href="https://github.com/AppImage/appimage.github.io">appImage GitHub repository</a> and click on this link.  </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/appimagesubmit.png" alt="Submit application into appimage" width="600" height="400" loading="lazy">
<em>Click this link</em></p>
<p>After that, a new page is opened in the browser:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/submit-app.png" alt="Submit pull request in appimage" width="600" height="400" loading="lazy">
<em>Submit pull request in AppImage</em></p>
<ol>
<li>Add your application name.</li>
<li>Paste your image URL </li>
<li>Add comment</li>
<li>Click the new propose file button. </li>
<li>Download the appimage.github.io repo in your GitHub account</li>
<li>Create a new pull request into the appimage.github.io repository.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/create-a-new-pull-request.png" alt="Create a pull request into appimage.github.io" width="600" height="400" loading="lazy">
<em>Create a pull request into appimage.github.io</em></p>
<ol start="7">
<li>Add the comment and click the create pull request button.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/create-pull-request-to-appimage.png" alt="Create a pull request into appimage.github.io" width="600" height="400" loading="lazy">
<em>Add comment and Create a pull request into appimage.github.io</em></p>
<p>Now your application is successfully submitted to the appimage.github.io repository. The appimage.github.io runs GitHub actions based on your application. Your application should pass all tests run AppImage. After that, your image should be successfully listed on AppImage so everybody can download your application.</p>
<p>If you submit an application on AppImage with a pull request, your GitHub action test will fail. You'll see the GLIBC_2.29' not found error. </p>
<p>I tried many ways to solve this issue, but I couldn't find a solution. If I do, I'll update my repository as well as this article.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/10/GLIBC_2.29--not-found.png" alt="GLIBC_2.29 is not found in ubuntu" width="600" height="400" loading="lazy">
_GLIBC<em>2.29 is not found</em></p>
<h2 id="heading-faq">FAQ</h2>
<h3 id="heading-if-youre-building-the-application-with-tauri-do-you-have-to-code-in-rust">If you're building the application with Tauri, do you have to code in Rust?</h3>
<p>No, you can build an application without writing a single line of code in Rust. Instead, Tauri provides JavaScript and TypeScript API support for front-end development to handle a lot of stuff like clipboard, dialog, event, HTTP, notification, and so on.</p>
<h3 id="heading-how-do-you-build-cross-platform-architecture-cross-compilation-with-tauri">How do you build cross-platform architecture (cross-compilation) with Tauri?</h3>
<p>You can build an application cross-architecture (cross-compilation) with Rust. Rust Toolchain helps you build <a target="_blank" href="https://rust-lang.github.io/rustup/cross-compilation.html">cross-compilation applications</a>.</p>
<h3 id="heading-what-is-the-toolchain-in-tauri">What is the toolchain in Tauri?</h3>
<p>The Rust toolchain helps you build an application on a different architecture. In rust, there are 86 toolchains available for a different architectures.</p>
<pre><code class="lang-bash">❯ rustup target list
</code></pre>
<h3 id="heading-can-you-use-tauri-to-build-an-android-or-ios-application">Can you use Tauri to build an Android or IOS application?</h3>
<p>No, you can't use Tauri to build applications for Android and iOS. But there is a library that helps you build applications for mobile phones – I just haven't tested it yet. You can build applications with a toolchain. I'll soon write an article about this on <a target="_blank" href="https://officialrajdeepsingh.dev/">my website.</a></p>
<h3 id="heading-what-are-tauri-javascript-and-typescript-api">What are Tauri JavaScript and TypeScript API?</h3>
<p>Tauri provides a different type of API that helps enhance the user and developer experience. You can use the API to handle notifications, dialog, events, HTTP, and so on.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>It's relatively easy to build cross-platform applications with Tauri. You can use any front-end framework for the application.</p>
<p>But other frameworks don't let you build various cross-architecture and cross-operating system applications, for example, Windows, macOS, and Linux distros.</p>
<p>Tauri comes with strong backend language support. With Rust, you can do anything you can with a low-level language. In addition, Rust provides memory safety, no garbage collector, and so on.</p>
<p>When building the Tauri application with Flatpak, I couldn't find a development and distribution solution. However, in the future, I will add it to the GitHub readme file.</p>
<p>I haven't covered how to distribute applications on Windows and macOS. I'm a Linux user and do not test applications on Windows and macOS. But there are lots of articles and videos on the internet you can check out to learn how to do that.</p>
<p>MacOS has a popular distribution platform called homebrew. The <a target="_blank" href="https://docs.brew.sh/How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies">homebrew distribution</a> system is similar to <a target="_blank" href="https://appimage.org/">appimage.org</a>. If you submit a new pull request for your application and pass all tests, your app shows on homebrew.</p>
<p>If you have any questions or suggestions related to developing and distributing a Tauri application, you can ask for help on the <a target="_blank" href="https://github.com/tauri-apps/tauri/discussions/">Tauri GitHub discussions</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ DNS Server Not Responding – How to Fix the Error in Windows 10 ]]>
                </title>
                <description>
                    <![CDATA[ I think it's safe to say that the vast majority of professionals depend on the internet these days.  So being denied access to the internet when you are trying to mine nuggets of valuable information from your go-to web sites can be quite an ordeal. ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-fix-dns-server-not-responding-error-windows-10/</link>
                <guid isPermaLink="false">66b0c5886e47f92ed2d0bf25</guid>
                
                    <category>
                        <![CDATA[ dns ]]>
                    </category>
                
                    <category>
                        <![CDATA[ error ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows 10 ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Gavin Lon ]]>
                </dc:creator>
                <pubDate>Fri, 30 Sep 2022 15:00:47 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/09/DNS-Issue-Main-Pic---pexels-yan-krukov-4458420.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I think it's safe to say that the vast majority of professionals depend on the internet these days. </p>
<p>So being denied access to the internet when you are trying to mine nuggets of valuable information from your go-to web sites can be quite an ordeal. Especially when you are under pressure to complete a piece of urgently required work. </p>
<p>One particularly unwelcome cause of being denied access to the internet is the “DNS Server Not Responding” error. It’s like that old fable where a troll sits under a bridge and says “You shall not pass!”, or something about gobbling up those that wish to cross the bridge. </p>
<p>I’m happy to tell you that you should be able to defeat the troll and cross the bridge to internet access joy by following the simple trouble shooting steps discussed in this article.</p>
<h2 id="heading-what-is-the-dns-server-not-responding-error">What is the "DNS Server Not Responding" Error?</h2>
<p>The “DNS Server Not Responding” error is a fairly common issue and is generally easy to fix. There are many reasons why this issue may occur. But fundamentally it is caused because the DNS server that is contacted during the processes of loading a web page is unable to find the site that contains the web page that you have requested. </p>
<p>This article explores what may have triggered this issue to occur and how you may go about fixing the issue.</p>
<p>Firstly, I think it is a good idea to gain at least a basic understanding of the “DNS Server Not Responding” error. To do this, let’s first understand DNS. </p>
<p>DNS stands for Domain Name System. A simple explanation of DNS is that it is a decentralised storage of human readable internet addresses, like the ones with which you will almost certainly be familiar (for example www.amazon.com or www.netlix.com). </p>
<p>The DNS maps these human readable URLs to their appropriate IP (Internet Protocol) addresses. </p>
<p>IP addresses are much less human readable, but are essential for the inner workings of the internet. IP addresses uniquely identify computers on the internet. The IP address associated with the URL, www.netflix.com, might for example, look like this, 69.53.224.255. </p>
<p>It is clearly easier for you to remember “<a target="_blank" href="http://www.netflix.com">www.netflix.com</a>", rather than a string of numbers delimited by full stops, when you wish to access your favourite content on Netflix. So the DNS facilitates this for you, so that you don’t have to remember or manually lookup unfriendly strings of numeric data every time you wish to access a web site. </p>
<p>The common analogy to explain DSN is a telephone directory. Basically, as you would look up a telephone number using the name of the person you wish to call in a telephone directory, a similar look up is performed when you type in the URL (like www.amazon.com) of the web site you wish to view within your browser.</p>
<p>Thankfully you don’t have to manually look up the corresponding IP address for www.amazon.com, as this is performed behind the scenes for you automatically. </p>
<p>So the appropriate IP address is retrieved automatically every time you type in a URL into your browser. This IP address is then used to contact the appropriate server that hosts the relevant web site associated with the URL you have entered into your browser.</p>
<p>When the “DNS Server Not Responding” error occurs, this means that the decentralised naming systems responsible for automatically looking up the appropriate IP address based on the relevant hostname that you entered into you browser fails to respond. </p>
<p>There are many reasons why this error occurs, but fortunately there are also many solutions available to you to fix the issue. </p>
<p>An easy solution may be to simply change the web browser you are using or even simpler still, simply restart your computer. Yup, simply turning it off and then turning it on again could fix the issue. </p>
<p>However, if you are not so lucky and the problem still persists, don’t despair – there are many steps that you can take to find out the cause of the issue and subsequently fix it. </p>
<p>In this article you will learn a number of possible solutions to the “DNS Server Not Responding” error.</p>
<h2 id="heading-how-to-fix-dns-serger-not-responding">How to Fix "DNS Serger Not Responding"</h2>
<p>Below, I've listed out the ways that you can try using to fix the “DNS Server Not Responding” error. The subsequent sections of this article provide details on each of these methods:</p>
<ul>
<li>Use a Different Web Browser</li>
<li>Try Accessing a Web Site with a Different Device</li>
<li>Restart your Router</li>
<li>Investigate Possible Network Issues</li>
<li>Manually Set your DNS Server</li>
<li>Clear the DNS Cache</li>
<li>Disable Internet Protocol Version 6</li>
<li>Temporarily Deactivate your Firewall and Disable your Antivirus Software</li>
<li>Reset your DNS Settings</li>
<li>Update the Network Adapter Driver</li>
<li>Disable all Network Connections Except the Connection you are Using to Access the Internet</li>
<li>Restart your Computer in Safe Mode</li>
</ul>
<h3 id="heading-use-a-different-web-browser">Use a Different Web Browser</h3>
<p>A potential solution to the “DNS Server not Responding” issue that's really simple is to try accessing the relevant website using a different browser. </p>
<p>If, for example, you are using Microsoft Edge or Mozilla Firefox as your browser at the time that the issue occurs, try using a different browser like Google Chrome to access the relevant website.</p>
<p>If using a different browser solves the problem, then make the browser that works your default browser. But if the issue still persists, then we at least know that the browser you have been using is not the source of the issue and our investigation into finding a solution to the DNS Server not Responding” issue must continue…</p>
<h3 id="heading-try-accessing-a-website-with-a-different-device">Try Accessing a Website With a Different Device</h3>
<p>Try to use a different device connected to your home network to access the website you were trying to access when you received the error. </p>
<p>For example, use Wi-Fi from your mobile phone to access the relevant web site. If the issue persists, you know that the issue isn’t just with your primary device and the problem may have something to do with your router.</p>
<h3 id="heading-restart-your-router">Restart Your Router</h3>
<p>The “DNS Server not Responding” issue may occur simply due to data traffic. It may be that simply restarting your router can fix this issue. </p>
<p>You can restart your router by pressing the power button on your router. You can then unplug your router's power cable. Wait for about 30 seconds then plug your router into the power outlet again and press the power button to restart it.</p>
<h3 id="heading-investigate-possible-network-issues">Investigate Possible Network Issues</h3>
<p>Running network diagnostics may point to network issues as the root cause of the issue. </p>
<p>Running Network Diagnostic is very simple on a Windows 10 OS. You can do this by following these steps:</p>
<ul>
<li>Open Control Panel. One way to do this is press the <strong>Windows Key + R</strong> to activate the “Run” box, then type “control” in the text box presented in the “Run” box and hit the enter key.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-443.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>Select the <strong>Network and Internet</strong> option presented within the Control Panel window.</li>
<li>Click the <strong>Network and Sharing Center</strong> option from within the “Network and Internet” window.</li>
<li>Click the <strong>Troubleshoot problems</strong> option presented under the "Change your network settings” heading within the “Network and Sharing Center” window.</li>
<li>Click <strong>Additional troubleshooters</strong> -&gt; <strong>Internet Connections</strong> -&gt; <strong>Run the troubleshooter</strong></li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-457.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The next step is to wait for the troubleshooter task to finish. If you are presented with any error messages, simply follow the steps on how to fix the relevant network issue.</p>
<h3 id="heading-manually-set-your-dns-server">Manually Set Your DNS Server</h3>
<p>The source of your issue may be that your DNS server is down. In this case you’ll be pleased to know that you are able to manually change your DNS server. </p>
<p>You can change your DNS server to, for example, Googles Public DNS or CloudFlare’s public DNS. To change your DNS server, follow these steps:</p>
<ul>
<li>Invoke your Control Panel. One way to invoke your Control Panel is to activate your Start Menu and search for the Control Panel.</li>
<li>In the Control Panel window click the <strong>Network and Internet</strong> option.</li>
<li>In the <strong>Network and Internet</strong> window, click the <strong>Network and Sharing Center</strong> option.</li>
<li>On the  <strong>Network and Sharing Center</strong> window click on your active connection. For example, click the “ethernet” option if this is the connection currently being used or click the “Wi-Fi” option if it is clear that this is your active connection.</li>
<li>In the dialog box that is presented to you, click the “Properties” button.</li>
<li>In the dialog presented to you, you’ll see a list is presented under the “The connection uses the following items” heading.</li>
<li>In this list, select the list item labelled “Internet protocol version 4 (TCP/IPv4)” then click the “Properties” button.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-445.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>You will be presented with another dialog box where you’ll see two fields. One will be labelled “Preferred DNS Server”, and the other which is directly under this field will be labelled “Alternate DNS Server”.</li>
<li>First click the <strong>Use the following DNS server addresses</strong> radio button.</li>
<li>To use Googles Public DNS server, enter 8.8.8.8 in the field labelled “Preferred DNS Server” and enter 8.8.4.4 into the field labelled “Alternate DNS Server”.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-446.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>You are also able to use CloudFlare’s DNS server for the same purpose. CloudFlare’s DNS address is simply 1.1.1.1</li>
<li>Once you have entered your desired DNS server settings, ensure that the “Validate settings upon exit” checkbox is checked.</li>
<li>Click the “OK” button to save your new DNS server settings.</li>
<li>Restart your computer.</li>
</ul>
<h3 id="heading-clear-the-dns-cache">Clear the DNS Cache</h3>
<p>You are able to flush the DNS cache which may resolve the “DNS Server not Responding” issue. This action will clear IP addresses and other DNS related data from  your cache.</p>
<p>You can clear the DNS cache by running a command using your command prompt.</p>
<p>One way to invoke the command prompt is to press <strong>Window Key + R</strong> to invoke the “Run” box. Type “cmd” within the “Run” box and press <strong>shift+ctrl+enter</strong> to run the command prompt as an administrator.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-458.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>At the command prompt, type in the following command: “ipconfig /flushdns” and them press the enter key. If the command has executed successfully, you'll see the appropriate message in the command window.</p>
<h3 id="heading-disable-internet-protocol-version-6">Disable Internet Protocol Version 6</h3>
<p>At the time of writing this article, Internet Protocol Version 6 is the latest version of the internet protocol. Disabling the Internet Protocol Version 6 will not have detrimental effects on your computer’s operations, but it's been known to fix the “DNS Server not Responding” issue.</p>
<p>To disable the Internet Protocol version 6 on a Windows 10 operating system, just follow these steps:</p>
<ul>
<li>Go to <strong>Control Panel</strong> -&gt; <strong>Network and Internet</strong> -&gt; <strong>Network and Sharing Center</strong></li>
<li>Click on the relevant connection, for example “Wi-Fi”</li>
<li>Click the “Properties” button on the dialog that is presented to you.</li>
<li>In the list presented under the “This connection uses the following items” heading, uncheck the item labelled “Internet Protocol Version 6 (TCP/IPv6)”.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-448.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>Press the “OK button”</li>
</ul>
<h3 id="heading-temporarily-deactivate-your-firewall-and-disable-antivirus">Temporarily Deactivate your Firewall and Disable Antivirus</h3>
<p>If your firewall is Defender, you can follow these steps to disable it:</p>
<ul>
<li>To open control panel, press <strong>Windows Key + R</strong> to activate the “Run” box, then type “control” in the text box presented in the “Run” box and hit the enter key.</li>
<li>In the top right hand text box, type in “win”</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-459.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>An option labelled "Windows Defender Firewall” should appear in the search results. Click the “Windows Defender Firewall” option.</li>
<li>Click the “Allow an app or feature through Windows Defender Firewall” option.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-462.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>Click the “Change settings” button.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-461.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>From the list presented to you within the dialog box that has just been invoked, find the browser that you are using, for example Google Chrome. Then make sure that both the private and public checkboxes next to the relevant item are checked.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-466.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>Once you've done this, try to access the relevant website using the relevant browser and see if the issue has been fixed.</li>
</ul>
<p>There is a chance that your firewall was preventing you from accessing external data through your browser. </p>
<p>Note that it is not recommended to leave your operating system unprotected by reliable antivirus software indefinitely. Disabling your antivirus software in this instance is only recommended for testing if the relevant antivirus software is the cause of the “DNS Server not Responding” issue. </p>
<p>To temporarily turn off Microsoft Defender antivirus protection, follow these steps:</p>
<ul>
<li>Select Start and then type in "Windows Security” in order to search for the relevant application.</li>
<li>Select <strong>Windows Security App</strong> from the search results.</li>
<li>Go to <strong>Virus &amp; Threat Protection</strong>.</li>
<li>Under <strong>Virus &amp; threat protection settings</strong> select <strong>Manage settings.</strong></li>
<li>Switch <strong>Real-time protection</strong> off.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-467.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Attempt to access the relevant website through the relevant browser to test if the “DNS Server not Responding” issue still occurs.</p>
<h3 id="heading-reset-dns-settings">Reset DNS Settings</h3>
<p>To reset your DNS Settings, follow these steps:</p>
<ul>
<li>Run the command prompt as an administrator. To do this activate the “Run” box by pressing <strong>Windows key + R</strong>.</li>
<li>In the run box type “cmd” and press <strong>shift + ctrl + enter</strong></li>
<li>Type the following commands in the command prompt. After entering each command press the enter key, so that each command is run individually.</li>
</ul>
<p><code>ipconfig /registerdns</code></p>
<p><code>ipconfig /release</code></p>
<p><code>Ipconfig /renew</code></p>
<p><code>netsh winsock reset</code></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-465.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Once you have run these commands, close the command prompt and restart your computer.</p>
<h3 id="heading-update-the-network-adapter-driver">Update the Network Adapter Driver</h3>
<p>You can manually update your network adapter driver, but it is much easier to automate this task. </p>
<p>You can automate this through the use of free software like “Driver Easy” (https://www.drivereasy.com/download-free-version/). Simply download the free version of this software. </p>
<p>Make sure that before you run the free version of the Driver Easy software that you create a system restore point. This provides you with insurance, so in the unlikely event that you encounter a nasty surprise that adversely effects your computer, that you are able to return your Windows OS back to the state that it was in before you ran the Driver Easy software and encountered an unexpected issue.</p>
<p>To use the Driver Easy software, follow these steps:</p>
<ul>
<li>Run the software</li>
<li>Click the “Scan Now” button</li>
<li>Press the “Update” button next to any outdated drivers.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-455.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-disable-all-network-connections-except-for-the-connection-that-you-are-using">Disable all Network Connections Except for the Connection that you are Using</h3>
<p>Disabling the additional network connections you may have setup on your computer (other than, for example, the Wi-Fi connection that you are using to access the internet) might fix the “DNS Server not Responding” issue. </p>
<p>To disable the relevant network connection, follow these steps:</p>
<ul>
<li>Firstly you must access your Network Connections. To access your Network Connections, press <strong>Windows Key + R</strong> to invoke the “Run” box</li>
<li>In the “Run” box type in “ncpa.cpl” and press enter.</li>
<li>Right click the relevant network connection and select “Disable” from the relevant context menu. Repeat this action until all connections except for the Wi-Fi connection you are using are disabled.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-456.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-restart-your-computer-in-safe-mode">Restart your Computer in Safe Mode</h3>
<p>When you start your computer in Safe Mode, this means the Windows operating system loads with a limited set of drivers and files. This can help you diagnose what is causing your “DNS Server not Responding” issue through a process of illumination (as it were). </p>
<p>So to start your PC in Safe Mode, follow these steps:</p>
<ul>
<li>Press the <strong>Windows Key + I</strong> to open Settings.</li>
<li>Select <strong>Update &amp; Security</strong> -&gt; <strong>Recovery</strong></li>
<li>Under <strong>Advanced startup</strong>, select <strong>Restart Now</strong></li>
<li>Once your PC has startup to the “Choose an option” screen, select <strong>Troubleshoot</strong> -&gt;  <strong>Advanced options</strong> -&gt; <strong>Startup Settings</strong> -&gt; <strong>Restart</strong></li>
<li>Once your PC has restarted you’ll see a list of options</li>
<li>Select <strong>5</strong> or press <strong>F5</strong> for Safe Mode with Networking.</li>
</ul>
<p>Try to access the web site that resulted in you getting the “DNS Server not Responding” issue. If the problem does not occur in safe mode this means that additional software may be the cause of the issue. </p>
<p>You can uninstall any additional software from your PC, one by one, and then test to see if the issue still occurs. If the issue does not occur after uninstalling particular software, this means that it is likely that this software was interfering with your internet access.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The “DNS Server not Responding” issue is relatively common and thankfully it is also relatively easy to fix. </p>
<p>It can be incredibly inconvenient to be denied access to the internet but hopefully the potential solutions outlined in this article will help you to once again have access to your favorite web sites.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Kernel Security Check Failure – How to Restart the Kernel in Windows 10 ]]>
                </title>
                <description>
                    <![CDATA[ I’ve been a professional software engineer for many years, and I can testify that there are few things worse than getting the dreaded BSOD (Blue Screen of Death). Especially when you are about to write a piece of mind bending code at 2am to meet a lo... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/kernel-security-check-failure-how-to-restart-the-kernel-in-windows-10/</link>
                <guid isPermaLink="false">66b0c58a374aa69009200c24</guid>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows 10 ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Gavin Lon ]]>
                </dc:creator>
                <pubDate>Wed, 14 Sep 2022 15:41:50 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/09/ScreenShot1_BSOD_Anger.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I’ve been a professional software engineer for many years, and I can testify that there are few things worse than getting the dreaded BSOD (Blue Screen of Death). Especially when you are about to write a piece of mind bending code at 2am to meet a looming deadline. </p>
<p>That’s just my perspective as a software engineer, but let’s face it – using a computer these days is absolutely essential for most professionals. </p>
<p>The point is the blue screen of death is about as welcome as a pigeon on a chessboard at a world champion chess tournament under almost any circumstances.</p>
<h3 id="heading-what-youll-learn">What You'll Learn</h3>
<p>In this article, we are going to look at one particularly pernicious cause of the BDOS, the dreaded "Kernel Security Check Failure" issue. We'll also see how you can fix this, should you be faced with this abominable issue. </p>
<h2 id="heading-common-causes-for-the-bsod">Common Causes for the BSOD</h2>
<p>Common reasons you might get the "Kernel Security Check Failure" issue are corrupted system files, faulty hardware, or outdated drivers.</p>
<h3 id="heading-corrupted-system-files">Corrupted system files</h3>
<p>Malware is the most likely cause of corrupted system files. The nomenclature of ‘Malware’ is a contraction of the term ‘Malicious Software’. This is software deliberately designed to be intrusive and cause disruption when you're working on your computer. </p>
<p>You have probably heard of terms like virus, trojan horse virus, worms, spyware, ransom ware, and so on. These are all examples of malicious software, Malware.</p>
<h3 id="heading-faulty-hardware">Faulty hardware</h3>
<p>Faulty RAM (memory) or a corrupted or damaged hard disk drive could be the cause of the issue.</p>
<h3 id="heading-outdated-drivers">Outdated drivers</h3>
<p>Out of all the possible causes of this "Kernel Security Check Failure" issue, the most likely cause is outdated drivers. </p>
<p>The outdated drivers issue may have arisen from upgrading from an older version of Windows to Windows 10. The relevant driver may have worked perfectly on the older version of Windows but may be incompatible with Windows 10.</p>
<h2 id="heading-what-is-the-blue-screen-of-death">What is the Blue Screen of Death?</h2>
<p>Typically you become aware of the "Kernel Security Check Failure" issue during Windows startup. This is where Windows performs a check process. If, during this process, Windows detects corruption in any critical data structures, the Kernel_Security_check_failure error is thrown. </p>
<p>As you can see by the screenshot below there is very little detail about the error. Thankfully, the message does include a stop code (highlighted in yellow) to help identify why you're presented with the dreaded BSOD.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-347.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-how-to-fix-the-kernel-security-check-failure-error">How to Fix the Kernel Security Check Failure Error</h2>
<p>Fortunately there are many potential fixes available to resolve the "Kernel Security Check Failure" issue.  </p>
<p>To solve the issue, you can go through an investigation process in order to pinpoint the cause of the issue. Once you have learned the cause of the issue, you'll know which of the fixes to apply. </p>
<p>But a quick fix which is the first item in the list of possible fixes provided in this article might be as simple as updating your system to the latest version of Windows 10. </p>
<p>You can see below a list of fixes discussed in this article. The subsequent sections contain step by step instructions for each potential fix in the list.</p>
<ul>
<li>Update to the Latest Released Version of Windows 10 </li>
<li>Update Drivers that Need to be Updated</li>
<li>Check for Viruses</li>
<li>Investigate Possible Corrupted Windows File System</li>
<li>Test to see if Disabling Antivirus Software Fixes the Issue</li>
<li>Investigate Possible Issues with RAM</li>
<li>Investigate Possible Hard Disk Drive Issues</li>
<li>Test to see if Disabling Antivirus Software Fixes the Issue</li>
<li>Start PC in Safe Mode</li>
</ul>
<h3 id="heading-update-to-the-latest-released-version-of-windows-10">Update to the Latest Released Version of Windows 10</h3>
<p>This maybe the easiest way to fix the issue. To update Windows 10 to the latest version of Windows, you can take the following steps:</p>
<ul>
<li>Click Windows key + I to invoke the Settings App.</li>
<li>Click the “Update &amp; Security” tile.</li>
<li>Click the “Check for Updates” button (status information will be presented on the screen regarding the download and installation progress)</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-348.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>After the update is complete, check to see if the BSOD still occurs.</li>
</ul>
<h3 id="heading-update-drivers-that-need-to-be-updated">Update Drivers that Need to be Updated</h3>
<p>One easy way to check for drivers with issues is by using Device Manager.</p>
<p>To invoke Device Manager, press the Windows key + X. In the dialog that will be presented to you, a tree structure is displayed.</p>
<p>If you expand all of the nodes in the tree structure it should be apparent as to which drivers need to be updated – you'll see an exclamation mark with a yellow background colour next to the nodes that represent the drivers that need to be updated.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-349.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>To update a driver, simply right click on the node that represents the relevant driver (that needs to be updated) and click the “Update driver” context menu item. </p>
<p>You'll then see two options: you can either select the option whereby Windows 10 will search for the driver automatically, or you can choose the manual option and search your computer for the relevant new driver file that may already exist on your computer.</p>
<p>The next step is to allow the driver installation update to complete.</p>
<p>You can then continue to check for other problematic drivers by inspecting Device Manager for nodes that contain exclamation marks with yellow backgrounds. If you find any more, you can update those drivers until all the problematic drivers have been appropriately updated.</p>
<p>Then you just need to restart your computer so that the changes created by the new drivers are completed. Hopefully this eliminates your BSOD issue.</p>
<p>If the issue still occurs, your investigation must continue…</p>
<h3 id="heading-check-for-viruses"><strong>Check for Viruses</strong></h3>
<p>You must ensure that you have installed the latest Windows updates on your PC and use the antivirus software to check for viruses. </p>
<p>If one or more viruses are found, take the necessary action to remove the virus or viruses from your computer.</p>
<h3 id="heading-investigate-possible-corrupted-windows-file-system">Investigate Possible Corrupted Windows File System</h3>
<p>You can use the System File checker (SFC) tool to fix corrupt system files. Below are the steps that you can follow in order to run the System File checker tool.</p>
<ul>
<li>From the desktop, use the Windows + R key to open the “Run” box</li>
<li>In the the “Run” box, type in “cmd” then press ctrl+shift+enter to launch the command prompt with administrative privileges.</li>
<li>Click the "Yes" button on the "User Account Control"ss (UAC) prompt</li>
<li>Type “SFC /scannow” in the command prompt window and press “Enter”.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-350.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The System file checker utility will check the integrity of Windows system files and will perform appropriate repair operations if required.</p>
<p>Reboot your computer after the process is completed.</p>
<h3 id="heading-test-to-see-if-disabling-antivirus-software-fixes-the-issue">Test to see if Disabling Antivirus Software Fixes the Issue</h3>
<p>Antivirus software, even though well-intentioned, can inadvertently block non-harmful services and apps from running correctly. </p>
<p>This method will tell you (as it were) that your antivirus software may be the cause of your issue – but please be aware that it is not recommended that you run your computer without the protection of appropriate antivirus software.</p>
<p>To temporarily disable your antivirus software, you can simply invoke the task manager window. You can do this by pressing ctrl+shift+escape on your keyboard.</p>
<p>If task manager loads in compact mode, click the “More details” option. Then select the "Startup" tab at the top of the "Task Manager" Window.</p>
<p>Find the name representing your antivirus application and click the relevant list item.</p>
<p>Then click the disable button that will be present in the right hand corner of the Task Manager window.</p>
<p>Finally, restart computer and see if the BSOD still appears. </p>
<p>Again, remember that even if this fixes the issue, you shouldn't run your computer without antivirus software. So you'll likely need to look into alternatives for protection.</p>
<h3 id="heading-investigate-possible-issues-with-ram">Investigate Possible Issues with RAM</h3>
<p>To identify RAM (memory) issues you can invoke the built-in Windows 10 scanner. To do this click on the search magnifying glass icon in the taskbar or press the Windows Key + S.</p>
<p>Type "Memory Diagnostics" in the search text box and run the first option presented in the search results.</p>
<p>In the popup dialog box that is presented, select “Restart now and check for problems (recommended)” option to kick off the diagnostic process.</p>
<p>During the boot process the memory diagnostic process will attempt to identify possible errors and issues regarding RAM. If issues are found, they will be reported to you.</p>
<h3 id="heading-investigate-possible-hard-disk-drive-issues">Investigate Possible Hard Disk Drive Issues</h3>
<p>You can scan your hard disks for any inconsistencies and errors using the check disk tool.</p>
<p>To run the check disk tool, make sure that you are logged onto windows with an administrator account. Then follow these steps:</p>
<ul>
<li>At the desktop, click Windows Key + R to launch the “Run” box.</li>
<li>In the "Run" box, type in “cmd” then press ctrl+shift+enter to run the command prompt as administrator.</li>
<li>Click the "Yes" button on the "User Account Control" (UAC) prompt.</li>
<li>Type in “chkdsk c: /f” and press enter</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-351.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The “/f” option will attempt to fix any found errors</p>
<p>You could also include the “/r” option and the  “/x” option with this command. The “/r” option will locate bad sectors and recover any readable information, while the “/x” option forces the disk drive (about to be checked) to dismount before the utility begins a scan.</p>
<h3 id="heading-start-pc-in-safe-mode">Start PC in Safe Mode</h3>
<p>You can start your PCs in safe mode so that Windows 10 is booted with minimal files and drivers. To boot up Windows 10 in safe mode, you can follow these steps:</p>
<ul>
<li>Press Windows Key + I to invoke the Settings App.</li>
<li>Under the "Update &amp; Security" heading, select the "Recovery" tab.</li>
<li>Under the "Advanced Startup" heading in the right pane, press the "Restart Now" button.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/09/image-352.png" alt="Image" width="600" height="400" loading="lazy"></p>
<ul>
<li>After the PC restarts to the “Choose an option<strong>”</strong> screen, select Troubleshoot &gt; Advanced options &gt; Startup Settings &gt; Restart.</li>
</ul>
<p>After the PC restarts, you are presented with a list of options. Select “4” or press “F4” to start PC in Safe Mode. Or if you need to use the internet, you can select <strong>“</strong>5<strong>”</strong> or press <strong>“</strong>F5<strong>”</strong> for Safe Mode with Networking. </p>
<p>If the issue does not occur in safe mode, this means that the default settings and basic device drivers aren't causing the issue. </p>
<p>Assuming the problem does not occur in safe mode, you now know that the issue must be caused by an additional driver or application that runs in normal mode.</p>
<p>Using a process of elimination, you can now focus on the relevant additional drivers and applications. You can systematically uninstall each of the relevant applications starting with the most recently installed ones and working your way from most recently installed to the least recently installed. </p>
<p>With each uninstall you can test for the problem. This will hopefully pinpoint the application or program that was the cause of the issue. Then you can uninstall the relevant software to hopefully get rid of the issue.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In conclusion, the Kernel Security Check Failure issue can be a huge inconvenience. But hopefully the steps provided in this article will help you fix the issue.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Discord Update Failed – How to Fix the Error on a Windows 10 PC ]]>
                </title>
                <description>
                    <![CDATA[ Discord is a popular chat app for gamers and anyone else who wants to create an online community. Despite its popularity, one major problem users report about Discord is the update failed loop. Discord has to update often because the Discord team imp... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/discord-update-failed-how-to-fix-the-error-on-a-windows-10-pc/</link>
                <guid isPermaLink="false">66adf0b3febac312b73075a6</guid>
                
                    <category>
                        <![CDATA[ Chat ]]>
                    </category>
                
                    <category>
                        <![CDATA[ discord ]]>
                    </category>
                
                    <category>
                        <![CDATA[ update  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows 10 ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Kolade Chris ]]>
                </dc:creator>
                <pubDate>Thu, 18 Aug 2022 15:31:45 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/discord--1-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Discord is a popular chat app for gamers and anyone else who wants to create an online community. Despite its popularity, one major problem users report about Discord is the update failed loop.</p>
<p>Discord has to update often because the Discord team implements new features and bug fixes regularly. </p>
<p>In addition, the app itself must load new messages from chat rooms and DMs. Once the update fails, Discord gets stuck in an update failed loop.</p>
<p>In this guide, I will show you 4 ways you can fix the Discord update failed error on a Windows 10 computer.</p>
<h2 id="heading-what-well-cover">What We'll Cover</h2>
<ul>
<li><a class="post-section-overview" href="#heading-solution-1-double-check-your-internet-connection">Double-check your Internet Connection</a></li>
<li><a class="post-section-overview" href="#heading-solution-2-run-discord-as-an-administrator">Run Discord as an Administrator</a></li>
<li><a class="post-section-overview" href="#heading-solution-3-rename-discords-updateexe-file">Rename Discord’s Update.exe File</a></li>
<li><a class="post-section-overview" href="#heading-solution-4-temporarily-disable-your-antivirus-program-and-vpn">Temporarily Disable your Antivirus Program and VPN</a></li>
<li><a class="post-section-overview" href="#heading-solution-5-uninstall-and-reinstall-discord">Uninstall and Reinstall Discord</a></li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-solution-1-double-check-your-internet-connection">Solution 1: Double-check your Internet Connection</h2>
<p>The first thing I would suggest you do is to check your internet connection.</p>
<p>That’s because Discord needs an internet connection to update, as the update has to be done over the internet. Once there’s no internet connection, the update won’t happen.</p>
<p>Make sure your Windows 10 PC is connected to the internet and the internet connection is strong enough.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss1-4.png" alt="ss1-4" width="600" height="400" loading="lazy">
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss2-4.png" alt="ss2-4" width="600" height="400" loading="lazy"> </p>
<h2 id="heading-solution-2-run-discord-as-an-administrator">Solution 2: Run Discord as an Administrator</h2>
<p>A common solution to this issue is to run the Discord app as an admin. </p>
<p>This could fix the issue because any app you want to install needs admin privileges. Discord is not an exception, so granting it admin privileges can make it dig deeper into the issue and resolve it.</p>
<p>To run Discord as administrator, search for Discord and select Run as Administrator on the right:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss3-4.png" alt="ss3-4" width="600" height="400" loading="lazy"></p>
<h2 id="heading-solution-3-rename-discords-updateexe-file">Solution 3: Rename Discord’s Update.exe File</h2>
<p>There’s a separate executable for updating Discord. This is the update.exe file in the Discord folder. </p>
<p>Renaming this file can force Discord to download a fresh one and subsequently fix the issue for you.</p>
<p><strong>Follow these steps to rename Discord’s update.exe file</strong>
Press <code>WIN</code> (Windows logo key) + <code>R</code> on your keyboard and type in <code>%localappdata%</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss4-5.png" alt="ss4-5" width="600" height="400" loading="lazy"></p>
<p>Look for the Discord folder and open it.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss5-5.png" alt="ss5-5" width="600" height="400" loading="lazy"></p>
<p>Right-click on the <code>Update.exe</code> file and select rename. Then rename it to something like “Updater.exe”. You must not change the extension.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss6-4.png" alt="ss6-4" width="600" height="400" loading="lazy"> </p>
<p>Open the app again and see if the problem gets fixed.</p>
<h2 id="heading-solution-4-temporarily-disable-your-antivirus-program-and-vpn">Solution 4: Temporarily Disable your Antivirus Program and VPN</h2>
<p>Antivirus programs and VPNs are known for interfering with the normal functioning of computers and internet connections. So if you have one or both of them on your PC, it might be stopping Discord from updating.</p>
<p>To disable your antivirus and VPN, open Task Manager, right-click on <code>WIN</code> (Windows logo key) and select Task Manager.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss7-3.png" alt="ss7-3" width="600" height="400" loading="lazy"></p>
<p>Under processes, right-click on Discord and select “End Task”.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss8-3.png" alt="ss8-3" width="600" height="400" loading="lazy"> </p>
<h2 id="heading-solution-5-uninstall-and-reinstall-discord">Solution 5: Uninstall and Reinstall Discord</h2>
<p>If the solutions already discussed fail to work for you, the last resort is to uninstall Discord and reinstall it.</p>
<p><strong>Step 1</strong>: Head over to Control Panel and select Uninstall a Program.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss9-2.png" alt="ss9-2" width="600" height="400" loading="lazy"> </p>
<p><strong>Step 2</strong>: Look for Discord, right-click on it and select uninstall.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss10-2.png" alt="ss10-2" width="600" height="400" loading="lazy"> </p>
<p><strong>Step 3</strong>: To completely remove Discord, press <code>WIN</code> + <code>R</code> on your keyboard, type <code>%localappdata%</code>, and click OK.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss4-5.png" alt="ss4-5" width="600" height="400" loading="lazy"></p>
<p><strong>Step 4</strong>: Right-click on the Discord folder and select Delete.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss11-2.png" alt="ss11-2" width="600" height="400" loading="lazy"> </p>
<p><strong>Step 4</strong>: <a target="_blank" href="https://discord.com/download">Download Discord</a> again and install it.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss12-2.png" alt="ss12-2" width="600" height="400" loading="lazy"></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I hope the solutions discussed above help you get Discord to update so you can start using it again.</p>
<p>Thank you for reading.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ NVM for Windows – How to Download and Install Node Version Manager in Windows 10 ]]>
                </title>
                <description>
                    <![CDATA[ Different software development tools might require specific versions of Node.js and NPM (Node Package Manager). NPM is a tool for managing packages installed from the NPM registry. In addition, if you are making an NPM package, you might need to test... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/nvm-for-windows-how-to-download-and-install-node-version-manager-in-windows-10/</link>
                <guid isPermaLink="false">66adf1abf452caf50fb1fe07</guid>
                
                    <category>
                        <![CDATA[ node ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Node.js ]]>
                    </category>
                
                    <category>
                        <![CDATA[ npm ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Kolade Chris ]]>
                </dc:creator>
                <pubDate>Thu, 11 Aug 2022 16:00:37 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/nvmWindows.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Different software development tools might require specific versions of Node.js and NPM (Node Package Manager). NPM is a tool for managing packages installed from the NPM registry.</p>
<p>In addition, if you are making an NPM package, you might need to test it with different versions of Node.js. This is why you should have NVM installed.</p>
<p>NVM, short for Node Version Manager, is a command line tool for managing and switching to different versions of Node.js.</p>
<p>In this article, I will show you how to download and install NVM on Windows 10 – even though there’s no “NVM” for Windows.</p>
<p>I will also show you how to set up and use different versions of Node.js and NPM on your Windows computer.</p>
<h2 id="heading-what-well-cover">What We'll Cover</h2>
<ul>
<li><a class="post-section-overview" href="#heading-how-to-download-and-install-node-version-manager-in-windows-10">How to Download and Install Node Version Manager in Windows 10</a><ul>
<li><a class="post-section-overview" href="#heading-follow-the-steps-below-to-download-nvm-windows">Follow the steps below to download nvm-windows</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-how-to-use-nvm-on-windows-10">How to Use NVM on Windows 10</a><ul>
<li><a class="post-section-overview" href="#heading-how-to-install-different-versions-of-nodejs-and-npm-with-nvm">How to Install Different Versions of Node.js and NPM with NVM</a></li>
</ul>
</li>
<li><a class="post-section-overview" href="#heading-recap">Recap</a></li>
</ul>
<h2 id="heading-how-to-download-and-install-node-version-manager-in-windows-10">How to Download and Install Node Version Manager in Windows 10</h2>
<p>As I mentioned earlier, there’s no “NVM” for Windows, as NVM is only supported on Linux and Mac. </p>
<p>What you will be using on your Windows machine is “nvm-windows”. nvm-windows is similar to NVM, but not identical to it.</p>
<p><strong>N.B.</strong>: If you have Node.js installed already, you need to uninstall it so it doesn’t lead to errors when using different versions of Node and installing packages from the NPM registry. </p>
<p>Restart your PC after that, open the command prompt or PowerShell, and run <code>node -v</code> to confirm Node has been uninstalled.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss1-2.png" alt="ss1-2" width="600" height="400" loading="lazy"></p>
<p>In addition, if you have yarn installed, uninstall it and reinstall it after installing NVM. You don’t want to get weird errors while installing and using packages from the NPM registry.</p>
<h3 id="heading-follow-the-steps-below-to-download-nvm-windows">Follow the steps below to download nvm-windows</h3>
<ul>
<li><strong>Step 1</strong>: Head over to the <a target="_blank" href="https://github.com/coreybutler/nvm-windows#installation--upgrades">nvm-windows repository</a> and click on Download Now!”
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss2-2.png" alt="ss2-2" width="600" height="400" loading="lazy"></li>
</ul>
<p>You’ll be taken to a page containing different versions of nvm-windows.</p>
<ul>
<li><p><strong>Step 2</strong>: Click on the latest version to download it. For now, it is the April 28, 2022 version.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss3-2.png" alt="ss3-2" width="600" height="400" loading="lazy"></p>
</li>
<li><p><strong>Step 3</strong>: Locate the installer on your computer and open it. Follow the installation wizard to install it.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss4-2.png" alt="ss4-2" width="600" height="400" loading="lazy">
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss5-3.png" alt="ss5-3" width="600" height="400" loading="lazy"></p>
</li>
<li><p><strong>Step 4</strong>: Open up PowerShell or Command Prompt and run <code>nvm -v</code> to confirm the installation.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss6-2.png" alt="ss6-2" width="600" height="400" loading="lazy"></p>
</li>
</ul>
<p>If you get the same message I got above, then nvm-windows has been successfully installed. Congrats!</p>
<h2 id="heading-how-to-use-nvm-on-windows-10">How to Use NVM on Windows 10</h2>
<p>To use NVM, you need to open PowerShell or Command Prompt as an admin. You can also use Git bash.</p>
<ul>
<li><p>To open PowerShell as admin, right-click on Start and select “PowerShell (Admin)”.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/powershell-admin.png" alt="powershell-admin" width="600" height="400" loading="lazy"></p>
</li>
<li><p>To open Command Prompt as admin, search for “cmd” and select “Open as Administrator” on the right.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/cmd-admin.png" alt="cmd-admin" width="600" height="400" loading="lazy"></p>
</li>
</ul>
<h3 id="heading-how-to-install-different-versions-of-nodejs-and-npm-with-nvm">How to Install Different Versions of Node.js and NPM with NVM</h3>
<p>The superpower NVM gives you is the ability to have multiple versions of Node.js installed on your machine. </p>
<p>To install the latest version of Node, run <code>nvm install latest</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss7-1.png" alt="ss7-1" width="600" height="400" loading="lazy"></p>
<p>It is always better to install the long-term support (LTS) version of Node because it is less buggy.</p>
<p>To install the LTS version of Node, run <code>nvm install lts</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss8-1.png" alt="ss8-1" width="600" height="400" loading="lazy"></p>
<p>To install a specific version of Node, you need to run <code>nvm list available</code> first so you can see the versions of Node that are available.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss9-1.png" alt="ss9-1" width="600" height="400" loading="lazy"></p>
<p>To install that specific version, run <code>nvm install node-version-number</code>. For example, <code>nvm install 14.20.0</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss10-1.png" alt="ss10-1" width="600" height="400" loading="lazy"></p>
<p><strong>N.B.</strong>: Once you install a version of Node, the corresponding version of NPM is installed for you. So you don’t need to install NPM separately. </p>
<p>If the version of NPM you want to use is not available, run <code>npm install @npm version-number -g</code> to install it.</p>
<p>Now, to see the list of Node versions you have installed on your Windows machine, run <code>nvm list</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss11-1.png" alt="ss11-1" width="600" height="400" loading="lazy"></p>
<p>To use a specific version of Node, run: </p>
<ul>
<li><code>nvm use latest</code> to use the latest version </li>
<li><code>nvm use lts</code> to use the long-term support version</li>
<li><code>nvm use version-number</code> to use any other version you have installed
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss12-1.png" alt="ss12-1" width="600" height="400" loading="lazy"></li>
</ul>
<h2 id="heading-recap">Recap</h2>
<p>This article showed you how to install NVM on Windows 10 (nvm-windows) and how to use it to install and manage different versions of Node.</p>
<p>As a reminder, here are the common commands you’ll be using with nvm-windows:</p>
<ul>
<li><code>nvm install node-version</code> – install a version of Node </li>
<li><code>nvm list</code> – see the versions of Node you have installed on your machine</li>
<li><code>nvm use node-version</code> – use a specific version of Node</li>
</ul>
<p>Thank you for reading and keep coding :)</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Command Line Commands – CLI Tutorial ]]>
                </title>
                <description>
                    <![CDATA[ The Windows command line is one of the most powerful utilities on a Windows PC. With it, you can interact with the OS directly and do a lot of things not available in the graphical user interface (GUI). In this article, I’ll show you 40 commands you ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/command-line-commands-cli-tutorial/</link>
                <guid isPermaLink="false">66adf0826778e7bd69427bea</guid>
                
                    <category>
                        <![CDATA[ command line ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Kolade Chris ]]>
                </dc:creator>
                <pubDate>Tue, 09 Aug 2022 15:28:14 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/cli.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The Windows command line is one of the most powerful utilities on a Windows PC. With it, you can interact with the OS directly and do a lot of things not available in the graphical user interface (GUI).</p>
<p>In this article, I’ll show you 40 commands you can use on the Windows command line that can boost your confidence as a Windows user.</p>
<p><strong>N.B.</strong>: You have to be careful while using the commands I’ll show you. This is because some commands can have a lasting negative or positive effect on your Windows PC until you reset it.</p>
<p>In addition, some of these commands require you to open the command prompt as an admin.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss5-1.png" alt="ss5-1" width="600" height="400" loading="lazy"></p>
<h2 id="heading-windows-command-line-commands">Windows Command Line Commands</h2>
<h3 id="heading-powershell-start-cmd-v-runas-run-the-command-prompt-as-an-administrator"><code>powershell start cmd -v runAs</code> – Run the Command Prompt as an Administrator</h3>
<p>Entering this command opens another command prompt window as an administrator:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss1-1.png" alt="ss1-1" width="600" height="400" loading="lazy"></p>
<h3 id="heading-driverquery-lists-all-installed-drivers"><code>driverquery</code> – Lists All Installed Drivers</h3>
<p>It is important to have access to all drivers because they often cause problems. </p>
<p>That’s what this command does – it shows you even the drivers you won’t find in the device manager.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss2-1.png" alt="ss2-1" width="600" height="400" loading="lazy"></p>
<h3 id="heading-chdir-or-cd-changes-the-current-working-directory-to-the-specified-directory"><code>chdir</code> or <code>cd</code> – Changes the Current Working Directory to the Specified Directory</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss3-1.png" alt="ss3-1" width="600" height="400" loading="lazy"></p>
<h3 id="heading-systeminfo-shows-your-pcs-details"><code>systeminfo</code> – Shows Your PC's Details</h3>
<p>If you want to see more detailed information about your system you won’t see in the GUI, this is the command for you.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss4-1.png" alt="ss4-1" width="600" height="400" loading="lazy"></p>
<h3 id="heading-set-shows-your-pcs-environment-variables"><code>set</code> – Shows your PC’s Environment Variables</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss5-2.png" alt="ss5-2" width="600" height="400" loading="lazy"></p>
<h3 id="heading-prompt-changes-the-default-text-shown-before-entering-commands"><code>prompt</code> – Changes the Default Text Shown before Entering Commands</h3>
<p>By default, the command prompt shows the C drive path to your user account. </p>
<p>You can use the <code>prompt</code> command to change that default text with the syntax <code>prompt prompt_name $G</code>:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss6-1.png" alt="ss6-1" width="600" height="400" loading="lazy"></p>
<p><strong>N.B</strong>: If you don’t append <code>$G</code> to the command, you won’t get the greater than symbol in front of the text.</p>
<h3 id="heading-clip-copies-an-item-to-the-clipboard"><code>clip</code> – Copies an Item to the Clipboard</h3>
<p>For example, <code>dir | clip</code> copies all the content of the present working directory to the clipboard.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss7.png" alt="ss7" width="600" height="400" loading="lazy"></p>
<p>You can type <code>clip /?</code> and hit <code>ENTER</code> to see how to use it.</p>
<h3 id="heading-assoc-lists-programs-and-the-extensions-they-are-associated-with"><code>assoc</code> – Lists Programs and the Extensions They are Associated With</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss8.png" alt="ss8" width="600" height="400" loading="lazy"></p>
<h3 id="heading-title-changes-the-command-prompt-window-title-using-the-format-title-window-title-name"><code>title</code> – Changes the Command Prompt Window Title Using the Format <code>title window-title-name</code></h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss9.png" alt="ss9" width="600" height="400" loading="lazy"></p>
<h3 id="heading-fc-compares-two-similar-files"><code>fc</code> – Compares Two Similar Files</h3>
<p>If you are a programmer or writer and you want to quickly see what differs between two files, you can enter this command and then the full path to the two files. For example <code>fc “file-1-path” “file-2-path”</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss10.png" alt="ss10" width="600" height="400" loading="lazy"></p>
<h3 id="heading-cipher-wipes-free-space-and-encrypts-data"><code>cipher</code> – Wipes Free Space and Encrypts Data</h3>
<p>On a PC, deleted files remain accessible to you and other users. So, technically, they are not deleted under the hood. </p>
<p>You can use the cipher command to wipe the drive clean and encrypt such files.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss11.png" alt="ss11" width="600" height="400" loading="lazy"></p>
<h3 id="heading-netstat-an-shows-open-ports-their-ip-addresses-and-states"><code>netstat -an</code> – Shows Open Ports, their IP Addresses and States</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss12.png" alt="ss12" width="600" height="400" loading="lazy"></p>
<h3 id="heading-ping-shows-a-website-ip-address-lets-you-know-how-long-it-takes-to-transmit-data-and-a-get-response"><code>ping</code> – Shows a Website IP Address, Lets you Know How Long it Takes to Transmit Data and a Get Response</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss13.png" alt="ss13" width="600" height="400" loading="lazy"></p>
<h3 id="heading-color-changes-the-text-color-of-the-command-prompt"><code>color</code> – Changes the Text Color of the Command Prompt</h3>
<p>Enter <code>color attr</code> to see the colors you can change to:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss14.png" alt="ss14" width="600" height="400" loading="lazy"></p>
<p>Entering <code>color 2</code> changes the color of the terminal to green:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss15.png" alt="ss15" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-for-f-skip9-tokens12-delims-i-in-netsh-wlan-show-profiles-do-echo-j-findstr-i-v-echo-netsh-wlan-show-profiles-j-keyclear-shows-all-wi-fi-passwords"><code>for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear</code> – Shows All Wi-Fi Passwords</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss16.png" alt="ss16" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-ipconfig-shows-information-about-pc-ip-addresses-and-connections"><code>ipconfig</code> – Shows Information about PC IP Addresses and Connections</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss17.png" alt="ss17" width="600" height="400" loading="lazy"> </p>
<p>This command also has extensions such as <code>ipconfig /release</code>, <code>ipconfig /renew</code>, and <code>ipconfig /flushdns</code> which you can use to troubleshoot issues with internet connections.</p>
<h3 id="heading-sfc-system-file-checker"><code>sfc</code> – System File Checker</h3>
<p>This command scans your computer for corrupt files and repairs them. The extension of the command you can use to run a scan is <code>/scannow</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss18.png" alt="ss18" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-powercfg-controls-configurable-power-settings"><code>powercfg</code> – Controls Configurable Power Settings</h3>
<p>You can use this command with its several extensions to show information about the power state of your PC. </p>
<p>You can enter <code>powercfg help</code> to show those extensions.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss19.png" alt="ss19" width="600" height="400" loading="lazy"> </p>
<p>For example, you can use <code>powercfg /energy</code> to generate a battery health report.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss20.png" alt="ss20" width="600" height="400" loading="lazy"> </p>
<p>The <code>powercfg /energy</code> command will generate an HTML file containing the report. You can find the HTML file in <code>C:\Windows\system32\energy-report.html</code>.</p>
<h3 id="heading-dir-lists-items-in-a-directory"><code>dir</code> – Lists Items in a Directory</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss21.png" alt="ss21" width="600" height="400" loading="lazy"></p>
<h3 id="heading-del-deletes-a-file"><code>del</code> – Deletes a File</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss22.png" alt="ss22" width="600" height="400" loading="lazy"></p>
<h3 id="heading-attrib-h-s-r-foldername-hides-a-folder"><code>attrib +h +s +r folder_name</code> – Hides a Folder</h3>
<p>You can hide a folder right from the command line by typing in <code>attrib +h +s +r folder_name</code> and then pressing <code>ENTER</code>.</p>
<p>To show the folder again, execute the command <code>– attrib -h -s -r folder_name</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss23.png" alt="ss23" width="600" height="400" loading="lazy"></p>
<h3 id="heading-start-website-address-logs-on-to-a-website-from-the-command-line"><code>start website-address</code> – Logs on to a Website from the Command Line</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss24.png" alt="ss24" width="600" height="400" loading="lazy">
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss25.png" alt="ss25" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-tree-shows-the-tree-of-the-current-directory-or-specified-drive"><code>tree</code> – Shows the Tree of the Current Directory or Specified Drive</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss26.png" alt="ss26" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-ver-shows-the-version-of-the-os"><code>ver</code> – Shows the Version of the OS</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss27.png" alt="ss27" width="600" height="400" loading="lazy"></p>
<h3 id="heading-tasklist-shows-open-programs"><code>tasklist</code> – Shows Open Programs</h3>
<p>You can do the same thing you do with the task manager with this command:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss28.png" alt="ss28" width="600" height="400" loading="lazy">
The next command shows you how to close an open task.</p>
<h3 id="heading-taskkill-terminates-a-running-task"><code>taskkill</code> – Terminates a Running Task</h3>
<p>To kill a task, run <code>taskkill /IM "task.exe" /F</code>. For example, <code>taskkill /IM "chrome.exe" /F</code>:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss29.png" alt="ss29" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-date-shows-and-changes-the-current-date"><code>date</code> – Shows and Changes the Current Date</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss30.png" alt="ss30" width="600" height="400" loading="lazy"></p>
<h3 id="heading-time-shows-and-changes-the-current-time"><code>time</code> – Shows and Changes the Current Time</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss31.png" alt="ss31" width="600" height="400" loading="lazy"></p>
<h3 id="heading-vol-shows-the-serial-number-and-label-info-of-the-current-drive"><code>vol</code> – Shows the Serial Number and Label Info of the Current Drive</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss32.png" alt="ss32" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-dism-runs-the-deployment-image-service-management-tool"><code>dism</code> – Runs the Deployment Image Service Management Tool</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss33.png" alt="ss33" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-ctrl-c-stops-the-execution-of-a-command"><code>CTRL + C</code> – Stops the Execution of a Command</h3>
<h3 id="heading-help-provides-a-guide-to-other-commands"><code>-help</code> – Provides a Guide to other Commands</h3>
<p>For example, <code>powercfg -help</code> shows how to use the <code>powercfg</code> command
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss34.png" alt="ss34" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-echo-shows-custom-messages-or-messages-from-a-script-or-file"><code>echo</code> – Shows Custom Messages or Messages from a Script or File</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss35.png" alt="ss35" width="600" height="400" loading="lazy"> </p>
<p>You can also use the <code>echo</code> command to create a file with this syntax <code>echo file-content &gt; filename.extension</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss36.png" alt="ss36" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-mkdir-creates-a-folder"><code>mkdir</code> – Creates a Folder</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss37.png" alt="ss37" width="600" height="400" loading="lazy"></p>
<h3 id="heading-rmdir-deletes-a-folder"><code>rmdir</code> – Deletes a Folder</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss38.png" alt="ss38" width="600" height="400" loading="lazy"></p>
<p><strong>N.B.:</strong> The folder must be empty for this command to work.</p>
<h3 id="heading-more-shows-more-information-or-the-content-of-a-file"><code>more</code> – Shows More Information or the Content of a File</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss39.png" alt="ss39" width="600" height="400" loading="lazy"> </p>
<h3 id="heading-move-moves-a-file-or-folder-to-a-specified-folder"><code>move</code> – Moves a File or Folder to a Specified Folder</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss40.png" alt="ss40" width="600" height="400" loading="lazy"></p>
<h3 id="heading-ren-renames-a-file-with-the-syntax-ren-filenameextension-new-nameextension"><code>ren</code> – Renames a File with the Syntax <code>ren filename.extension new-name.extension</code></h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/ss41-1.png" alt="ss41-1" width="600" height="400" loading="lazy"></p>
<h3 id="heading-cls-clears-the-command-line"><code>cls</code> – Clears the Command Line</h3>
<p>In case you enter several commands and the command line gets clogged up, you can use <code>cls</code> to clear all entries and their outputs.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/cls.gif" alt="cls" width="600" height="400" loading="lazy"></p>
<h3 id="heading-exit-closes-the-command-line"><code>exit</code> – Closes the Command Line</h3>
<h3 id="heading-shutdown-shuts-down-restarts-hibernates-sleeps-the-computer"><code>shutdown</code> – Shuts down, Restarts, Hibernates, Sleeps the Computer</h3>
<p>You can shut down, restart, hibernate, and sleep your PC from the command line. </p>
<p>Enter <code>shutdown</code> in the command line so you can see the extensions you can use to perform the actions. For example, shutdown /r will restart your computer.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss42.png" alt="ss42" width="600" height="400" loading="lazy"></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This article showed you several “unknown-to-many” commands you can use to get access to hidden functionalities on your Windows PC.</p>
<p>Again, you should be careful while working with these commands because they can have a lasting effect on your OS.</p>
<p>If you find the commands helpful, share the article with your friends and family.</p>
<p>In case you know another useful command I did not list, <a target="_blank" href="https://twitter.com/Ksound22">tell me about it on Twitter</a>. I will add it and mention you as the source.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
