Monthly Archives: March 2026

tar

Backup

See Ubuntu Help for details.

# Full root file system backup
tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --one-file-system /

# Backup remote file system (SSH)
ssh root@srv.local -p 22 "tar -cvpz --one-file-system /" > srv-backup.tar.gz

# Restore
tar -xvpzf /path/to/backup.tar.gz -C /media/whatever --numeric-owner

Other useful commands

# Remove compression from tar.gz
gzip -dk archive.tar.gz

# Compress directory
tar -zcvf myfolder.tar.gz myfolder

# Read gzipped log
zcat error.log.2.gz

Logoff desktop shortcut for all users on Windows Server

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:PUBLIC\Desktop\Logoff.lnk")
$Shortcut.TargetPath = "C:\Windows\System32\shutdown.exe"
$Shortcut.Arguments = "/l"
$Shortcut.IconLocation = "C:\Windows\System32\shell32.dll,44"
$Shortcut.Save()