[1] Install FTP Client.
[root@localhost ~]# dnf install lftp -y
[2] The connection with root account is prohibited by default, so access with a common user to FTP Server.
# lftp [option] [hostname]
[root@localhost ~]# lftp -u future futurelinux.org
Password: # password of the user
lftp [email protected]:~>
# show current directory on FTP server
lftp [email protected]:~> pwd
ftp://[email protected]
# show current directory on local server
lftp [email protected]:~> !pwd
/root
# show files in current directory on FTP server
lftp [email protected]:~> ls
drwxr-xr-x 2 1000 1000 23 May 9 01:33 public_html
-rw-r--r-- 1 1000 1000 399 May 9 16:32 test.py
# show files in current directory on local server
lftp [email protected]:~> !ls -l
total 12
-rw-rw-r-- 1 root root 10 May 9 14:30 new.txt
-rw-rw-r-- 1 root root 10 May 9 14:59 test2.txt
-rw-rw-r-- 1 root root 10 May 9 14:59 test.txt
# change directory
lftp [email protected]:~> cd public_html
lftp [email protected]:~/public_html> pwd
ftp://[email protected]/%2Fhome/future/public_html
# upload a file to FTP server
# "-a" means ascii mode ( default is binary mode )
lftp [email protected]:~> put -a new.txt
22 bytes transferred
Total 2 files transferred
lftp [email protected]:~> ls
drwxr-xr-x 2 1000 1000 23 May 9 01:33 public_html
-rw-r--r-- 1 1000 1000 10 May 9 17:01 new.txt
-rw-r--r-- 1 1000 1000 399 May 9 16:32 test.py
-rw-r--r-- 1 1000 1000 10 May 9 17:01 test.txt
# upload some files to FTP server
lftp [email protected]:~> mput -a test.txt test2.txt
22 bytes transferred
Total 2 files transferred
lftp [email protected]:~> ls
drwxr-xr-x 2 1000 1000 23 May 9 01:33 public_html
-rw-r--r-- 1 1000 1000 399 May 9 16:32 test.py
-rw-r--r-- 1 1000 1000 10 May 9 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 May 9 17:06 test2.txt
# download a remote file to local filesystem
# "-a" means ascii mode ( default is binary mode )
lftp [email protected]:~> get -a test.py
416 bytes transferred
# download some remote files to local filesystem
lftp [email protected]:~> mget -a test.txt test2.txt
20 bytes transferred
Total 2 files transferred
# create a directory on remote current directory
lftp [email protected]:~> mkdir testdir
mkdir ok, `testdir' created
lftp [email protected]:~> ls
drwxr-xr-x 2 1000 1000 23 May 9 01:33 public_html
-rw-r--r-- 1 1000 1000 399 May 9 16:32 test.py
-rw-r--r-- 1 1000 1000 10 May 9 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 May 9 17:06 test2.txt
drwxr-xr-x 2 1000 1000 6 May 9 17:16 testdir
226 Directory send OK.
# remove a directory on remote current directory
lftp [email protected]:~> rmdir testdir
rmdir ok, `testdir' removed
lftp [email protected]:~> ls
drwxr-xr-x 2 1000 1000 23 May 9 01:33 public_html
-rw-r--r-- 1 1000 1000 399 May 9 16:32 test.py
-rw-r--r-- 1 1000 1000 10 May 9 17:06 test.txt
-rw-r--r-- 1 1000 1000 10 May 9 17:06 test2.txt
# remove a remote file
lftp [email protected]:~> rm test2.txt
rm ok, `test2.txt' removed
lftp [email protected]:~> ls
drwxr-xr-x 2 1000 1000 23 May 9 01:33 public_html
-rw-r--r-- 1 1000 1000 399 May 9 16:32 test.py
-rw-r--r-- 1 1000 1000 10 May 9 17:06 test.txt
# remove some remote files
lftp [email protected]:~> mrm redhat.txt test.txt
rm ok, 2 files removed
lftp [email protected]:~> ls
drwxr-xr-x 2 1000 1000 23 May 9 01:33 public_html
# execute commands with ![command]
lftp [email protected]:~> !cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
...
...
future:x:1001:1001::/home/future:/bin/bash
# exit
lftp [email protected]:~> quit
221 Goodbye.