YouTube2Text

Linux Commands for Beginners 24 - Transferring Files with rsync — Transcript

by Learn Linux TV · 3,129 words · 414 segments · language en · Watch on YouTube

Full transcript

  1. 0:00[Music]
  2. 0:21you know our sink is actually one of my
  3. 0:23favorite Linux commands because it's
  4. 0:25such a powerful utility that you can use
  5. 0:28to copy files from one Linux instance to
  6. 0:32another in fact it doesn't even have to
  7. 0:34be to another Linux instance because you
  8. 0:37could use it to copy files from your
  9. 0:39local Linux instance to a flash drive or
  10. 0:41a backup hard drive basically our sink
  11. 0:44allows you to copy files from point A to
  12. 0:46point B and you could basically have
  13. 0:48point a B or Linux instance in point B
  14. 0:51be whatever backup device another server
  15. 0:53you name it so it's definitely one of my
  16. 0:55favorite commands and since it's so
  17. 0:57powerful I can't possibly explore every
  18. 0:59single option in this video but what I
  19. 1:01am going to do is I'm going to give you
  20. 1:03guys an overview of our sink and how it
  21. 1:07works and this is actually going to be
  22. 1:09the final video in this series because I
  23. 1:11think at this point I showed you guys
  24. 1:13everything that you need to know to have
  25. 1:15an understanding of the Linux command
  26. 1:17line are there other commands that I
  27. 1:19haven't gone over well of course there's
  28. 1:21hundreds of commands out there I can't
  29. 1:23possibly cover them all but I do feel
  30. 1:26that I have gone over all of the
  31. 1:27prominent commands that you really need
  32. 1:29to know the commands that you need to
  33. 1:31have in your tool set so join me one
  34. 1:34last time
  35. 1:35as I show you the our sink command in my
  36. 1:39Linux commands for beginners series so
  37. 1:42here we are at my terminal and I'm on my
  38. 1:45local linux shell again this is my
  39. 1:47prompt that I've been using these days
  40. 1:50then I have a tab right here which
  41. 1:54actually has some output from a previous
  42. 1:56video still there but basically this is
  43. 1:58an ubuntu server on Leno now of course
  44. 2:00you can actually copy files to one local
  45. 2:05location to another so it doesn't even
  46. 2:07have to be a remote location but in this
  47. 2:10video to show you the basics that's
  48. 2:11exactly what I'm going to do is show you
  49. 2:13how to copy files from point A to point
  50. 2:15B now I was using some ROM files in my
  51. 2:19ROM collection for retro games so that's
  52. 2:22why you see I have a NES directory and a
  53. 2:25Yoshi file right here those are just the
  54. 2:28files that I had available at the time
  55. 2:30I'm gonna go ahead and remove those
  56. 2:31though to start fresh
  57. 2:34and now we have nothing here on that
  58. 2:36server in order to copy files to the
  59. 2:39server I need the IP address we can get
  60. 2:41that from IP space a and then we could
  61. 2:45see the IP address is right here so some
  62. 2:48of this output is wrapped due to this
  63. 2:49text size here but basically you're
  64. 2:52looking for your IP address then you can
  65. 2:54see that I have that right here I'm
  66. 2:57gonna go back to my local instance and
  67. 3:00if I do a list storage here of all kinds
  68. 3:03of things because this is my actual
  69. 3:04laptop right here and I've been using
  70. 3:07retropie files retropie is a popular
  71. 3:10solution for playing classic games in
  72. 3:13emulated form you can see the directory
  73. 3:16right here that doesn't matter because
  74. 3:18whatever you're using rsync for doesn't
  75. 3:21have to be games you can copy anything
  76. 3:23I'm just using that as an example so I'm
  77. 3:25gonna basically go into that folder we
  78. 3:29see that we have a roms directory in
  79. 3:31there if I do an LS on that you see they
  80. 3:34have all kinds of things I'm gonna go
  81. 3:36into the roms folder you can see if
  82. 3:38that's my current working directory and
  83. 3:41what I want to do is copy the NES
  84. 3:45directory which has all kinds of games
  85. 3:47in there to my server but our sink is
  86. 3:51one of those commands that if you're not
  87. 3:52careful you could actually mess things
  88. 3:55up I'll show you what I mean in here in
  89. 3:57just a moment so to be safe I'm just
  90. 3:59going to copy the NES directory do a
  91. 4:02copy - are and yes I'm going to copy to
  92. 4:05my home directory I'm gonna go back to
  93. 4:08my home directory you can see that I
  94. 4:13have the NES directory right here that's
  95. 4:16so that I don't mess up the original now
  96. 4:19what I want to do is our sink - our NES
  97. 4:25that's the directory that I want to copy
  98. 4:27I'm going to use my name at and the IP
  99. 4:31address that's where I want to copy it
  100. 4:33to and I want to copy it to slash home
  101. 4:35slash J so the R is recursive because
  102. 4:39the NES directory is a directory I want
  103. 4:42to copy not just the directory but
  104. 4:43everything inside of it the user I want
  105. 4:46to use for the connection is
  106. 4:47J @ that's the IP address of the remote
  107. 4:50server I'm copy copying things to : and
  108. 4:53then the home directory which looks very
  109. 4:56similar to the SCP command that we used
  110. 5:00in a previous video but let's see what
  111. 5:01happens it's asking for my password and
  112. 5:06that's a password of the remote end and
  113. 5:07I'll press enter and it's doing
  114. 5:11something but what exactly is it doing
  115. 5:13is it copying the folder over let's see
  116. 5:16now I did delete the folder here so
  117. 5:18let's see if it's back and it is I mean
  118. 5:23we have stuff inside there so even
  119. 5:25though we have no output it actually did
  120. 5:28copy everything over why don't we have
  121. 5:31any output well that's because we have
  122. 5:33to use the - V option for verbose to let
  123. 5:38the Arsene command know that we actually
  124. 5:40want to see the output as it copies it
  125. 5:44so I'm going to go ahead and remove this
  126. 5:46folder see that it is in fact gone and
  127. 5:55right now I'm going to go ahead and
  128. 5:57reissue this command but in the password
  129. 6:02and now we see that it actually is
  130. 6:05copying everything over well actually it
  131. 6:08already was copying everything over but
  132. 6:10now we can actually see the output as it
  133. 6:12does it will get back to the video
  134. 6:15shortly but I'd like to take a moment to
  135. 6:17thank my sponsor Linode I definitely
  136. 6:20recommend you check out Linode Linode
  137. 6:22has a special offer for subscribers of
  138. 6:25learn Linux TV if you watch my channel
  139. 6:27no doubt you're interested in tinkering
  140. 6:30with things like computers Linux servers
  141. 6:32and the like so that's why Linode wants
  142. 6:35your help
  143. 6:36testing out their new data center coming
  144. 6:39to sydney australia by the end of 2019
  145. 6:42sign up to become a beta tester by
  146. 6:45visiting the link in the description and
  147. 6:47you'll be notified by email when the
  148. 6:49beta opens for testing by joining the
  149. 6:52beta program you'll even have the
  150. 6:54opportunity to be the first to test
  151. 6:55other Linode products in the future be
  152. 6:58sure to check the I want to be a
  153. 7:01a tester box when you sign up be sure to
  154. 7:03check out Linode and let's get back to
  155. 7:06the video now it gives us some
  156. 7:09information which is actually useful
  157. 7:11tells us the speed up the total size and
  158. 7:14it gave us a list of all the files and
  159. 7:16it's actually copying as it was copying
  160. 7:17them so we can simplify this command a
  161. 7:21bit just like we can with SCP we could
  162. 7:23take the path off if we're copying it to
  163. 7:26our home directory we can also take off
  164. 7:29the username because I'm logged in as
  165. 7:31the user I'm using the copy files with
  166. 7:33same like SCP how in the previous video
  167. 7:37we simplified the commander basically
  168. 7:38doing the same thing with this so I'll
  169. 7:40press enter through the password now
  170. 7:46what I'm gonna do is show you guys
  171. 7:47another reason why our sink rocks so
  172. 7:51what I'm gonna do is I'm going to delete
  173. 7:54the file again just to start fresh so
  174. 7:57the NES directory is gone and then what
  175. 8:01I'm gonna do is recopy that over but I'm
  176. 8:02gonna change the options around a little
  177. 8:04bit I'm going to use - a V Z as my
  178. 8:10options and I'll show you exactly what
  179. 8:12that does press enter password and it's
  180. 8:20copying everything over
  181. 8:27let's see let's see what happens let's
  182. 8:29recall that command there it is and
  183. 8:31basically just to make sure it works NES
  184. 8:34directory is there and so is all the
  185. 8:37contents so I used a VZ what is a so to
  186. 8:46show you what a is let's take a look at
  187. 8:47the man page I'll search for it here it
  188. 8:53is guys but it's wrapped a little bit so
  189. 8:56let me just go ahead and make this a
  190. 8:57little bit smaller hopefully you could
  191. 9:01still see it a is archive mode which
  192. 9:05basically gives it all of these options
  193. 9:08right here so recursive is already part
  194. 9:11of it and without going into too much
  195. 9:14detail it's going to make sure that that
  196. 9:16permissions are the same the timestamps
  197. 9:19are the same we want everything on the
  198. 9:21other end to be the same right down to
  199. 9:24the permissions ownership and so on and
  200. 9:26if you're curious what all of these
  201. 9:28options do that are a part of - a so if
  202. 9:31you use - a you're getting all of these
  203. 9:33highlighted options at the same time you
  204. 9:36could go ahead and look at the man page
  205. 9:37and see for yourself for example we can
  206. 9:39see that our is recursive here it is and
  207. 9:43so on but I also added Z so recall the
  208. 9:49command Z is basically compressed that
  209. 9:53compresses things when you're
  210. 9:55transferring which could be handy if
  211. 9:57you're going through a slower link that
  212. 9:59might save you a little bit of time v as
  213. 10:02you know is verbose because we want to
  214. 10:04see everything that's being copied so
  215. 10:06again if I press Enter it's just not
  216. 10:12going to copy anything because it's
  217. 10:14archive mode it's going to make
  218. 10:15everything exactly the same and the
  219. 10:18other end is exactly the same because we
  220. 10:20really haven't changed anything so if I
  221. 10:23go ahead and RM NES and I'll remove that
  222. 10:27and I'll also remove randomly Yoshi at
  223. 10:32NES which is actually in the NES
  224. 10:35directory so I should type that
  225. 10:36correctly sorry I removed two files from
  226. 10:39the remote end
  227. 10:40I'll go back here to the source I'm
  228. 10:44going to recall that command and see
  229. 10:45what happens
  230. 10:49it only copied two things that copied
  231. 10:53the things that we're missing on the
  232. 10:55other end Yoshida NES in this Zen
  233. 10:59intergalactic ninja I deleted those and
  234. 11:02since they were missing on the other end
  235. 11:03and our sync was ran again and saw that
  236. 11:06those files were missing and since its
  237. 11:09default is to make you know the other
  238. 11:11end the same as the source it's going to
  239. 11:13recopy those files back and our sync is
  240. 11:17actually pretty smart I'll show you what
  241. 11:19I mean by that I'm gonna go ahead and RM
  242. 11:22NES Yoshi dot NES and what I'm gonna do
  243. 11:28is echo hello world I'm gonna redirect
  244. 11:32that to NES Yoshi and yes I list the
  245. 11:38storage on NES we actually do have Yoshi
  246. 11:42NES right here but that's not actually
  247. 11:46the same file that's just a text file I
  248. 11:49copied some string text into let's see
  249. 11:52if yo if our sync is smart enough to
  250. 11:55know that that file isn't quite the same
  251. 11:57thing and recopy it let's see what
  252. 11:58happens and it was it saw that the file
  253. 12:05on the remote end was not the same as
  254. 12:08the local that file was present on the
  255. 12:10remote end but again that was just a
  256. 12:12standard text file I deleted the deleted
  257. 12:14the original and recreated it with an
  258. 12:16echo command which of course is not the
  259. 12:18same file our sake knows that and it
  260. 12:21went ahead and copied that file over to
  261. 12:24the other end
  262. 12:26now there's one option of our sync I
  263. 12:28want to basically direct your attention
  264. 12:30to if I go to the man page for it
  265. 12:33probably have to make this a little bit
  266. 12:35smaller let's look up the - II option
  267. 12:41the - II option here allows you to
  268. 12:45specify the remote shell to use which is
  269. 12:48basically meaning that you can specify
  270. 12:51SSH
  271. 12:53but we didn't do that so how did that
  272. 12:56copy over well actually our sink
  273. 12:59defaults to SSH we didn't tell it to use
  274. 13:02SSH it's actually using SSH for the file
  275. 13:06transfer itself by default so if we
  276. 13:10didn't have SSH installed on the other
  277. 13:12end yes as a server this command would
  278. 13:15not have worked now I'm going to show
  279. 13:17you another variation here of the our
  280. 13:20sink command on the other end I'm going
  281. 13:23to delete this folder in its entirety
  282. 13:27and then switch back here to to the
  283. 13:31local terminal so I'll recall the
  284. 13:33original command here our sink - avz
  285. 13:37that's a folder name and again that's
  286. 13:39the IP address I'm copying it - but what
  287. 13:42I'm going to do is add another option -
  288. 13:44- remove source files I'm going to add
  289. 13:48that to the command and again I deleted
  290. 13:52it from here so it's not present anymore
  291. 13:56and then what I'm going to do is copy
  292. 13:59that over again password and again it's
  293. 14:04going to copy the files over same as
  294. 14:06before
  295. 14:12all right so what happened well let's go
  296. 14:16ahead and go over here and you know the
  297. 14:19file or the folder was created with all
  298. 14:21the files inside but here on the
  299. 14:24original source I'll do LS and I have
  300. 14:27NES there but there's nothing inside
  301. 14:32I used remove source files so that's
  302. 14:36useful if you want to move the files
  303. 14:38from point A to point B this can be
  304. 14:41potentially destructive though so you
  305. 14:44want to basically be careful and then
  306. 14:47there's one more option I want to show
  307. 14:48you guys so what I'm gonna do is copy
  308. 14:51that NES directory back to its original
  309. 14:53location see the NES directories back
  310. 15:00and now I'm going to use the same
  311. 15:05command again
  312. 15:06remove source files and let's go ahead
  313. 15:07and for fun we're going to remove it
  314. 15:10from here and I'm gonna add yet another
  315. 15:18option here I'm gonna do - - dry - run
  316. 15:22so it's the same command but I added
  317. 15:24that one option and if nothing else I
  318. 15:27definitely want you guys to remember
  319. 15:29this dry run option it's extremely
  320. 15:32important and I'll tell you why in a
  321. 15:33minute but I'll go ahead and enter the
  322. 15:35command let's run it
  323. 15:38alright so Wow that was super fast
  324. 15:42wasn't it that was almost instantaneous
  325. 15:44that it copied all those files over so
  326. 15:47what happened nothing nothing happened
  327. 15:50because there's nothing here so if I do
  328. 15:54LS against the NES directory those files
  329. 15:57are still present and again the command
  330. 16:00I used was this one now dry run as you
  331. 16:04probably already assumed is just a test
  332. 16:09it doesn't actually run but it does give
  333. 16:13you output on what it would do if it
  334. 16:16were to run now it did ask for the
  335. 16:18password of the remote end because it
  336. 16:20does need to check what the remote end
  337. 16:22has and that way it'll know what
  338. 16:26it's going to do it gives me the output
  339. 16:27of all the files that it would copy but
  340. 16:29it's a dry run it's not actually going
  341. 16:32to do anything and the reason why a dry
  342. 16:34run is so important is because it gives
  343. 16:37you a preview of what our sink is going
  344. 16:39to do so any our sink command which may
  345. 16:42overwrite or remove files from either
  346. 16:44end I highly recommend you try that with
  347. 16:47a dry run first before you actually do
  348. 16:51it and again this - - dry - run this
  349. 16:55option right here to do a dry run
  350. 16:57extremely important so now that I know
  351. 17:00that that works or at least the output
  352. 17:03is what I expected I can remove the dry
  353. 17:04run and let's do it for real now it's
  354. 17:09actually doing it
  355. 17:13files are removed from the source and
  356. 17:18they're present here on the target so
  357. 17:21the file or excuse me the folder is
  358. 17:23still here it's just empty so I could do
  359. 17:25touch any ass test file I could do our
  360. 17:31sink let's do a dry run again press
  361. 17:37Enter so it connected to the to the
  362. 17:44remote end here and it basically knows
  363. 17:46test file was missing from the target
  364. 17:49and the dry run is telling me that if I
  365. 17:51was to run this for real then it's going
  366. 17:54to move this file over since I use
  367. 17:56remove source file then that file is
  368. 17:58going to be gone so now that I know that
  369. 17:59it's doing what I expect I could remove
  370. 18:02dry run press enter it copied it over it
  371. 18:12basically removed it from the local end
  372. 18:18and we can see that the test file is
  373. 18:21indeed there now the rsync command gets
  374. 18:25way more involved in this this is just
  375. 18:28the beginning our sink is a very very
  376. 18:31valuable tool and there's all kinds of
  377. 18:33cool stuff that you can do with it so I
  378. 18:35recommend that you check out some
  379. 18:37additional examples on the usage of
  380. 18:39arson
  381. 18:39because I do recommend that you learn it
  382. 18:42it's a very important tool for every
  383. 18:44Linux administrator to know and with
  384. 18:47that said that you know here comes the
  385. 18:49end of the Linux commands for beginner
  386. 18:51series now of course I'll be doing more
  387. 18:54tutorials so it's not the end of my
  388. 18:56tutorials it's just the end of this
  389. 18:57particular series but I'll show you guys
  390. 18:59other commands and other tricks and all
  391. 19:02kinds of things in future tutorial
  392. 19:04videos either in another series or maybe
  393. 19:07even in some standalone videos so if you
  394. 19:10haven't already done so please subscribe
  395. 19:11and the next tutorials I make you'll be
  396. 19:14the first to see them thank you guys so
  397. 19:16much for watching these videos I hope
  398. 19:18this series was very helpful for you and
  399. 19:20I will see you in the next video
  400. 19:22whatever that might be thanks for
  401. 19:25checking out my video I really
  402. 19:27appreciate it if you found it useful
  403. 19:28click that like button and if you
  404. 19:31haven't already done so make sure you
  405. 19:33subscribe so you'll see the latest
  406. 19:34content as soon as it becomes available
  407. 19:36if you want to help me out there's links
  408. 19:39down below for my patreon page as well
  409. 19:42as links for purchasing my Linux ebooks
  410. 19:44and also my affiliate store which has a
  411. 19:47listing of linux compatible hardware
  412. 19:49that i've actually tested personally
  413. 19:51thanks again for watching and I'll see
  414. 19:53you in the next video

About this transcript

This page contains the full transcript of Linux Commands for Beginners 24 - Transferring Files with rsync by Learn Linux TV, generated from the public captions YouTube serves with the video. The transcript has 3,129 words across 414 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.