Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet415/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   411   412   413   414   415   416   417   418   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

[
 317 
]
The 
archive
 mode is great and all, but wouldn't it be nice to be able to watch what 
rsync
 is up to when it runs? Add the 
-v
 option and try the command again:
sudo rsync -av /home/myuser /backup 
This time, 
rsync
 will display on your terminal what it's doing as it runs (
-v
 activates 
verbose
 mode). This is actually one of my favorite variations of the 
rsync
 command, 
as I like to copy everything and retain all the metadata, as well as watch what 
rsync
 
is doing as it works.
What if I told you that 
rsync
 supports SSH by default? It's true! Using 
rsync
, you can 
easily copy data from one node to another, even over SSH. The same options apply, 
so you don't actually have to do anything different other than point 
rsync
 to the 
other server, rather than to another directory on your local server:
sudo rsync -av /home/myuser admin@192.168.1.5:/backup 
With this example, I'm copying the 
home
 directory for 
myuser
 to the 
/backup
 directory 
on server 
192.168.1.5
. I'm connecting to the other server as the 
admin
 user. Make 
sure you change the user account and IP address accordingly, and also make sure 
the user account you use has access to the 
/backup
 directory. When you run this 
command, you should get prompted for the SSH password as you would when 
using plain SSH to connect to the server. After the connection is established, the 
files will be copied to the target server and directory.
Now, we'll get into some even cooler examples (some of which are potentially 
destructive), and we probably won't want to work with an actual 
home
 directory 
for these, unless it's a test account and you don't care about its contents. As I've 
mentioned before, you should have some test files to play with. When practicing, 
simply replace my directories with yours. Here's another variation worth trying:
sudo rsync -av --delete /src /target 
Now I'm introducing you to the 
--delete
 option. This option allows you to 
synchronize two directories. Let me explain why this is important. With every 
rsync
 
example up until now, we've been copying files from point A to point B, but we 
weren't deleting anything. For example, let's say you've already used 
rsync
 to copy 
contents from point A to point B. Then, you delete some files from point A. When 
you use 
rsync
 to copy files from point A to point B again, the files you deleted in 
point A won't be deleted in point B. They'll still be there. This is because by default, 
rsync
 copies data between two locations, but it doesn't remove anything. With the 
--delete
 option, you're effectively synchronizing the two points, thus you're telling 
rsync
 to make them the same by allowing it to delete files in the target that are no 
longer in the source.


Sharing and Transferring Files

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   411   412   413   414   415   416   417   418   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish