Bash

Using PGrep

I often use grep in Windows and Linux to find text in files. I have noticed that grep only works on traditional text files with .txt, .c, .cpp, .list, etc extensions. It doesn’t work with Markdown and C# text files and I find this frustrating. I have found a parallel grep program in the Microsoft Learn code samples written by David Pine that overcomes the grep limitations. The thing that I really like about this program is that I can use regular expressions in the search text.

Creating a Root Password in Linux

I am used to gaining elevated privileges in Linux by adding sudo to a command e.g. sudo apt-get update I wanted to stay in elevated privileges so I went to login as root and realised that my normal Linux account didn’t have root privileges. I did some searching on the Internet and found that most versions of Linux disable the root account by default. I found that you can enable root by running the following command.

Using the Correct Version of Windows Subsystem for Linux

I have been using the Windows Subsystem for Linux (WSL) for a number of years and just assumed that I was using WSL 2. A quick check told me that I was definitely using WSL 2. Note: I am using Powershell to check the version of WSL I have installed. wsl --status Returned. Default Distribution: Ubuntu-20.04 Default Version: 2 Windows Subsystem for Linux was last updated on 3/11/2021

Changing Default Colours in Windows WSL Linux

I am using the bash shell in Windows WSL Linux. Currently I am using the Ubuntu 20.04, Debian and OpenSuse distributions. The problem I have is that the default colour scheme has an ugly green background colour with blue text This is a really disconcerting colour scheme! I looked around for an alternative colour scheme to use and found that I could run a command to change the colours manually but each time I opened the terminal I would have to run the command again.

Changing the Linux Swapfile Size

I am having real problems keeping my ASUS netbook running. It doesn’t have enough specs to run a lightweight version of Linux. Increasing the size of the swapfile is supposed to improve the performance of low specced machines. I have worked out how to change the swapfile size in the hope that it may help. To check if you actually have a swapfile. swapon -s This will either return nothing or detail the swapfiles statistics.