9951 explained code solutions for 126 technologies


cli-tarHow do I use tar, gzip, and SSH together to transfer files?


Using tar, gzip, and SSH together is a great way to securely transfer files between two computers. Here's an example of how to do it:

tar -zcvf file.tar.gz file1 file2
ssh user@hostname
scp file.tar.gz user@hostname:~/
  1. tar -zcvf file.tar.gz file1 file2 - This command creates a tar file with the gzip compression format, which includes the files file1 and file2.
  2. ssh user@hostname - This command establishes an SSH session with the remote host.
  3. scp file.tar.gz user@hostname:~/ - This command securely copies the file file.tar.gz to the remote host.

Helpful links

Edit this code on GitHub