I'd like to extract and uncompress (tar/bzip2) a compressed directory on a remote machine and save the directory and all its contents to my local computer without having to connect back into my local machine from the remote one. How can I do this over SSH? The tar file doesn't need to be stored on the remote machine, only on the local machine. I have tried:
ssh remotehost.somewhere.com "tar xf mydirectory.tar.bz2 | bzip2 -c " > mylocaldirectory