filmov
tv
Securely copy file or directory to a remote host in Linux | Linux Admin to DevOps #Video7
Показать описание
This video will teach you how to copy files to a remote server using the command line in Linux. This lesson will be useful to you when you want to copy a file or a folder from your local computer to a remote server or PC. Not only from local to remote but also you can copy files or directories between the servers that are in remote locations, that is, one remote host to another remote host. So, let’s get started.
Checking the Linux distribution with cat /etc/os-release, we can see it’s a Ubuntu 20.04.5 LTS server.
Before copying files/directories to the server, I want to create a directory here on which the copied file will be stored. Clearing the screen and long listing the contents of the root directory, we can see the new directory is created. Let’s get into the new directory using cd and the directory name and typing pwd and hitting enter, we can see the location of the directory printed on the screen. We will send the files to this location of the remote server from our computer.
My friends, up until now, we have just grabbed the background of the lesson. Now, let’s move on and copy/send the files. For this I open a new terminal, for your information, this is a Windows computer but I can run Linux commands using the GitBash software. And this is my local computer’s terminal. I change the current working directory to Downloads using the cd command and listing the contents, we can see some files and directories. Out of them, I am going to copy the SiteFiles directory to the remote server.
After you hit enter, you will be prompted with the password, type the password and hit enter. Copying the file/folder from the local computer to the remote server begins now. We can see, the files on the directory are being copied to the remote location recursively.
After the copy is complete, to verify the file reached there, go to the remote server’s location and run ls -al command. You will see the directory copied there.
Okay, with that we have learned how to copy a directory to a remote server’s directory. Now, let’s move on and learn how to copy a file such as an archived file to a remote server.
To verify, login to the remote server, go to the destination directory path and run ls -al. We can see the file is copied there.
In the same way, you can copy any type of file or directory from one server to another or from one PC to another PC using the terminal. In the next video, we will learn how to copy a file or a directory from a remote server to the local computer or from the destination host to a source host.
Checking the Linux distribution with cat /etc/os-release, we can see it’s a Ubuntu 20.04.5 LTS server.
Before copying files/directories to the server, I want to create a directory here on which the copied file will be stored. Clearing the screen and long listing the contents of the root directory, we can see the new directory is created. Let’s get into the new directory using cd and the directory name and typing pwd and hitting enter, we can see the location of the directory printed on the screen. We will send the files to this location of the remote server from our computer.
My friends, up until now, we have just grabbed the background of the lesson. Now, let’s move on and copy/send the files. For this I open a new terminal, for your information, this is a Windows computer but I can run Linux commands using the GitBash software. And this is my local computer’s terminal. I change the current working directory to Downloads using the cd command and listing the contents, we can see some files and directories. Out of them, I am going to copy the SiteFiles directory to the remote server.
After you hit enter, you will be prompted with the password, type the password and hit enter. Copying the file/folder from the local computer to the remote server begins now. We can see, the files on the directory are being copied to the remote location recursively.
After the copy is complete, to verify the file reached there, go to the remote server’s location and run ls -al command. You will see the directory copied there.
Okay, with that we have learned how to copy a directory to a remote server’s directory. Now, let’s move on and learn how to copy a file such as an archived file to a remote server.
To verify, login to the remote server, go to the destination directory path and run ls -al. We can see the file is copied there.
In the same way, you can copy any type of file or directory from one server to another or from one PC to another PC using the terminal. In the next video, we will learn how to copy a file or a directory from a remote server to the local computer or from the destination host to a source host.