Transferring and Copying Files Over the Network
Start course
2h 10m

As the title suggests, this course looks at intermediate-level skills for those who already know a bit about Linux but want to enhance that knowledge. In this course, we build upon some of the topics covered in our Linux Fundamentals course, including files and shell scripting, but also introduce new concepts such as wildcards, job control, switching users, and installing software. 

This course is part of the Linux Administration Bootcamp learning path, designed to get you up and running with Linux.

Learning Objectives

  • Learn what wildcards are and how and when to use them
  • Understand input, output, and redirection
  • Work with files and shell scripting
  • Implement processes and job control, and switch between users
  • Install software using RPM- and Debian-based systems

Intended Audience

  • Anyone with basic knowledge of Linux who wants to learn more
  • Professionals who want to learn more about Linux to enhance their career prospects


This is an intermediate-level course so some knowledge of Linux is expected. If you're just starting out, then try our Linux Fundamentals course first.


In this lesson will be covering how to copy files over the network. You already know how to copy files from one location to another on the same system using the CP command. But if you want to copy files from your local workstation to a Linux server or between Linux servers, you need to use SCP or SFTP. SCP is Secure Copy and SFTP is SSH File Transfer Protocol. Sometimes SFTP is referred to as Secure File Transfer Protocol. 

SCP and SFTP are both extensions of the secure shell protocol. In order to use SCP or SFTP you need a client. Mac and Linux come with SCP and SFTP command line utilities. If you are running windows you can use the PuTTY Secure Copy client pscp.exe and the PuTTY Secure File Transfer client psftp.exe. There are graphical clients as well.

Cyberduck is popular for Mac and Windows. FileZilla runs on Mac, Windows and Linux. WinSCP is a Windows only SCP and SFTP client. If you are looking for a more interactive experience where you can examine the local files and remote files use SFTP. With SCP, you need to know what files you want to transfer before issuing the command. SCP and SFTP aren't the only ways to transfer files to remote systems.

Sometimes FTP called File Transfer Protocol is enabled. In such cases, you can use the built-in FTP command line client on Linux and Mac or a graphical client, like WinSCP for Windows. Just be aware that FTP is not a secure transfer protocol like SCP and SFTP. This means that your log in credentials are sent in plain text over the network. Also, the files that you upload and download are not encrypted either. If given the choice between SCP, SFTP or FTP? Pick SCP or SFTP. Let's use our SFTP client to connect to this Linux server.

When you connect to the remote server you're placed into your home directory. And LS will show the files that are in my home directory. If you proceed those commands with an L that's for local. So LPWD says that I'm in the Local Temp Test Directory and LS will show what files are on the local box and temp test. So let's put z.txt onto the server and we'll do an LS and we can see that z.txt shows up on remote server.

Let's deleted off the remote server and let's do an LS with a dash L for a long listing and see if it's gone. And it is, so we'll click our SFTP client. With SCP you can copy from your local system to the remote system, but you need to know the source and destination.

So, our source file will be z.txt our destination will be linuxsvr1: at the end of the server name, followed by a path name. We could put this file and the temp directory on the remote server. Oops I misspelled that. We could put this file and say our home directory. Tilda is a shortcut for home. And let's connect to the Linux server and show that, we did places z text there and also in temp.

Let's transfer this file to the remote server as a different user. Let's use adminuser@linuxsvr and we'll place this in the admin users home directory. We can use Tilda as a shortcut for home or we can even specify the full path, let's just do that. And let's connect, it's the same with SFTP let's connect to a sftpadminuser@linuxsvr. And then you could see that z.txt was transferred.

Let's look at using a graphical client like FileZilla. To connect via SFTP type sftp:: and then the IP address or server name and give your username and password and click quick connect. If you get prompted about an SSH key go ahead and accept it, and this is a one time thing. On the left side you see our local files on our workstation and on the right side are the remote files on the Linux server. We'll just pick a file to transfer up to our Linux server.

Let's put it in our desktop folder and you can drag and drop a file from local to remote and also from remote to local. And you can also do a transfer by double-clicking the file as well. Let's log into our Linux server and see if those files got transferred like we expected. And we can see, that the file is on the desktop double-click to open. Yup, it made it. Let's look at our documents folder and we can see the file is there as well. To transfer files over the network you need a client. There are command line clients like SCP, SFTP and FTP. You can also use a graphical client such as Cyberduck, FileZilla, or WinSCP. If you have a choice to use FTP or SFTP, choose SFTP.

About the Author
Learning Paths

Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.

Covered Topics