Linux Commands for Beginners 24 - Transferring Files with rsync — Transcript
Full transcript
- 0:00[Music]
- 0:21you know our sink is actually one of my
- 0:23favorite Linux commands because it's
- 0:25such a powerful utility that you can use
- 0:28to copy files from one Linux instance to
- 0:32another in fact it doesn't even have to
- 0:34be to another Linux instance because you
- 0:37could use it to copy files from your
- 0:39local Linux instance to a flash drive or
- 0:41a backup hard drive basically our sink
- 0:44allows you to copy files from point A to
- 0:46point B and you could basically have
- 0:48point a B or Linux instance in point B
- 0:51be whatever backup device another server
- 0:53you name it so it's definitely one of my
- 0:55favorite commands and since it's so
- 0:57powerful I can't possibly explore every
- 0:59single option in this video but what I
- 1:01am going to do is I'm going to give you
- 1:03guys an overview of our sink and how it
- 1:07works and this is actually going to be
- 1:09the final video in this series because I
- 1:11think at this point I showed you guys
- 1:13everything that you need to know to have
- 1:15an understanding of the Linux command
- 1:17line are there other commands that I
- 1:19haven't gone over well of course there's
- 1:21hundreds of commands out there I can't
- 1:23possibly cover them all but I do feel
- 1:26that I have gone over all of the
- 1:27prominent commands that you really need
- 1:29to know the commands that you need to
- 1:31have in your tool set so join me one
- 1:34last time
- 1:35as I show you the our sink command in my
- 1:39Linux commands for beginners series so
- 1:42here we are at my terminal and I'm on my
- 1:45local linux shell again this is my
- 1:47prompt that I've been using these days
- 1:50then I have a tab right here which
- 1:54actually has some output from a previous
- 1:56video still there but basically this is
- 1:58an ubuntu server on Leno now of course
- 2:00you can actually copy files to one local
- 2:05location to another so it doesn't even
- 2:07have to be a remote location but in this
- 2:10video to show you the basics that's
- 2:11exactly what I'm going to do is show you
- 2:13how to copy files from point A to point
- 2:15B now I was using some ROM files in my
- 2:19ROM collection for retro games so that's
- 2:22why you see I have a NES directory and a
- 2:25Yoshi file right here those are just the
- 2:28files that I had available at the time
- 2:30I'm gonna go ahead and remove those
- 2:31though to start fresh
- 2:34and now we have nothing here on that
- 2:36server in order to copy files to the
- 2:39server I need the IP address we can get
- 2:41that from IP space a and then we could
- 2:45see the IP address is right here so some
- 2:48of this output is wrapped due to this
- 2:49text size here but basically you're
- 2:52looking for your IP address then you can
- 2:54see that I have that right here I'm
- 2:57gonna go back to my local instance and
- 3:00if I do a list storage here of all kinds
- 3:03of things because this is my actual
- 3:04laptop right here and I've been using
- 3:07retropie files retropie is a popular
- 3:10solution for playing classic games in
- 3:13emulated form you can see the directory
- 3:16right here that doesn't matter because
- 3:18whatever you're using rsync for doesn't
- 3:21have to be games you can copy anything
- 3:23I'm just using that as an example so I'm
- 3:25gonna basically go into that folder we
- 3:29see that we have a roms directory in
- 3:31there if I do an LS on that you see they
- 3:34have all kinds of things I'm gonna go
- 3:36into the roms folder you can see if
- 3:38that's my current working directory and
- 3:41what I want to do is copy the NES
- 3:45directory which has all kinds of games
- 3:47in there to my server but our sink is
- 3:51one of those commands that if you're not
- 3:52careful you could actually mess things
- 3:55up I'll show you what I mean in here in
- 3:57just a moment so to be safe I'm just
- 3:59going to copy the NES directory do a
- 4:02copy - are and yes I'm going to copy to
- 4:05my home directory I'm gonna go back to
- 4:08my home directory you can see that I
- 4:13have the NES directory right here that's
- 4:16so that I don't mess up the original now
- 4:19what I want to do is our sink - our NES
- 4:25that's the directory that I want to copy
- 4:27I'm going to use my name at and the IP
- 4:31address that's where I want to copy it
- 4:33to and I want to copy it to slash home
- 4:35slash J so the R is recursive because
- 4:39the NES directory is a directory I want
- 4:42to copy not just the directory but
- 4:43everything inside of it the user I want
- 4:46to use for the connection is
- 4:47J @ that's the IP address of the remote
- 4:50server I'm copy copying things to : and
- 4:53then the home directory which looks very
- 4:56similar to the SCP command that we used
- 5:00in a previous video but let's see what
- 5:01happens it's asking for my password and
- 5:06that's a password of the remote end and
- 5:07I'll press enter and it's doing
- 5:11something but what exactly is it doing
- 5:13is it copying the folder over let's see
- 5:16now I did delete the folder here so
- 5:18let's see if it's back and it is I mean
- 5:23we have stuff inside there so even
- 5:25though we have no output it actually did
- 5:28copy everything over why don't we have
- 5:31any output well that's because we have
- 5:33to use the - V option for verbose to let
- 5:38the Arsene command know that we actually
- 5:40want to see the output as it copies it
- 5:44so I'm going to go ahead and remove this
- 5:46folder see that it is in fact gone and
- 5:55right now I'm going to go ahead and
- 5:57reissue this command but in the password
- 6:02and now we see that it actually is
- 6:05copying everything over well actually it
- 6:08already was copying everything over but
- 6:10now we can actually see the output as it
- 6:12does it will get back to the video
- 6:15shortly but I'd like to take a moment to
- 6:17thank my sponsor Linode I definitely
- 6:20recommend you check out Linode Linode
- 6:22has a special offer for subscribers of
- 6:25learn Linux TV if you watch my channel
- 6:27no doubt you're interested in tinkering
- 6:30with things like computers Linux servers
- 6:32and the like so that's why Linode wants
- 6:35your help
- 6:36testing out their new data center coming
- 6:39to sydney australia by the end of 2019
- 6:42sign up to become a beta tester by
- 6:45visiting the link in the description and
- 6:47you'll be notified by email when the
- 6:49beta opens for testing by joining the
- 6:52beta program you'll even have the
- 6:54opportunity to be the first to test
- 6:55other Linode products in the future be
- 6:58sure to check the I want to be a
- 7:01a tester box when you sign up be sure to
- 7:03check out Linode and let's get back to
- 7:06the video now it gives us some
- 7:09information which is actually useful
- 7:11tells us the speed up the total size and
- 7:14it gave us a list of all the files and
- 7:16it's actually copying as it was copying
- 7:17them so we can simplify this command a
- 7:21bit just like we can with SCP we could
- 7:23take the path off if we're copying it to
- 7:26our home directory we can also take off
- 7:29the username because I'm logged in as
- 7:31the user I'm using the copy files with
- 7:33same like SCP how in the previous video
- 7:37we simplified the commander basically
- 7:38doing the same thing with this so I'll
- 7:40press enter through the password now
- 7:46what I'm gonna do is show you guys
- 7:47another reason why our sink rocks so
- 7:51what I'm gonna do is I'm going to delete
- 7:54the file again just to start fresh so
- 7:57the NES directory is gone and then what
- 8:01I'm gonna do is recopy that over but I'm
- 8:02gonna change the options around a little
- 8:04bit I'm going to use - a V Z as my
- 8:10options and I'll show you exactly what
- 8:12that does press enter password and it's
- 8:20copying everything over
- 8:27let's see let's see what happens let's
- 8:29recall that command there it is and
- 8:31basically just to make sure it works NES
- 8:34directory is there and so is all the
- 8:37contents so I used a VZ what is a so to
- 8:46show you what a is let's take a look at
- 8:47the man page I'll search for it here it
- 8:53is guys but it's wrapped a little bit so
- 8:56let me just go ahead and make this a
- 8:57little bit smaller hopefully you could
- 9:01still see it a is archive mode which
- 9:05basically gives it all of these options
- 9:08right here so recursive is already part
- 9:11of it and without going into too much
- 9:14detail it's going to make sure that that
- 9:16permissions are the same the timestamps
- 9:19are the same we want everything on the
- 9:21other end to be the same right down to
- 9:24the permissions ownership and so on and
- 9:26if you're curious what all of these
- 9:28options do that are a part of - a so if
- 9:31you use - a you're getting all of these
- 9:33highlighted options at the same time you
- 9:36could go ahead and look at the man page
- 9:37and see for yourself for example we can
- 9:39see that our is recursive here it is and
- 9:43so on but I also added Z so recall the
- 9:49command Z is basically compressed that
- 9:53compresses things when you're
- 9:55transferring which could be handy if
- 9:57you're going through a slower link that
- 9:59might save you a little bit of time v as
- 10:02you know is verbose because we want to
- 10:04see everything that's being copied so
- 10:06again if I press Enter it's just not
- 10:12going to copy anything because it's
- 10:14archive mode it's going to make
- 10:15everything exactly the same and the
- 10:18other end is exactly the same because we
- 10:20really haven't changed anything so if I
- 10:23go ahead and RM NES and I'll remove that
- 10:27and I'll also remove randomly Yoshi at
- 10:32NES which is actually in the NES
- 10:35directory so I should type that
- 10:36correctly sorry I removed two files from
- 10:39the remote end
- 10:40I'll go back here to the source I'm
- 10:44going to recall that command and see
- 10:45what happens
- 10:49it only copied two things that copied
- 10:53the things that we're missing on the
- 10:55other end Yoshida NES in this Zen
- 10:59intergalactic ninja I deleted those and
- 11:02since they were missing on the other end
- 11:03and our sync was ran again and saw that
- 11:06those files were missing and since its
- 11:09default is to make you know the other
- 11:11end the same as the source it's going to
- 11:13recopy those files back and our sync is
- 11:17actually pretty smart I'll show you what
- 11:19I mean by that I'm gonna go ahead and RM
- 11:22NES Yoshi dot NES and what I'm gonna do
- 11:28is echo hello world I'm gonna redirect
- 11:32that to NES Yoshi and yes I list the
- 11:38storage on NES we actually do have Yoshi
- 11:42NES right here but that's not actually
- 11:46the same file that's just a text file I
- 11:49copied some string text into let's see
- 11:52if yo if our sync is smart enough to
- 11:55know that that file isn't quite the same
- 11:57thing and recopy it let's see what
- 11:58happens and it was it saw that the file
- 12:05on the remote end was not the same as
- 12:08the local that file was present on the
- 12:10remote end but again that was just a
- 12:12standard text file I deleted the deleted
- 12:14the original and recreated it with an
- 12:16echo command which of course is not the
- 12:18same file our sake knows that and it
- 12:21went ahead and copied that file over to
- 12:24the other end
- 12:26now there's one option of our sync I
- 12:28want to basically direct your attention
- 12:30to if I go to the man page for it
- 12:33probably have to make this a little bit
- 12:35smaller let's look up the - II option
- 12:41the - II option here allows you to
- 12:45specify the remote shell to use which is
- 12:48basically meaning that you can specify
- 12:51SSH
- 12:53but we didn't do that so how did that
- 12:56copy over well actually our sink
- 12:59defaults to SSH we didn't tell it to use
- 13:02SSH it's actually using SSH for the file
- 13:06transfer itself by default so if we
- 13:10didn't have SSH installed on the other
- 13:12end yes as a server this command would
- 13:15not have worked now I'm going to show
- 13:17you another variation here of the our
- 13:20sink command on the other end I'm going
- 13:23to delete this folder in its entirety
- 13:27and then switch back here to to the
- 13:31local terminal so I'll recall the
- 13:33original command here our sink - avz
- 13:37that's a folder name and again that's
- 13:39the IP address I'm copying it - but what
- 13:42I'm going to do is add another option -
- 13:44- remove source files I'm going to add
- 13:48that to the command and again I deleted
- 13:52it from here so it's not present anymore
- 13:56and then what I'm going to do is copy
- 13:59that over again password and again it's
- 14:04going to copy the files over same as
- 14:06before
- 14:12all right so what happened well let's go
- 14:16ahead and go over here and you know the
- 14:19file or the folder was created with all
- 14:21the files inside but here on the
- 14:24original source I'll do LS and I have
- 14:27NES there but there's nothing inside
- 14:32I used remove source files so that's
- 14:36useful if you want to move the files
- 14:38from point A to point B this can be
- 14:41potentially destructive though so you
- 14:44want to basically be careful and then
- 14:47there's one more option I want to show
- 14:48you guys so what I'm gonna do is copy
- 14:51that NES directory back to its original
- 14:53location see the NES directories back
- 15:00and now I'm going to use the same
- 15:05command again
- 15:06remove source files and let's go ahead
- 15:07and for fun we're going to remove it
- 15:10from here and I'm gonna add yet another
- 15:18option here I'm gonna do - - dry - run
- 15:22so it's the same command but I added
- 15:24that one option and if nothing else I
- 15:27definitely want you guys to remember
- 15:29this dry run option it's extremely
- 15:32important and I'll tell you why in a
- 15:33minute but I'll go ahead and enter the
- 15:35command let's run it
- 15:38alright so Wow that was super fast
- 15:42wasn't it that was almost instantaneous
- 15:44that it copied all those files over so
- 15:47what happened nothing nothing happened
- 15:50because there's nothing here so if I do
- 15:54LS against the NES directory those files
- 15:57are still present and again the command
- 16:00I used was this one now dry run as you
- 16:04probably already assumed is just a test
- 16:09it doesn't actually run but it does give
- 16:13you output on what it would do if it
- 16:16were to run now it did ask for the
- 16:18password of the remote end because it
- 16:20does need to check what the remote end
- 16:22has and that way it'll know what
- 16:26it's going to do it gives me the output
- 16:27of all the files that it would copy but
- 16:29it's a dry run it's not actually going
- 16:32to do anything and the reason why a dry
- 16:34run is so important is because it gives
- 16:37you a preview of what our sink is going
- 16:39to do so any our sink command which may
- 16:42overwrite or remove files from either
- 16:44end I highly recommend you try that with
- 16:47a dry run first before you actually do
- 16:51it and again this - - dry - run this
- 16:55option right here to do a dry run
- 16:57extremely important so now that I know
- 17:00that that works or at least the output
- 17:03is what I expected I can remove the dry
- 17:04run and let's do it for real now it's
- 17:09actually doing it
- 17:13files are removed from the source and
- 17:18they're present here on the target so
- 17:21the file or excuse me the folder is
- 17:23still here it's just empty so I could do
- 17:25touch any ass test file I could do our
- 17:31sink let's do a dry run again press
- 17:37Enter so it connected to the to the
- 17:44remote end here and it basically knows
- 17:46test file was missing from the target
- 17:49and the dry run is telling me that if I
- 17:51was to run this for real then it's going
- 17:54to move this file over since I use
- 17:56remove source file then that file is
- 17:58going to be gone so now that I know that
- 17:59it's doing what I expect I could remove
- 18:02dry run press enter it copied it over it
- 18:12basically removed it from the local end
- 18:18and we can see that the test file is
- 18:21indeed there now the rsync command gets
- 18:25way more involved in this this is just
- 18:28the beginning our sink is a very very
- 18:31valuable tool and there's all kinds of
- 18:33cool stuff that you can do with it so I
- 18:35recommend that you check out some
- 18:37additional examples on the usage of
- 18:39arson
- 18:39because I do recommend that you learn it
- 18:42it's a very important tool for every
- 18:44Linux administrator to know and with
- 18:47that said that you know here comes the
- 18:49end of the Linux commands for beginner
- 18:51series now of course I'll be doing more
- 18:54tutorials so it's not the end of my
- 18:56tutorials it's just the end of this
- 18:57particular series but I'll show you guys
- 18:59other commands and other tricks and all
- 19:02kinds of things in future tutorial
- 19:04videos either in another series or maybe
- 19:07even in some standalone videos so if you
- 19:10haven't already done so please subscribe
- 19:11and the next tutorials I make you'll be
- 19:14the first to see them thank you guys so
- 19:16much for watching these videos I hope
- 19:18this series was very helpful for you and
- 19:20I will see you in the next video
- 19:22whatever that might be thanks for
- 19:25checking out my video I really
- 19:27appreciate it if you found it useful
- 19:28click that like button and if you
- 19:31haven't already done so make sure you
- 19:33subscribe so you'll see the latest
- 19:34content as soon as it becomes available
- 19:36if you want to help me out there's links
- 19:39down below for my patreon page as well
- 19:42as links for purchasing my Linux ebooks
- 19:44and also my affiliate store which has a
- 19:47listing of linux compatible hardware
- 19:49that i've actually tested personally
- 19:51thanks again for watching and I'll see
- 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.