SCP/RSYNC & Archiving
log out of server
CRTD+d
Exit Virtual machine
CRTL+ALT
scp vs. rsync
Both the scp & rsync can be used to transfer files/directories but rsync fares a little better when comes to performance. Also rysnc has option to take differential backup which scp lacks. Rsync is secure & faster than scp & can also be used in place of scp command to copy files/directories to remote host.
Zip
Format used to archive FILES. Compressing one or more files to reduce size.
RSYNC
Rsync's main function isto synchronize files/directories either on local host or on remote host. Rsync initially copies whole directory & then copies newly added files (differential backup) rather than copying whole directory again. Rsync consumes less bandwidth as it uses compression and decompression method while sending and receiving data both ends.
TAR
Tape Archive. A format used for archiving DIRECTORIES. By default, tar is not a compression method and will have to use gzip to compress a tar file.
-f
archive file name
-a
archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
ipconfig
check ip address
-z
compress archive using gzip program
-z
compress file data
-r
copies data recursively (but don't preserve timestamps and permission while transferring data
-c
create archive
-x
extract tar file
uncompress gzip
gunzip (filename.tar.gz)
gzip file
gzip (filename)
gzip a tar file
gzip (filename.tar)
-h
human readable format
-p
keeps same permission and time stamp
rsync command
rsync (options) (source) (destination) rsync (-avrz) (directoryname) ([email protected]:/home)
SCP files (local to remote)
scp (local file) (remote user/hostname@IPaddress:file/directoryname)
SCP files (remote to local)
scp (remote user/hostname@IPaddress: file/directoryname) (local destination file)
SCP directories
scp -r (local directoryname) (remote user/hostname@IPaddress:directoryname)
SCP
scp is based on ssh & is used to transfer a file from local host to remote host securely. SCP is used to transfer all files/ overwrites old info.
archive
single file that contains any number of individual files plus information to allow them to be restored to their original form by one or more extraction programs. Archives are convenient for storing files. USED TO CREATE STORAGE AND BACKUPS.
switch server
ssh user/hostname@ipaddress:/
tar a directory
tar -cvf (new file name) (old file) tar -cvf kasha-nr.tar kasha
view tar
tar -tvf (tar file name) tar -tvf kasha-nr.tar
extract tar
tar -xvf (tar file name) tar -xvf (kasha-nr.tar)
archive & compress (tar)
tar -zcvf (new name.tar.gz) (file) tar -zcvf kasha-nr.tar.gz kasha
GZIP
to compress files and tar files. Cannot gzip a directory; must tar first.
-t
to view tar
view unzipped file
unzip (filename.zip)
view compressed zip file
unzip -l (filename.zip)
-v
verbose
-v
verbose. Display progress while creating archive.
Zip file
zip (newname.zip) (old files) zip file.zip file1 file2 file3