Posts

How to use Grep Command

  The grep command is one of the most useful tools in Linux/Unix for searching text. It scans files or streams line by line and prints the lines that match a given pattern. 🔑 Basic Syntax grep [options] pattern [file...] pattern → the text or regex you want to search for file → the file(s) you want to search in 📘 Common Examples Search for a word in a file grep "error" logfile.txt → Shows all lines in logfile.txt containing the word error . Case-insensitive search grep -i "error" logfile.txt → Matches Error , ERROR , error , etc. Search recursively in a directory grep -r "TODO" ./src → Finds all lines with TODO in files under ./src . Show line numbers grep -n "main" program.c → Displays matching lines with their line numbers. Count matches grep -c "error" logfile.txt → Prints how many lines contain error . Use regex patterns grep "^[0-9]" data.txt → Matches lines starting with a digit. ⚡ Usef...

Mastering Memory: How to Check RAM in Linux and WSL2

If you are running a Linux server or working within WSL2 (Windows Subsystem for Linux) , understanding your memory usage is critical. Whether you're troubleshooting a slow build or trying to figure out why your Windows host feels sluggish, knowing how to read your RAM stats is the first step. In Linux, "Free" RAM doesn't mean what you think it does. Here is the breakdown of how to check your current and maximum memory like a pro. 1. The "Quick Look" Method: free -h The free command is the standard way to get a snapshot of your system. Using the -h flag makes it "human-readable" (showing GiB and MiB instead of raw bytes). free -h How to read the output: Total: This is your Max RAM . In WSL2, this is limited by your .wslconfig settings. Used: What your applications are currently consuming. Available: The most important number. This tells you how much memory is actually left for new processes without the system slowing down. Pro Tip: Don't...

How to reclaim the space in WSL after folder deletion

Image
 Deleting files inside WSL is like throwing trash away inside a house—the house (the .vhdx file) doesn't actually get smaller on the outside until you "move the walls back in." To reclaim that space on your C: drive immediately , follow these steps. In powershell run the below command wsl --shutdown Restart your windows system. Run below command , replace the DistroName with your WSL Distro Name. wsl --manage <DistroName> --set-sparse true How to find the Distro Name: Run the below command in Powershell wsl -l -v Normally ubuntu will be the distro name.

How to know the path of ext4.vhdx in windows

Image
 Finding this file can be a bit of a scavenger hunt because the folder names are often long strings of random characters. The easiest way to find it is to use PowerShell to tell you exactly where it's hiding. Method 1: The "Automatic" Way (PowerShell) Copy and paste this command into a PowerShell window. It will spit out the exact path to your virtual disk: In powershell, run the command  Get-ChildItem -Path "$env:LOCALAPPDATA\Packages" -Filter "ext4.vhdx" -Recurse -ErrorAction SilentlyContinue | Select-Object FullName, @{Name="SizeGB";Expression={$_.Length / 1GB}}

How to see exactly which subfolders are the "space hogs" inside a specific directory in WSL

Image
 If you want to navigate through your folders and delete things on the fly, ncdu is the gold standard for WSL users. It feels like a simplified, terminal version of WizTree. Install it:  sudo apt update && sudo apt install ncdu Run it on your suspect folder: ncdu /path/to/your/folder If we wants to check in root of the repo, run below command ncdu ~ You can see the space of each folder like this.

Generate a self-signed certificate (for testing/development)

Image
Use OpenSSL to create a self-signed certificate: Step 1: Install OpenSSL (if not already installed)  # On Ubuntu/WSL sudo apt-get update sudo apt-get install openssl Step 2: Generate the certificate # Create certs directory mkdir -p certs cd certs # Generate a private key and certificate openssl req -x509 -newkey rsa:2048 -keyout signature-key.pem -out signature-cert.pem -days 365 -nodes # Convert to PKCS#12 format (.p12) openssl pkcs12 -export -out signature-cert.p12 -inkey signature-key.pem -in signature-cert.pem -name "Invoice Signing Certificate" When prompted: Enter a password for the .p12 file (To use in env variable) Fill in certificate details (or press Enter to skip) This will generate the certs file for you. Thank you.

How to connect to postgres database in activepieces

Image
In this post, we will see how to connect to postgres database in local activepieces development environment.  Add the Below mentioned env variables  Follow below link to install and setup postgres  https://simplelinuxlearnings.blogspot.com/2025/10/in-wsl-how-to-create-database-update.html Create a new database named activepieces like below. Now, start the application using npm start, your postgres  database should be utilized by activepieces.