FTP (File Transfer Protocol) is a general network protocol used to switch files to and from a far flung network.
In this academic, we will show you a way to use the linux ftp command via sensible examples.
In maximum cases, you'll use a desktop FTP customer to hook up with the far flung server and download or add files. However, the ftp command is useful when you paintings on a server without GUI and you want to switch files over FTP to or from a faraway server.
Before you Begin
When shifting information over ftp the relationship isn't encrypted. For a secure information switch, use SCP.
To be able to transfer documents you must have as a minimum study permissions on the source document and write permission at the goal system.
When moving massive documents it is encouraged to run the ftp command interior a display or tmux consultation.
The directory from in which you run the ftp command is the neighborhood working listing.
Establishing an FTP connection
To open an ftp connection to a far off device use the ftp command observed through the remote server IP cope with or area call:
ftp 192.168.42.Seventy seven
Copy
If the relationship is installed, a affirmation message might be displayed and you'll be brought about to enter your FTP username, in this case the FTP username is linuxize:
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are person no 1 of 50 allowed.
220-Local time is now 21:35. Server port: 21.
220-This is a private device - No anonymous login
220-IPv6 connections are also welcome in this server.
220 You could be disconnected after 15 mins of state of being inactive.
Name (192.168.42.77:localuser): linuxize
Copy
You may additionally see a special affirmation message depending on the FTP provider walking on the faraway server.
Once you enter the username you may be brought on to type your password:
Password:
Copy
If the password is correct, the far off server will show a confirmation message and the ftp> activate.
230 OK. Current confined listing is /
Remote machine kind is UNIX.
Using binary mode to switch files.
Ftp>
Copy
If the FTP server you are having access to accepts nameless ftp debts, and you need to login as an nameless user, use nameless as username and your electronic mail cope with as a password.
Common FTP Commands
Many FTP instructions are comparable or same to the instructions you would kind in Linux shell activate.
Below are some of the maximum not unusual FTP commands
assist or ? - listing all available FTP instructions.
Cd - trade listing on the far flung system.
Lcd - trade listing at the nearby gadget.
Ls - list the names of the files and directories in the modern-day remote directory.
Mkdir - create a new listing inside the cutting-edge remote directory.
Pwd - print the contemporary working listing at the remote system.
Delete - take away a document within the cutting-edge far off listing.
Rmdir- eliminate a directory inside the cutting-edge faraway directory.
Get - replica one file from the far off to the neighborhood system.
Mget - replica a couple of document from the remote to the nearby device.
Placed - replica one document from the local to the faraway machine.
Mput - replica one file from the local to the far flung system.
Downloading Files with the FTP Command
Once you're logged in, your present day running directory is the far off user home directory.
When downloading documents with the ftp command, the documents could be downloaded to the directory from which you typed the ftp command.
If you want to download the files to any other neighborhood listing, transfer to it through the usage of the liquid crystal display command.
Let’s say we need to download the files to the ~/ftp_downloads listing:
liquid crystal display ~/ftp_downloads
Copy
To down load a single document from the remote server, use the get command. For instance to download a record named backup.Zip use the subsequent command:
get backup.Zip
Copy
The output need to appearance something like this:
200 PORT command a hit
one hundred fifty-Connecting to port 60609
150 6516.Nine kbytes to download
226-File successfully transferred
226 2.356 seconds (measured right here), 2.70 Mbytes according to 2d
6673256 bytes acquired in 2.55 seconds (2.49 Mbytes/s)
Copy
To download more than one documents right away, use the mget command. You can provide a list of individual record names or use wildcard characters.
Mget backup1.Zip backup2.Zip
Copy
When downloading a couple of files you may be brought about for confirmation for every document.
Mget backup1.Zip? Y
2 hundred PORT command a success
one hundred fifty Connecting to port 52231
226-File effectively transferred
226 zero.000 seconds (measured right here), 31.51 Kbytes per 2nd
14 bytes acquired in zero.00058 seconds (23.6 kbytes/s)
mget backup2.Zip? Y
two hundred PORT command a hit
150-Connecting to port 59179
one hundred fifty 7.2 kbytes to down load
226-File efficiently transferred
226 zero.000 seconds (measured right here), 16.68 Mbytes per second
7415 bytes acquired in zero.011 seconds (661 kbytes/s)
Copy
Once you're accomplished downloading files from your far flung FTP server close the reference to bye or end.
Stop
Copy
221-Goodbye. You uploaded zero and downloaded 6544 kbytes.
221 Logout.
Copy
Uploading Files with the FTP Command
To upload a file from a local directory to a far off FTP server use the positioned command:
positioned photo.Jpg
Copy
The output need to look some thing like this:
200 PORT command a hit
one hundred fifty Connecting to port 34583
226-File correctly transferred
226 zero.849 seconds (measured right here), 111.Forty eight Kbytes consistent with 2d
96936 bytes despatched in 0.421 seconds (225 kbytes/s)
Copy
If you want upload a file that is not to your modern-day running directory use the absolute course to the file.
To upload multiple files from a local directory to a far off FTP server use the mput command:
mput image1.Jpg image2.Jpg
Copy
mput image1.Jpg? Y
two hundred PORT command successful
one hundred fifty Connecting to port 41075
226-File effectively transferred
226 1.439 seconds (measured here), 102.89 Kbytes per 2nd
151586 bytes despatched in 1.07 seconds (138 kbytes/s)
mput image2.Jpg? Y
2 hundred PORT command a hit
a hundred and fifty Connecting to port 40759
226-File correctly transferred
226 1.727 seconds (measured here), 111.75 Kbytes according to second
197565 bytes sent in 1.39 seconds (138 kbytes/s)
Copy
When importing more than one files you will be brought on for affirmation for every record you need to upload.
Once you're completed uploading files in your faraway FTP server close the reference to bye or quit.
0 Comments
Post a Comment