Tag: tar

  • How to view the contents of tar.gz file

    How to view the contents of tar.gz file

    To view the contents of tar.gz file, run

    tar tf FILE.tar.gz
    

    tar view files

    -f, --file=ARCHIVE         use archive file or device ARCHIVE
    -t, --list                 list the contents of an archive
    
  • Using tar over SSH Session

    I wanted to make a tar of a folder on a remote server. But the server don’t have much disk space left, so the tar operation failed.

    The server had no rsync installed to copy over the folder to another server.

    To save generated tar file on another server, i used command

    tar zcvf - folder-to-compress | ssh root@STORAGE_SERVER_IP "cat > site.tar.gz"
    

    Example

    tar zcvf - public_html | ssh [email protected] "cat > site.tar.gz"
    

    NOTE: Make sure you connect to remote server using SSH and accept the key before you run above command as it will fail if you don’t accept key beforehand.

    See tar