hey guys in this video I'm going to show you how you can use SCP command to copy your files or directories from your local machine to a remote server or from your remote server to your local machine how to use SCP for you know transferring files I'm going to show you so let's say I have a remote server on the right-hand side I have a virtual machine I'm going to treat it as a remote server so this on the right hand side is my remote server and on the left hand side this one is my local machine let's say and I want to transfer the file from my local machine to a remote server first of all and then I will show you the vice-versa so first of all let's see what are the options we have with the SCP command by the way as CP stands for secure copy and if you know CP command it's similar to that so just write SCP on your client and then press Enter which is going to show you all the options which you can use with the SCP so to use SCP you need to give the username and the host IP and then your file name for example so let's say I have a file called hello dot Sh on my desktop folder so I'm going to just CD to my desktop first of all and then I will transfer this hello dot Sh to the server to the home directory so this is my home directory and let me just do LS here which will list out all the files and directories in my remote server or in the home folder right so let's copy this hello dot Sh to the remote server so we will use a CP command and the IP of this remote server so to know the IP of the remote server you just say if config and then press enter and this is the IP address of the remote server right and then we also need the user so username in my case is code bind it can be different in your case right so first of all your file name so just give the file name in my case its hello dot Sh and then the host name which is code bind in my case it can be different in your case so this is the username right and then at the rate the IP address and then the IP address which is this one so I'm going to just write 192.168.255.255 so in in whatever folder you want to transfer your files you just need to give the path of that so for example I want to just transfer my files to the home directory which is home forward slash code bind I will just write that here so I'm going to just paste it here so forward slash home forward slash code binder okay and then press Enter and for the first time it will ask you are you sure you want to continue connecting you can just say yes for the first time and then press ENTER and then it's going to need your remote servers password so the password you use to log into this remote server you need to give it here so I'm going to give the same password here and then this file is transferred and you can see this file is now appearing here also hello dot SH and then when I do LS here I can see this file once again here earlier this file was not present here okay so this is how you can transfer a file from your host PC to a remote server now let's say you have multiple files so you have some directory and then you want to transfer the content of that directory so let me just go to my home directory so I will just do CD and let me just clear the terminal and let's say I want to create a directory so I will just create a directory called test here or test123 here and then I will just CD into that directory CD test one two three and create some files so I will just use a touch command to create these files I'm not going to fill any content in these files but just the file name so for example file one dot txt and then file - dot txt and then file 3 dot dot txt any number of file you can create and then I will do LS to list out all the files right so these are all the files and I want to transfer these files with the directory to my remote server how can I do it so let me just go to my home folder once again and let me do LS so let's say I want to just transfer this directory okay so I will use the SCP command and then - R for recursive copying and once again the username so let me just use the same command which I used previously so SCP and then and then - our flag to copy your files or directory recursively and then your directory name so for example to my directory name is test 1 2 3 I want to transfer all the files in that directory so just give the name of your directory here ok and let's say I want to transfer this directory once again to my home folder of my remote server so username and then IP address and then the location where you want to transfer your directory ok so I will just press enter once again and give my password for my remote server once again and you can see this directory is copied to my remote server and inside this directory I have all these three files this I can verify from my command line also so test 1 2 3 LS and all these files are present here also now let's say I want to transfer or copy files from my remote server to my host server till now what we were doing is we were copying the files from our local machine to the remote server let's say I want to do the reverse of that so I want to copy them the files from the remote server to my home file so how can I do it so for doing this let's say what I want to transfer let's say I want to transfer this dot de B file right from my remote server to my local machine so let me just clear the terminal and let's see how we can do it so once again you use the SCP command and this time you use the username first of all of your remote server so code bind is the username and then the IP address of your remote server so once again I will see the IP address 192.168.1.1 right and then the semicolon and then the folder name from where you want to copy your file so home forward slash code bind this is the folder from where I want to copy my file and the file name itself so I want to copy this file right so just just write the file name here itself and then wherever you want to copy so for example I want to copy this dot de file from the remote server to my desktop so how can I do it so after the space I'm going to give the destination folder where I want to copy it so let's say home folder and then I want to copy it on my desktop so I will just give the destination folder name and then press Enter and then gave the password of my remote PC and then press ENTER and then it's going to start copying this file to my local machine you can see this is already present so it's giving us the percentage which is transferred now let's say on your remote server OpenSSH is running on some different port then the default port which is port 22 so let's say it's running on port 1 2 3 4 then how you can you know use that port so you can just give SCP command once again to get the help and you can see with capital P flag you can give the port name right so last command we have given here you could have given if the port is different you could have given capital P and then port 1 2 3 4 for example if this open sss server on the server side on the remote server side runs on different port okay so port you can give something like this if this server has some you know private key and you want to connect it using your public key then you can use - a flag and the path to your public key here and then you will be able to connect it ok so if you want to connect it using your public key you can give - I flag and then forward slash your keys path so this is how you can use SCP command in your Linux operating system I hope you've enjoyed this video please rate comment and subscribe and bye for now
Video Description: Scp command - SCP to Securely Transfer Files/Folders in Linux for Software Development 2023 is part of Complete Linux Course: Become a Linux Professional preparation.
The notes and questions for Scp command - SCP to Securely Transfer Files/Folders in Linux have been prepared according to the Software Development exam syllabus.
Information about Scp command - SCP to Securely Transfer Files/Folders in Linux covers all important topics for Software Development 2023 Exam.
Find important definitions, questions, notes, meanings, examples, exercises and tests below for Scp command - SCP to Securely Transfer Files/Folders in Linux.
Video Lecture & Questions for Scp command - SCP to Securely Transfer Files/Folders in Linux Video Lecture | Study Complete Linux Course: Become a Linux Professional - Software Development | Best Video for Software Development - Software Development full syllabus preparation | Free video for Software Development exam to prepare for Complete Linux Course: Become a Linux Professional.
Information about Scp command - SCP to Securely Transfer Files/Folders in Linux
Here you can find the meaning of Scp command - SCP to Securely Transfer Files/Folders in Linux defined & explained in the simplest way possible.
Besides explaining types of Scp command - SCP to Securely Transfer Files/Folders in Linux theory, EduRev gives you an ample number of questions to practice Scp command - SCP to Securely Transfer Files/Folders in Linux tests,
examples and also practice Software Development tests.