How to tar a file via SSH?

kumkumsharma

Administrator
Staff member
As you know TAR stands for Tape Archive file (tarball). Tar command compresses all the files and converts it in smaller files. We can simply convert the files in to TAR file with command in linux.

We can simply follow below steps:
  • Login to server via SSH.
  • You can compress complete directory which is available in /home/username/public_html location, for that we can follow below command:
Code:
$ tar -czvf xyz.tar.gz /home/username/public_html/
Here username is your cpanel username and xyz.tar.gz is the compressed file, so you can change the name of it.

We can also compress the single file with below command:

Code:
$tar -zcvf xyz.tar.gz /home/username/filename

-c : Create a new archive
-v : Verbose output
-f file.tar.gz : Use archive file
-z : Filter the archive through gzip
 
Top