Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] The Mother of All (bash) Commands



On Tue, 18 Mar 2008 01:51:39 +0900
"Greg Thomson " <gregt@example.com> wrote:

> Here is a cool little bash one liner with explaination.
> This may not interest bash gurus but it really illustrates the power of  
> the command line.
> 
> laptop# ( cd / ; tar -zcvf - /home ) | ssh user@example.com 'cat >  
> laptop_backup_`date -I`.tar.gz'

If you have a gnu tar, you can simply do
tar -zcvf user@example.com:laptop_backup`date -I`.tar.gz /home

Notes:
1) tar uses ssh to connect to a remote host, if it finds a colon
   in the archive file name. If this is undesired use --force-local
2) cd / isn't needed if the absolut path of /home is given
3) tar behaves differently if an absolute path or a relative
   path is given regarding hardlinks 
   (if in doubt, use cd $path; tar <options> . )
4) tar needs rmt on the remote machine which might be in a
   location tar doesn't expect it to be (it changed a few times
   in history), the hardly documented --rmt-command=<path-to-rmt>
   fixes this. Make sure to use the rmt command that is compatible 
   to your tar (eg rmt-tar)


			Attila Kinali


-- 
Praised are the Fountains of Shelieth, the silver harp of the waters,
But blest in my name forever this stream that stanched my thirst!
                         -- Deed of Morred


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links