Linux tips

De Mathux

Create Swap file

sudo dd if=/dev/zero of=/swapfile bs=1M count=512 && sudo mkswap -f /swapfile && sudo swapon /swapfile

then add it to fstab

Edit with cat

with variable expansion cat > myfile << EOF typewhatiwant $user EOF

without variable expension cat > myfile << "EOF" typewhatiwant mmaret EOF

dd with progress bar

pv -tpreb /dev/sdb | dd of=/dev/sdc

which results in:

21.6GiB 0:03:41 [ 106MiB/s] [============>                        ] 36% ETA 0:06:30

or use dd if=/dev/sdb of=/dev/sdc status=progress

Revert ssh

 /usr/bin/autossh -M 0 -NR 2222:localhost:22 -o "ServerAliveInterval 45" -o "ServerAliveCountMax 2" LOGIN@SERVER