How To Use tar Command Through Network Over SSH Session

How To Use tar Command Through Network Over SSH Session

The tar command is a utility that is used to create, extract, and manipulate tar archives. A tar archive is a file that contains a collection of other files, along with metadata about those files such as file permissions and ownership.

To use the tar command over an SSH session, you can use the ssh command to establish a connection to the remote machine, and then run the tar command on the remote machine through the SSH session.

Here is an example of how to use the tar command to create a tar archive over an SSH session:

  1. Establish an SSH connection to the remote machine:
ssh user@remote-machine
Source:w‮tual.ww‬turi.com
  1. Run the tar command to create the tar archive:
tar -cvf archive.tar file1 file2 file3

This creates a tar archive called archive.tar that contains the files file1, file2, and file3. The -c option tells tar to create a new archive, the -v option tells it to be verbose (i.e. print the names of the files as they are added to the archive), and the -f option specifies the name of the archive file.

To extract the files from the tar archive, you can use the tar command with the -x option to extract the files from the archive:

tar -xvf archive.tar

This extracts the files from the archive.tar archive and prints the names of the files as they are extracted.

You can also use the scp command to transfer the tar archive to and from the remote machine.

Created Time:2017-10-29 22:08:34  Author:lautturi