Software & Apps Linux 33 33 people found this article helpful How to Use the FTP Command in Linux Examples of the FTP Linux command By Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated March 16, 2020 Linux Switching from Windows Tweet Share Email FTP is the simplest and most familiar file transfer protocol that exchanges files between a local and remote computer. Linux and Unix operating systems offer built-in shell programs for FTP clients. 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. 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 a macro. account Supply a password required by the server for access to resources. If no argument is included, the user is 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 Sound a bell after each file transfer command completes. 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 a remote computer file name case mapping during mgetcommands. When case is on (the default is off), remote computer file names with all letters in uppercase are written in the local directory with 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 the 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 the 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 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 a 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 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 (default 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. 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 prompts 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. Executing ftp without any options prepares the terminal window for FTP commands. Once entered, omit ftp from the commands. Type exit to close the FTP session and return to the shell prompt. ftp Before you can use the FTP commands, you must establish a connection with the remote network, which is what this next 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 abc.xyz.edu In this next simple FTP command example, the ls command lists 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 connected to the server. ls The cd command changes the working directory. In this case, to move to the movies folder and execute commands there instead of in the previous folder. cd movies To continue with the previous example, this FTP command uses get to download the vacation.mp4 file from the movies folder. get vacation.mp4 This last FTP command example changes the remote working directory to /movies/birthdays/ and uploads MP4s. This example assumes that the cd command was used to change to the /movies/ folder. cd birthdaysmput *.mp4 More from Lifewire How to Change Directory in Linux sftp - Linux Command - Unix Command Linux/Unix Commands to Know Understanding the Unix and Linux Command: make Linux Commands for Copying Files Between Computers Example Uses of the Linux Command 'unzip' The Linux Command Line: What It Is And How to Use It How to Start Using the Linux Terminal How to Use the chmod Command in Linux How to Use the Linux Command — Unix Command: Login Understanding the Linux/Unix Command 'bash' How to Use 'mkdir' to Create Linux Directories LFTP: Linux Command and Unix Command Linux 'Install' Command 12 Essential Linux Commands for Newbies What Is the rcp Command?