Skip to content

Instantly share code, notes, and snippets.

@hoangitk
hoangitk / Shrink your WSL2 Virtual Disks and Docker Images and Reclaim Disk Space.md
Created November 3, 2021 07:04
[Shrink your WSL2 Virtual Disks and Docker Images and Reclaim Disk Space] #wsl #tips

Shrink your WSL2 Virtual Disks and Docker Images and Reclaim Disk Space

Credit: https://www.hanselman.com/blog/shrink-your-wsl2-virtual-disks-and-docker-images-and-reclaim-disk-space

Docker Desktop for Windows uses WSL to manage all your images and container files and keeps them in a private virtual hard drive (VHDX) called ext4.vhdx.

It's usually in C:\Users\YOURNAME\AppData\Local\Docker\wsl\data and you can often reclaim some of the space if you've cleaned up (pruned your images, etc) with Optimize-Vhd under an administrator PowerShell shell/prompt.

You'll need to stop Docker Desktop by right clicking on its tray icon and choosing Quit Docker Desktop. Once it's stopped, you'll want to stop all running WSL2 instances with wsl --shutdown

Mine was 47gigs as I use Docker A LOT so when I optimize it from admin PowerShell from the wsl\data folder

@hoangitk
hoangitk / curl in Powershell.md
Created October 27, 2021 10:08
[curl in Powershell] #powershell
@hoangitk
hoangitk / How to download file without browser.md
Last active October 19, 2021 13:57
[How to download file without browser] #tips

How to download file without browser

bitsadmin /transfer myDownloadJob /download /priority normal https://downloadsrv/10mb.zip c:\\10mb.zip
  • Powershell
@hoangitk
hoangitk / SSH Command.md
Last active October 15, 2021 08:48
[SSH Command] #ssh

SSH Command

  • Connect to server
> ssh <user>@<server>
  • Send remote command
> ssh <user>@<server> <command>
@hoangitk
hoangitk / Favorites Folder.md
Last active July 28, 2022 02:47
[Favorites Folder] #refs #windows
@hoangitk
hoangitk / auto_backup_all_db.sql
Created August 4, 2021 09:15
[Auto backup all DB] #backup #mssql
/*
credit: https://www.mssqltips.com/sqlservertip/1070/simple-script-to-backup-all-sql-server-databases
*/
DECLARE @name VARCHAR(50) -- database name
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
-- specify database backup directory
@hoangitk
hoangitk / Fresh Installation.md
Created July 28, 2021 12:41
[Fresh Installation] #install #fresh #windows #cmd

Fresh Installation

Prompt

  • Command Line
> setx PROMT $P$_$G
@hoangitk
hoangitk / Icons by Unicode.md
Created July 28, 2021 03:37
[Icons by Unicode] #icons #tips

Icons by Unicode

  • Refresh
    ⭯ ⭮ ↺ ↻ ⟲ ⟳ 🔃🔄