Linux - Backup

16 May 25

backup files from Ubuntu (WSL) home folder (the ~) to Windows
$ tar -czf /mnt/c/Users/arthu/wsl-backup.tar.gz ~
This archives the entire home directory, compressing it as a .tar.gz and writes to the Windows filesystem (/mnt/c/...)
I carried this out in the context of a WSL re-install. To restore files:
$ cd ~

$ tar -xvf /mnt/c/Users/arthu/wsl-backup.tar.gz -C ~

arthu being my Windows username 
this will take a while and may appear to be hanging/give weird tar: 'Removing leading `/' from member names' comment but can confirm working by checking the tar.gz file size is increasing over time.
alternative faster version, excluding unnecessary folders (untested)
tar --exclude='.cache' --exclude='node_modules' --exclude='.vscode-server' -czf /mnt/c/Users/arthu/wsl-backup.tar.gz ~