How To Linux How to Use the FTP Command in Linux Examples of the FTP Linux command Share Pin Email Print Gary Houlder/Taxi/Getty Images Linux Commands Basics Guides & Tutorials Installing & Upgrading Tips & Tricks Key Concepts by Juergen Haas A software developer, data scientist, and a fan of the Linux operating system. Updated January 29, 2019 29 29 people found this article helpful FTP is the simplest and most familiar file transfer protocol that exchanges files between a local and remote computer. Linux and Unix operating systems have built-in command line prompts you can use as FTP clients for making an FTP connection. An FTP transmission is not encrypted. Anyone who intercepts the transmission can read the data you send, including your username and password. Use SFTP for a secure transmission. FTP Commands and Switches A list of FTP commands is useful because what will work for you depends on your system and software. List of Linux FTP Commands Command Explanation ! Start an interactive shell. If there are arguments, the first is taken to be a command to execute directly, with the rest as its arguments. $ Execute macro. account Supply a password required by the server for access to resources. If no argument is included, the user will be prompted for an account password. append Append a local file to a file on the remote machine. ascii Set the file transfer type to network ASCII. This is the default type. bell Have a bell be sounded after each file transfer command is completed. binary Set the file transfer type to support binary image transfer. bye Terminate the FTP session with the remote server and exit ftp. The same as quit. case Toggle remote computer file name case mapping during mgetcommands. When case is on (default is off), remote computer file names with all letters in uppercase are written in the local directorywith the letters mapped to lowercase. cd Change the working directory. cdup Change the working directory to the parent of the current working directory. chmod Change file permissions of the remote file. close Terminate the FTP session. The same as disconnect. cr Toggle carriage return stripping during ASCII type file retrieval. delete Delete the file. debug Toggle debugging mode. dir Display a listing of the directory contents. disconnect Terminante the FTP session. The same as close. exit Terminate FTP session and exit. form Set the file transfer format. get Retrieve the file and store it on the local machine. glob Toggle meta character expansion of local file names. hash Toggle # printing for each data block that's transferred. help Display a message about the meaning of a command. If no argument is given, FTP displays a list of all the known commands. The same as ?. idle Set the inactivity timer on the server (in seconds). If seconds is not included, the current inactivity timer is displayed. image Set the binary transfer type. ipany Allow the address resolver to return any address family. ipv4 Restrict the address resolver to look only for IPv4 addresses. ipv6 Restrict host addressing to IPv6 only. lcd Change the working directory on the local machine. If no directory is specified, the user's home directory is used. ls List the contents of the remote directory. macdef Define a macro. mdelete Delete multiple files. mdir List the contents of multiple remote directories. mget Get multiple files from the server. mkdir Make a new directory on the server. mls List the contents of multiple remote directories. mode Set the file transfer mode. modtime Show the last modification time of a file on the server. mput Send multiple files to the server. newer Get the file if it's newer than the local file. nlist Print a list of the files in a directory on the remote machine. nmap Set templates for default file name mapping. ntrans Set translation table for default file name mapping. open Connect to a remote server. prompt Force interactive prompting on multiple commands. passive Enter into passive transfer mode. proxy Execute an FTP command on a secondary control connection. qc Print ? in place of control characters on stdout. sendport Toggle the use of PORT commands. put Store a local file on the remote machine. pwd Display the name of the current working directory on the remote machine. quit Terminate the FTP session with the remote server and exit ftp. The same as bye. quote The arguments specified are sent, verbatim, to the remote FTP server. recv Receive the remote file and store it on the local machine. The same as get. reget The same as get, except that if the local file exists and is smaller than the one on the server, the local one is presumed to be a partially transferred copy of the remote one and the transfer is continued from the apparent point of failure. If the local file doesn't exist, FTP won't get the remote one. This command is useful when transferring very large files over networks that are prone to dropping connections. rstatus Shows the status of the remote machine. If a filename is specified, it shows the status of the remote file. rhelp Get help from the server. rename Rename the remote file. reset Clear the reply queue. restart Restart the file transfer at bytecount. rmdir Remove the directory on the server. runique Toggle the storing of files on the local system with unique file names. send Store a local file on the remote machine. The same as put. site The arguments specified are sent, verbatim, to the remote FTP server as a SITE command. size Find the size of the file on the server. status Show the current status of FTP. struct Set the file transfer structure to <struct-name> (stream is default). system Show the operating system running on the remote machine. sunique Toggle the storing of files on the remote machine under unique file names. The server must support the FTP protocol STOU command. Default value is off. tenex Set the tenex file transfer type. tick Toggle the printing of the byte counter during transfers. trace Toggle packet tracing. type Set the file transfer type (defalt is network ASCII). If no type is specified, the current type is displayed. user Identify yourself to the FTP server. If the password is not specified and the server requires it, FTP will prompt the user for it unmask Set the default umask on the remote server to newmask. If newmask is omitted, the current umask is displayed. verbose Toggle verbose mode (on by default). This mode displays all responses from the FTP server. If enabled, when a file transfer completes, statistics regarding the efficiency of the transfer are reported. ? Prints a message about the meaning of a command. The same as help. The FTP commands used in Linux and Unix differ from the FTP commands used with the Windows command line. Options (also called flags or switches) modify the operation of an FTP command. Usually, a command line option follows the main FTP command after a space. Below is a list of options you can append to FTP commands and a description of what they do. List of Linux FTP Command Options Option Explanation -4 Use only IPv4 when contacting a host -6 Use only IPv6 -e Disables history support and command editing -p Use passive mode for data transfers -i Turns off interactive prompted during file transfers -n Prevents auto-login on first connection -g Disables file name globbing -v Forces the remove server to show all responses -d Engages debugging FTP Command Examples in Linux Below are examples that illustrate typical uses of Linux FTP commands. ftp Executing ftp without any options simply prepares the terminal window for FTP commands. Once entered, you can omit "ftp" from the commands. ftp abc.xyz.edu Before you can use the various FTP commands, you must establish a connection with the remote network, which is what this example shows. This FPT command attempts to connect to the server at abc.xyz.edu. If it succeeds, it asks for the username and password. ftp 192.168.0.1 As you can see above, you can replace the domain name with the server's IP address for the same effect. ls In this next simple FTP command example, we're using the ls command to list what's in the folder on the server. This command doesn't have the "ftp" part at the beginning because it's assumed that you're already connected to the server. cd movies The cd command changes the working directory. In this case, we're moving into the movies folder so that we can execute commands there instead of in the previous folder. get vacation.mp4 To continue with the previous example, this FTP command uses get to download the vacation.mp4 file from the movies folder. cd birthdaysmput *.mp4 For our last FTP command example, we'll change the remote working directory to /movies/birthdays/ and then upload a bunch of MP4s. This example assumes we're already in the /movies/ folder. Continue Reading How to Use The chmod Linux Command Need to Transfer Files From Terminal in Linux? Use These Commands Understanding the 'traceroute' Command Used in Linux Unix Command: lftp Get a List of Your Files and Folders Using the Ls Command A Quick Guide to Using Linux mount Commands How to Use the 'Install' Linux Command Here's How to Use the Linux "sleep" Command to Pause a BASH Script Understanding the Linux/Unix Command: find Learning About the Linux Command - Unix Command: login What's Linux SSH For? How Do I Change From One Directory To Another Using Linux How to Create Directories in Linux With The 'mkdir' Command 10 Essential Linux Commands For Navigating Your File System 12 Essential Linux Commands for Newbies What Is the Linux Shred Command and When Should I Use It?