Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet417/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   413   414   415   416   417   418   419   420   ...   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)

[
 319 
]
Transferring files with SCP
A useful alternative to 
rsync
 is the 
Secure Copy
 (
SCP
) utility, which comes bundled 
with the OpenSSH client. It allows you to quickly copy files from one 
node to 
another. While 
rsync
 also allows you to copy files to other network nodes via SSH
SCP is more practical for one-off tasks; 
rsync
 is geared toward more complex jobs. If 
your goal is to send a single file or a small number of files to another machine, SCP 
is a great tool you can use to get the job done. If nothing else, it's yet another item for 
your administration toolbox. To utilize SCP, we'll use the 
scp
 command. Since you 
most likely already have the OpenSSH client installed, you should already have the 
scp
 command available. If you execute 
which scp
, you should receive the following 
output:
/usr/bin/scp 
If you don't see any output, make sure that the 
openssh-client
 package is installed.
Using SCP is very similar in nature to 
rsync
. The command requires a source, a 
target, and a filename. To transfer a single file from your local machine to another, 
the resulting command would look similar to the following:
scp myfile.txt jdoe@192.168.1.50:/home/jdoe 
With this example, we're copying the 
myfile.txt
 file (which is located in our 
current working directory) to a server located at 
192.168.1.50
. If the target server is 
recognized by DNS, we could've used the DNS name instead of the IP address. The 
command will connect to the server as user 
jdoe
 and place the file into that user's 
home
 directory. Actually, we can shorten that command a bit:
scp myfile.txt jdoe@192.168.1.50: 
Notice that I removed the target path, which was 
/home/jdoe
. I'm able to omit the 
path to the target, since the 
home
 directory is assumed if you don't give the 
scp
 
command a target path. Therefore, the 
myfile.txt
 file will end up in 
/home/jdoe
 
whether or not I included the path to the 
home
 directory explicitly. If I wanted to 
copy the file somewhere else, I would definitely need to call out the location. Make 
sure you always include at least the colon when copying a file, since if you don't 
include it, you'll end up copying the file to your current working directory instead 
of the target.
The 
scp
 command also works in reverse:
scp jdoe@192.168.1.50:myfile.txt  . 


Sharing and Transferring Files

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   413   414   415   416   417   418   419   420   ...   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