<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Linux on Mike&#39;s Blog</title>
        <link>https://mikerossiter.tech/categories/linux/</link>
        <description>Recent content in Linux on Mike&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-gb</language>
        <lastBuildDate>Thu, 03 Apr 2025 13:04:14 +0100</lastBuildDate><atom:link href="https://mikerossiter.tech/categories/linux/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Issues Setting up a Linux (Kali) VM in Azure with Terraform</title>
        <link>https://mikerossiter.tech/posts/linux-vm-azure-terraform/</link>
        <pubDate>Tue, 04 Mar 2025 13:14:50 +0000</pubDate>
        
        <guid>https://mikerossiter.tech/posts/linux-vm-azure-terraform/</guid>
        <description>&lt;img src="https://mikerossiter.tech/dragon.webp" alt="Featured image of post Issues Setting up a Linux (Kali) VM in Azure with Terraform" /&gt;&lt;h1 id=&#34;issues-setting-up-a-kali-linux-virtual-machine-in-azure-with-terraform&#34;&gt;Issues Setting up a Kali Linux Virtual Machine in Azure with Terraform
&lt;/h1&gt;&lt;p&gt;Just a quick post to show how I solved a few issues I had while trying to quickly provision a Kali Linux Virtual Machine in Azure with Terraform.&lt;/p&gt;
&lt;p&gt;A quick disclaimer, I am still quite new to Azure and I am having teething problems with work that I would have otherwise done very quickly in AWS. To begin here is some basic code to setup a Linux VM (I will leave out the extra details and allow you to decide upon SSH and password requirements for now):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;resource &amp;#34;azurerm_linux_virtual_machine&amp;#34; &amp;#34;kali_linux_vm&amp;#34; {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  name                = &amp;#34;kali-linux-vm&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  resource_group_name = azurerm_resource_group.example.name
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  location            = azurerm_resource_group.example.location
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  size                = &amp;#34;Standard_DS2_v2&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  admin_username      = &amp;#34;adminuser&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  network_interface_ids = [
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    azurerm_network_interface.example.id,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  ]
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  admin_ssh_key {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    username   = &amp;#34;adminuser&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    public_key = file(&amp;#34;~/.ssh/id_rsa.pub&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  os_disk {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    caching              = &amp;#34;ReadWrite&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    storage_account_type = &amp;#34;Standard_LRS&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  source_image_reference {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    publisher = &amp;#34;kali-linux&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    offer     = &amp;#34;kali&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    sku       = &amp;#34;kali-2024-2&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    version   = &amp;#34;latest&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  plan {
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    name      = &amp;#34;kali-2024-2&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    publisher = &amp;#34;kali-linux&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    product   = &amp;#34;kali&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  }
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Very basic and very readable. &amp;ldquo;But Mike!&amp;rdquo; I hear you say, &amp;ldquo;The &lt;em&gt;&amp;ldquo;plan&amp;rdquo;&lt;/em&gt; isn&amp;rsquo;t on the example on the Terraform website! And where did you get all that amazing information?&amp;rdquo;. Very well observed, I shall respond. BASICALLY, my VM complained profusely if there wasn&amp;rsquo;t a plan block included. So I included it. And where did I get all that lovely information from? Well I had to tiptoe into the &lt;a class=&#34;link&#34; href=&#34;https://azuremarketplace.microsoft.com/en-gb/home&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;marketplace&lt;/a&gt;. That wonderful joint. And from there decided which image I would like to deploy. This time I chose Kali Linux. Aww, cute. You see, the values in Terraform need to exactly match the infrastructure in the marketplace. The next step is to use the Azure CLI to obtain a nice table of what is available to us.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;az login
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;az vm image list --publisher kali-linux --all --output table
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;From here you will see a table that includes &lt;strong&gt;Architecture, Offer, Publisher, Sku, Urn and Version&lt;/strong&gt;. These match the source_image_reference requirements easily but not the plan.&lt;/p&gt;
&lt;p&gt;For the plan you want to match &lt;strong&gt;publisher = publisher, offer = product and sku = name&lt;/strong&gt;. See above Terraform for reference.&lt;/p&gt;
&lt;h2 id=&#34;why-do-we-need-a-plan-block&#34;&gt;Why Do We Need A Plan Block?
&lt;/h2&gt;&lt;p&gt;I don&amp;rsquo;t really know! ChatGPT says that some marketplace images are private and just do so deal with it 😎. You could probably check by running more elaborate CLI commands but no one needs that in their life.&lt;/p&gt;
&lt;h2 id=&#34;further-issues&#34;&gt;Further Issues
&lt;/h2&gt;&lt;p&gt;Upon Apply I also had an issue I didn&amp;rsquo;t expect and wasn&amp;rsquo;t recreatable within the portal if I created resources manually.&lt;/p&gt;
&lt;p&gt;What happened was I got this strange error, something like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;unexpected status 400 (400 Bad Request) with error: ResourcePurchaseValidationFailed: User failed validation to purchase resources. Error message: &amp;#39;You have not accepted the legal terms on this subscription: &amp;#39;***&amp;#39; for this plan. Before the subscription can be used, you need to accept the legal terms of the image.&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So I tried shouting &amp;ldquo;I ACCEPT&amp;rdquo; at my machine but nothing happened. SO instead I decided to look into how to solve this issue, starting with Terraform.&lt;/p&gt;
&lt;p&gt;On the Terraform Registry there is a very vague &lt;a class=&#34;link&#34; href=&#34;https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/marketplace_agreement&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;agreement resource&lt;/a&gt; that says it works sometimes but not all the time. &amp;ldquo;Awesome&amp;rdquo; I thought!&lt;/p&gt;
&lt;p&gt;And as expected it didn&amp;rsquo;t work. It also didn&amp;rsquo;t work if I put a &lt;code&gt;depends_on&lt;/code&gt; statement in my vm code. At this point I did feel like throwing the towel in but I continued. This is what worked for me. And it&amp;rsquo;s more CLI work but hey there you go.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;az vm image terms accept --publisher kali-linux --offer kali --plan kali
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;az vm image terms show --publisher kali-linux --offer kali --plan kali
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The second command should display &lt;code&gt;&amp;quot;accepted&amp;quot;, true,&lt;/code&gt; in lovely readable json at the top of the result.&lt;/p&gt;
&lt;p&gt;Therefore I needed to accept the terms manually in the CLI before it could build the resource.&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t like this! And if this works for you, I bet you won&amp;rsquo;t like it either! It should be acceptable in the pipeline or apply stage of your build but anyway. This worked for me. I have much more to learn but before I forgot all about this, I wanted to share my experience.&lt;/p&gt;
</description>
        </item>
        <item>
        <title>How to View Your Public IP Address in the Command Line</title>
        <link>https://mikerossiter.tech/posts/how-to-view-your-ip-address-in-the-command-line/</link>
        <pubDate>Tue, 04 Oct 2022 10:27:19 +0100</pubDate>
        
        <guid>https://mikerossiter.tech/posts/how-to-view-your-ip-address-in-the-command-line/</guid>
        <description>&lt;img src="https://mikerossiter.tech/world.png" alt="Featured image of post How to View Your Public IP Address in the Command Line" /&gt;&lt;h1 id=&#34;how-to-view-your-public-ip-address-in-the-command-line&#34;&gt;How to View Your Public IP Address in the Command Line
&lt;/h1&gt;&lt;p&gt;This is a short post but I discovered a really handy API in a great website: &lt;a class=&#34;link&#34; href=&#34;https://www.myip.com&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;MyIP.com&lt;/a&gt; No ads either. (&lt;em&gt;Noice!&lt;/em&gt;) It shows you your IP and some interesting stats too. I have utilised the API of the website to make this handy command because it isn&amp;rsquo;t often that straightforward and running &lt;code&gt;ip a&lt;/code&gt; or &lt;code&gt;ifconfig&lt;/code&gt; only shows you the addresses for what is happening locally. So the command I&amp;rsquo;m using is:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;curl -s https://api.myip.com | jq .ip | tr -d \&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Taking this apart, we can run the curl command and return some useful values in json format. Hence the inclusion of the &lt;code&gt;jq&lt;/code&gt; parse tool which pulls out only the IP address. Finally the &lt;code&gt;tr&lt;/code&gt; tool simply trims off the surrounding quotes which is nicer to look at and might make this command more useful in a script or something. I don&amp;rsquo;t know. Or whatever you want to use it for.&lt;/p&gt;
&lt;p&gt;So there you go! If this helped you too then you can help me stay awake by &lt;a class=&#34;link&#34; href=&#34;https://www.buymeacoffee.com/mikerossiter&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;buying me a coffee&lt;/a&gt;. Thanks!&lt;/p&gt;
</description>
        </item>
        <item>
        <title>How to Count Whitespace in the Terminal</title>
        <link>https://mikerossiter.tech/posts/how-to-count-whitespace-in-the-terminal/</link>
        <pubDate>Mon, 03 Oct 2022 11:44:03 +0100</pubDate>
        
        <guid>https://mikerossiter.tech/posts/how-to-count-whitespace-in-the-terminal/</guid>
        <description>&lt;img src="https://mikerossiter.tech/counting.png" alt="Featured image of post How to Count Whitespace in the Terminal" /&gt;&lt;h1 id=&#34;how-to-count-whitespace-in-the-terminal&#34;&gt;How to Count Whitespace in the Terminal
&lt;/h1&gt;&lt;p&gt;Just a quick post. I might update this later if I improve the content but for now I have found a quick way to reliably count whitespaces in text in the terminal.&lt;/p&gt;
&lt;p&gt;Initially I thought to &lt;code&gt;cat&lt;/code&gt; the contents of the file and use &lt;code&gt;tr&lt;/code&gt; to trim to just spaces and then to count the remaining space characters with &lt;code&gt;wc -m&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Annoyingly there is a new line included at the end which you can&amp;rsquo;t see but is still counted. Therefore I devised another way using &lt;code&gt;printf&lt;/code&gt; which, if you do any coding in C or the such like, you will be familiar with but you might not be aware that it works in the terminal too.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;printf &amp;#34;1 2 3 4&amp;#34; | tr -cd &amp;#39;[:space:]&amp;#39; | wc -m
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Produces a result of &lt;code&gt;3&lt;/code&gt;. That&amp;rsquo;s we wanted and that&amp;rsquo;s what we got. It&amp;rsquo;ll do for now!&lt;/p&gt;
</description>
        </item>
        <item>
        <title>The Binary Unix Clock</title>
        <link>https://mikerossiter.tech/posts/the-binary-unix-clock/</link>
        <pubDate>Fri, 30 Sep 2022 10:44:14 +0100</pubDate>
        
        <guid>https://mikerossiter.tech/posts/the-binary-unix-clock/</guid>
        <description>&lt;img src="https://mikerossiter.tech/clock.png" alt="Featured image of post The Binary Unix Clock" /&gt;&lt;h1 id=&#34;the-binary-unix-clock&#34;&gt;The Binary Unix Clock
&lt;/h1&gt;&lt;p&gt;This is the time as your computer or device will see it. &lt;a class=&#34;link&#34; href=&#34;https://en.wikipedia.org/wiki/Unix_time&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;More info about Unix Time&lt;/a&gt;&lt;/p&gt;
&lt;body&gt;
&lt;style&gt;
body {
    background: #111111;
}
.clock {
    //position: absolute;
    //top: 50%;
    //left: 55%;
	//width: 11em;      
    //background-color: white;       
    //border: 2px solid black;      
    //padding: 10px;      
    word-wrap: break-word;   
    //transform: translateX(-50%) translateY(-50%);
    //color: #000000;
    //font-size: 2pt;
    font-family: &#39;Alegreya Sans SC&#39;, Arial, sans-serif;
    //letter-spacing: 7px;
	font-size:6vw
}
&lt;p&gt;&lt;/style&gt;&lt;/p&gt;
&lt;div id=&#34;DigitalCLOCK&#34; class=&#34;clock&#34; onload=&#34;showTime()&#34;&gt;&lt;/div&gt;
&lt;script&gt;
function showTime(){
    
  var s = (Math.round(Date.now() / 1000)).toString(2); 
    
  var time = s;
  document.getElementById(&#34;DigitalCLOCK&#34;).innerText = time;
    
  setTimeout(showTime, 1000);
    
}
 
showTime();
&lt;/script&gt;
&lt;/body&gt;</description>
        </item>
        <item>
        <title>Bored of Bash? Try Zsh</title>
        <link>https://mikerossiter.tech/posts/bored-of-bash-try-zsh/</link>
        <pubDate>Thu, 29 Sep 2022 08:29:13 +0100</pubDate>
        
        <guid>https://mikerossiter.tech/posts/bored-of-bash-try-zsh/</guid>
        <description>&lt;img src="https://mikerossiter.tech/zsh-header.jpg" alt="Featured image of post Bored of Bash? Try Zsh" /&gt;&lt;h1 id=&#34;bored-of-bash-try-zsh&#34;&gt;Bored of BASH? Try ZSH!
&lt;/h1&gt;&lt;p&gt;For years and years I used the standard Bash (Bourne Again shell) terminal and I still do as it is mostly the default shell but these days I tend to veer towards Zsh (Zee shell! or Zed shell if you&amp;rsquo;re me) for its sheer ease of customisation in the shape of various installable plugins. I was introduced to this by an awesome colleague of mine way back in 2021 and I haven&amp;rsquo;t looked back since. This is how I customise and use Zsh but there are hundreds of other ways to do the same thing. I hope this piques some interest for a few intermediate terminal users looking to nerdify their Linux environment.&lt;/p&gt;
&lt;h2 id=&#34;change-your-default-shell-to-zsh-or-any-other-shell-for-that-matter&#34;&gt;Change your default shell to Zsh (or any other shell for that matter)
&lt;/h2&gt;&lt;p&gt;This depends on your distribution of choice. You might want to leave this step til the end in case you decide you hate Zsh and never want to use it again. If you want to try out other shells available to you by your distribution (Ubuntu, Fedora, Debian, etc) then all you need to do is type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;cat /etc/shells
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;into your terminal. If you type the name of the particular shell that you want to try into your terminal i.e.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;zsh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then you are now using that shell. To exit just type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;exit
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&amp;ldquo;Are you really a Devops engineer???&amp;rdquo; I can hear you shouting. Honest I is. So here&amp;rsquo;s some cooler stuff.&lt;/p&gt;
&lt;p&gt;If you want the new shell (zsh in this case) to persist then you need to type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;chsh -s /bin/zsh
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I just realised that &lt;strong&gt;chsh&lt;/strong&gt; might need to be installed first so double check. If for whatever reason zsh is not installed then try the repository for your distro and have another crack at adding it. There are many ways to add the shell to your environment and this is just one. If you want to confirm which shell you are using as default then type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;echo $SHELL
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You may have to log out and back in again to get the terminal to accept the new changes.&lt;/p&gt;
&lt;h2 id=&#34;install-oh-my-zsh&#34;&gt;Install Oh My Zsh
&lt;/h2&gt;&lt;p&gt;OK, so now you&amp;rsquo;re using Zsh and you think so what?&lt;/p&gt;
&lt;p&gt;Well this is the cool bit. There&amp;rsquo;s this plugin called &lt;a href=&#34;https://ohmyz.sh/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;Oh My Zsh&lt;/a&gt; that I absolutely love. It makes configuration so much simpler and makes your terminal just look really awesome.&lt;/p&gt;
&lt;p&gt;There are clear instructions on how to install Oh-My-Zsh on their website or on their &lt;a href=&#34;https://github.com/ohmyzsh/ohmyzsh/wiki&#34;&gt;GitHub&lt;/a&gt; page but you can start by inputting:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-gdscript3&#34; data-lang=&#34;gdscript3&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;sh&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;c&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;in order to install Oh-My-Zsh if you have Curl installed. You can do the same with Wget and instructions are available on the site.&lt;/p&gt;
&lt;h2 id=&#34;installing-the-powerlevel-10k-theme&#34;&gt;Installing the Powerlevel 10K theme
&lt;/h2&gt;&lt;p&gt;If you have read the Oh-My-Zsh website in detail by now, you will see that there are lots of awesome themes you can use and you might want to just stop there. I prefer to use the &lt;a href=&#34;https://github.com/romkatv/powerlevel10k&#34;&gt;Powerlevel10K&lt;/a&gt; theme. In order to use it you first need to install the &lt;a href=&#34;https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf&#34;&gt;MesloLGS NF Regular&lt;/a&gt; font. In Linux this is very easy. Download that font and open it and press &amp;lsquo;Install&amp;rsquo;. See? Told you. Again, instructions are on the Powerlevel10K link above. You might also have to change your font to Meslo NF Regular in your terminal emulator of choice. I choose: Terminator.&lt;/p&gt;
&lt;p&gt;To install the theme with Oh-My-Zsh installed all you need to do is type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;assuming you have git installed. If not consult your preferred repository in the usual manner but I assume you have the capacity to install Git and Curl by this point.&lt;/p&gt;
&lt;p&gt;Now to get the most out of Zsh then you need to edit your shiny .zshrc file located in your home or &amp;ldquo;~&amp;rdquo; directory. Type:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ZSH_THEME=&amp;#34;powerlevel10k/powerlevel10k&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;at the head of your file using Vim or Nano and save and quit.&lt;/p&gt;
&lt;p&gt;Now in order to make your terminal look something like mine:&lt;/p&gt;
&lt;p&gt;![Cool looking terminal(/zsh-cli.png)&lt;/p&gt;
&lt;p&gt;you need to configure Powerlevel10K by typing in:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;p10k configure
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will give you a prompt with some questions about how cool to make your terminal prompt look. They are fairly straightforward. If the icons don&amp;rsquo;t appear just check that you have the Meslo font installed. Maybe exit and open the terminal again if it&amp;rsquo;s playing up. The Linux equivalent of turn it off and on.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://mikerossiter.tech/powerlevel.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;Powerlevel Install&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Now you have your theme and your shell decided upon. It is time to make it do even cooler stuff. Yes that&amp;rsquo;s right. Now you can:&lt;/p&gt;
&lt;h2 id=&#34;install-plugins&#34;&gt;Install Plugins!
&lt;/h2&gt;&lt;p&gt;This is what separates the hipsters from the imposters(?). I couldn&amp;rsquo;t think of a better analogy, sorry.&lt;/p&gt;
&lt;p&gt;Anyway! There are a few other blogs and guides that show you these plugins and that is because they are super helpful, will increase your general workflow and make you look like a terminal wizard (Gandalf style beard = optional but preferred). We are talking &lt;a href=&#34;https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;syntax highlighting&lt;/a&gt; and auto-suggestions! Yeah man!&lt;/p&gt;
&lt;p&gt;Syntax highlighting will show you when a command is not installed by making it red and by making a command that does work, green. Auto-suggestions will show you commands you have run in the past and you can save time by pressing the right arrow key to complete the text. For instance this grey section is the suggestion:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://mikerossiter.tech/suggestion.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;Suggestion&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;And this shows the command that will fail:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://mikerossiter.tech/bad-zsh.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;BAD!&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;And this is when it works:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://mikerossiter.tech/suggest-works.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;GOOD!&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Simply clone these two repos to the required home location for Oh-My-Zsh:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git clone https://github.com/zsh-users/zsh-syntax-highlighting.git git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now you have cloned the repos for the plugins you need to enable them in your .zshrc file. Open the file and search for &amp;ldquo;plugins&amp;rdquo;. You should find a heading and a plugin in brackets. Edit this to look like:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;plugins=(
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;	zsh-syntax-highlighting
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;	zsh-autosuggestions
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I have also added &amp;ldquo;git&amp;rdquo;, &amp;ldquo;kubectl&amp;rdquo;, &amp;ldquo;colored-man-pages&amp;rdquo; and &amp;ldquo;terraform&amp;rdquo; to this list among others. I think git is usually already included by default but you can find more plugins at the &lt;a href=&#34;https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;GitHub repo&lt;/a&gt; for Oh My Zsh plugins. Some of them are simple aliases for commands which I find really useful but others have more elaborate results.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;And away you go! Feel free to experiment with themes and plugins for Zsh to your heart&amp;rsquo;s content. I hope this helped. Feel free to comment, email or even &lt;a href=&#34;https://www.buymeacoffee.com/mikerossiter&#34; target=&#34;_blank&#34; rel=&#34;noreferrer noopener&#34;&gt;buy me a coffee&lt;/a&gt;! Thanks for reading!&lt;/p&gt;
</description>
        </item>
        <item>
        <title>Tmux</title>
        <link>https://mikerossiter.tech/posts/tmux/</link>
        <pubDate>Mon, 26 Sep 2022 08:58:03 +0100</pubDate>
        
        <guid>https://mikerossiter.tech/posts/tmux/</guid>
        <description>&lt;img src="https://mikerossiter.tech/panes.png" alt="Featured image of post Tmux" /&gt;&lt;h1 id=&#34;tmux&#34;&gt;TMUX
&lt;/h1&gt;&lt;h2 id=&#34;split-your-terminal-screen-up&#34;&gt;Split your terminal screen up!
&lt;/h2&gt;&lt;p&gt;Here is my brief get up and go guide to Tmux. &lt;a class=&#34;link&#34; href=&#34;https://github.com/tmux/tmux&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Tmux&lt;/a&gt; is a great tool to use when you need multiple panes in the terminal and especially useful if you don&amp;rsquo;t have access to a GUI. You can also create sessions with Tmux to enter and exit different workspaces. It can be installed in the usual fashion (apt, pacman, dnf, snap even) on all Linux distros as it is widely used.&lt;/p&gt;
&lt;p&gt;Here is how Tmux appears:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://mikerossiter.tech/Tmux-sample.png&#34;
	
	
	
	loading=&#34;lazy&#34;
	
		alt=&#34;Tmux hard at work&#34;
	
	
&gt;&lt;/p&gt;
&lt;p&gt;Currently, I prefer to use &lt;a class=&#34;link&#34; href=&#34;https://terminator.readthedocs.io/en/latest/index.html&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Terminator&lt;/a&gt; on my distro of choice so I don&amp;rsquo;t use Tmux as much as I used to but nonetheless I still find myself using it regularly. Below are some of the commands you can use to create and use separate &lt;em&gt;panes&lt;/em&gt;. Preceding most commands is Ctrl+B. This is sometimes referred to as the prefix. It will initiate a mode that is followed by key inputs that can amend the current view:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B Shift+% - split pane vertically
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B Shift+&amp;#34; - split pane horizontally
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B then arrow to change pane
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B c - New window (number at bottom. Starts at 0)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B 0 - Go to window 0
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B 1 - Go to window 1
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B z - Zoom window to fullscreen and back again
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Type &amp;#34;exit&amp;#34; or Ctrl + D to close the current pane
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Sessions:
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B d - Detach or leave session
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tmux ls - Summary of windows open in background
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tmux attach -t 0 - Attach to session (State is preserved)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tmux rename-session -t 0 git - Rename the session &amp;#39;git&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;tmux kill-session -t git - Ends git session
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;One of the most useful commands is this:
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Ctrl+B : set synchronize-panes on - Sync all panes 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This way you can enter text into all panes at once. Super handy!&lt;/p&gt;
&lt;p&gt;There is much more to Tmux. You can edit the config file in your home directory and use plugins. It is extremely versatile. I might follow this up soon. Some of my config dotfiles are available in my &lt;a class=&#34;link&#34; href=&#34;https://gitlab.com/mikerossiter/dotfiles&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;GitLab&lt;/a&gt; repo if you are interested in some examples of how I set up my terminal.&lt;/p&gt;
</description>
        </item>
        <item>
        <title>Beginner&#39;s Guide to Vim</title>
        <link>https://mikerossiter.tech/posts/beginners-guide-to-vim/</link>
        <pubDate>Tue, 20 Sep 2022 13:06:35 +0100</pubDate>
        
        <guid>https://mikerossiter.tech/posts/beginners-guide-to-vim/</guid>
        <description>&lt;img src="https://mikerossiter.tech/VIM.png" alt="Featured image of post Beginner&#39;s Guide to Vim" /&gt;&lt;h1 id=&#34;a-beginners-guide-to-vim&#34;&gt;A Beginner&amp;rsquo;s Guide To Vim
&lt;/h1&gt;&lt;p&gt;OK. Vim is my favourite text editor. I use IDEs in my job like VS Code but I often end up just using Vim in the command line as it&amp;rsquo;s where I&amp;rsquo;m most happy and everybody tells me that the Linux hipsters all use Vim exclusively and I want to join that club desperately.&lt;/p&gt;
&lt;p&gt;Jokes aside though I really do love Vim. BUT I&amp;rsquo;ve grown to love it. I think like everybody who&amp;rsquo;s followed a demo online where they&amp;rsquo;ve instructed you to type in &lt;code&gt;$ vi thisfile&lt;/code&gt; in the Terminal, have quickly found yourself Googling for &lt;code&gt;How to exit Vim&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So here is my entry level cheat sheet on using Vim to edit text files. It does so much more than just editing config files but I wanted to keep all the basic commands in one place for you (and myself probably) to check into now and again.&lt;/p&gt;
&lt;p&gt;First of all make sure you have &lt;code&gt;Vi Improved&lt;/code&gt; actually installed as some distros might have the older and simpler but not wiser version installed. Merely type &lt;code&gt;sudo apt install vim -y&lt;/code&gt; (Ubuntu/Zorin/Mint/Pop etc) or &lt;code&gt;sudo dnf install vim -y&lt;/code&gt; (Fedora/RHEL/Centos/Rocky) to ensure you have the up to date software. So far, so easy.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s say you need to create a brand new file in the folder you&amp;rsquo;re currently sat in called &lt;code&gt;test.txt&lt;/code&gt;. Just type &lt;code&gt;vi test.txt&lt;/code&gt; or &lt;code&gt;vim test.txt&lt;/code&gt;. Either will work just fine. I tend to write &lt;code&gt;vi&lt;/code&gt;. Now you are faced with a blank screen with tildes (&lt;code&gt;~&lt;/code&gt;) floating down the left hand side. Cool. Now what? Well you should be in typing mode AKA &lt;code&gt;Insert Mode&lt;/code&gt; as displayed at the bottom of the screen. Vim has two main modes. &lt;strong&gt;Insert&lt;/strong&gt; mode, that&amp;rsquo;s typing mode, and &lt;strong&gt;Command&lt;/strong&gt; mode which is a mode where you can do things in the built-in command line at the bottom of the screen. Type a load of nonsense. Now you want to save this nonsense to the file &lt;code&gt;test.txt&lt;/code&gt; and quit altogether. Press &lt;code&gt;Esc&lt;/code&gt; to go to the command mode we mentioned before and type &lt;code&gt;:wq&lt;/code&gt;. Yes you need to type the colon too. The &lt;code&gt;w&lt;/code&gt; is for &lt;code&gt;write&lt;/code&gt; or save and the &lt;code&gt;q&lt;/code&gt; is for….. yes you guessed it &lt;code&gt;quit&lt;/code&gt;. Now do a quick &lt;code&gt;ls&lt;/code&gt; to see if your file exists. Lo and behold you are a technical genius and will be forever known as Hackerman by your close friends and family. But that&amp;rsquo;s not all! Here are some useful commands for when you are editing files in Vim. N.B. Please note the colons aren&amp;rsquo;t to look pretty, you really do need to type a colon. P.S. Why is it called a colon? We need to change that.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Enter insert mode (Adding text) - i 
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Replace text - r
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Escape insert mode and enter command mode (Panic button!) - Esc
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Exit! (when you haven&amp;#39;t changed a thing) - :q
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Exit! (when you have changed something and don&amp;#39;t want to save) - :q!
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Save (but carry on editing) - :w
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Save and exit - :wq
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Search for text - /searchtermhere
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;After hitting enter, find next occurrence of search term - n
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Find next search term up instead of down - N
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Undo - u
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Redo - Ctrl+r
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Select command (will replace when pasting clipboard contents) - v
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Select line command - Shift + v
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Copy text - y
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Copy whole line - yy
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Paste - p
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Carriage return (Enters insert mode after pressing) - o
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Delete character - x
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Delete/Cut line - dd
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Delete from cursor to end of word - dw
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Delete all text - :1,
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Move to end of file - G
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Move to start of file - gg
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Cursor to end of line - $ or End
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Cursor to start of line - 0 or Home
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;(If you have opened multiple files in a folder i.e. &amp;#34;$ vi *&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Move forward a file - :n
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Move backward a file - :N
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
        </item>
        
    </channel>
</rss>
