In this article, we describe how to use the FTP command in a Linux shell. This includes how to connect to an FTP server, upload or download files, and create folders. Although there are many good FTP desktop applications Now, there are many applications for command line FTP commands in server, SSH, and remote sessions. Like what. Requires the server to pull the backup from the FTP repository.
650) this.width=650; "src=" http://www.linuxidc.com/upload/2015_12/151216195960471.jpg "width=" 524 "height=" 434 "/ >
Step 1: Establish an FTP connection
To connect to an FTP server, enter and then space on the command to ftp
follow the FTP server's domain name ' domain.com ' or IP address
For example:
ftp domain.com
ftp 192.168.0.1
ftp [email protected].com
Note: The anonymous server is used in this example.
Replace the following example with an IP or domain name for your server address.
650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960473.png "alt=" FTP Login "width=" 706 " Vspace= "5"/>
FTP Login
Step 2: Login with username and password
The vast majority of FTP servers are password protected, so these FTP servers ask for 'username' and 'password'.
If you connect to an FTP server known as an anonymous FTP server (LCTT: That is, you do not need to have real user information to use as an anonymous FTP server), you can try to use the username as anonymous
well as the blank password:
Name: anonymous
Password:
After that, the terminal will return the following information:
230Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
Login successful.
650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960472.png "alt=" FTP Login Successful "width=" 706 " Vspace= "5"/>
FTP Login Successful
Step 3: Directory Operations
FTP commands can list, move, and create folders as if we were using our computer locally. You can ls
print a list of directories, cd
you can change the directory, mkdir
you can create folders.
Listing directories using security settings
ftp>ls
The server will return:
200 PORT command successful.Considerusing PASV.
150Here comes the directory listing.
directory list
....
....
226Directory send OK.
650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960474.png "alt=" Print Catalog "width=" 706 " Vspace= "5"/>
Print Catalog
Change Directory:
Change the directory to enter:
ftp>cd directory
The server will return:
250Directory succesfully changed.
650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960475.png "alt=" ftp Change Directory "width=" 706 " Vspace= "5"/>
Changing Directories in FTP
Step 4: Download files using FTP
Before downloading a file, we first need to use the lcd
command to set the local accept directory location.
lcd /home/user/yourdirectoryname
If you do not specify a download directory, the file will be downloaded to your working directory when you log in to FTP.
Now, we can use command get to download the file, for example:
getfile
The file is saved in the directory location that is set using the LCD command.
Server return message:
local:file remote:file
200 PORT command successful.Considerusing PASV.
150Opening BINARY mode data connection forfile(xxx bytes).
226File send OK.
XXX bytes received in x.xx secs (x.xxx MB/s).
650) this.width=650; "src=" http://www.linuxidc.com/upload/2015_12/151216195960476.png "alt=" Download file using FTP "width=" 706 " Vspace= "5"/>
Download files using FTP
You can use wildcard characters and commands to download multiple files mget
. For example, I'm going to download all the files ending with. xls in the following example.
mget *.xls
Step 5: Upload files using FTP
FTP can also upload files after FTP connection is completed
To put
upload a file using a command:
put file
The absolute path can be used when the file is no longer in the current local directory:
put /path/file
Again, you can upload multiple files:
mput *.xls
Step 6: Close the FTP connection
After completing the FTP work, you need to close the connection for security reasons. There are three commands to close a connection:
bye
exit
quit
Any command can disconnect the FTP server and return:
221Goodbye
650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960477.png "width=" 706 "vspace=" 5 "/>
For more help, you can use the FTP command to get more help after you connect to the server help
.
650) this.width=650; "src=" Http://www.linuxidc.com/upload/2015_12/151216195960478.png "width=" 706 "vspace=" 5 "/>
This article is from "Little public who" blog, please make sure to keep this source http://xiaogongju.blog.51cto.com/12830710/1981507
How CentOS uploads and downloads files using FTP commands at the command line