4. Remote hard drive restoration
Want to restore that image you just backed up to your machine? It’s easy. This time the command works in reverse. Again, if the drive you are restoring to is named differently than what is listed in the example, use the lsblk
command to find out what /dev/
it’s listed as.
ssh remoteuser@ip.address.of.remote.machine 'dd if=sda.img' | dd of=/dev/sda
Run this command, and the .img file you created will be restored over the network to the hard drive that you specify.
5. Send a file
Sending a single file over SSH is easy. Here’s how to do it with pipes.
cat file | ssh remoteuser@ip.address.of.remote.machine "cat > remote"
This command makes use of the cat command to send a file through a pipe. You can also retrieve that file with the following command:
ssh remoteuser@ip.address.of.remote.machine "cat > remote" < file
Leave A Comment