Wednesday, August 12, 2009
tar help (zip up a linux dir and all files and subdirs)
tar -cvzpffilename.gz {source dir or files wildcard}
Example:
tar -cvzpfpublic_html_backup_08122009_plinkgolf.gz public_html
where:
-f - whatever follows the f is the filename, so public_html_backup_08122009_plinkgolf.gz is the tarball/zip file name in this case.
-v indicates verbose listing of command output.
-c indicates create a new tar ball file.
-z indicates use gzip.
-p indicates preserve all permissions of underlying files/dirs being zipped.
public_html - is the name of the top level folder I am zipping including all its subfolders and files underneath it
Have a nice day!
Oops - almost forgot, to explode/unzip the zip file in the current directory, just type:
tar -xvf nameofzipfile.gz
Thursday, March 05, 2009
Using the SCP command (Linux)
20.3.2. Using the scp Command
The scp command can be used to transfer files between machines over a secure, encrypted connection. It is similar to rcp.
The general syntax to transfer a local file to a remote system is as follows:
scp username@tohostname: The specifies the source including path to the file, such as /var/log/maillog. The specifies the destination, which can be a new filename such as /tmp/hostname-maillog. For the remote system, if you do not have a preceding /, the path will be relative to the home directory of username, typically /home/username/.
To transfer the local file shadowman to the home directory of your account on penguin.example.net, type the following at a shell prompt (replace username with your username):
scp shadowman username@penguin.example.net:shadowman This will transfer the local file shadowman to /home/ on penguin.example.net. Alternately, you can leave off the final username/shadowmanshadowman in the scp command.
The general syntax to transfer a remote file to the local system is as follows:
scp username@tohostname: The specifies the source including path, and specifies the destination including path.
Multiple files can be specified as the source files. For example, to transfer the contents of the directory downloads/ to an existing directory called uploads/ on the remote machine penguin.example.net, type the following at a shell prompt:
scp downloads/* username@penguin.example.net:uploads