close
  • 首先安裝lftp

[root@dlp ~]# yum -y install lftp

 

  • 使用指令進行登入

[redhat@dlp ~]$ lftp -u cent www.server.world

Password:# password of the user

lftp cent@www.server.world:~>

 

  • 看伺服器器上的檔案

lftp cent@www.server.world:~> ls

 

  • 改變目前目錄

lftp cent@www.server.world:~> cd public_html

 

  • 上傳檔案至ftp

lftp cent@www.server.world:~> mput -a test.txt test2.txt

 

22 bytes transferred

Total 2 files transferred

lftp cent@www.server.world:~> ls

 

drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html

-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py

-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt

-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test2.txt

 

 

  • 下載檔案

# download a file from FTP server

 

# "-a" means ascii mode ( default is binary mode )

 

lftp cent@www.server.world:~> get -a test.py

 

416 bytes transferred

 

  • 建立資料夾

 # create a directory in current directory on FTP Server

 

lftp cent@www.server.world:~> mkdir testdir

 

mkdir ok, `testdir' created

lftp cent@www.server.world:~> ls

 

drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html

-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py

-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt

-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test2.txt

drwxr-xr-x    2 1000     1000            6 Jul 20 17:16 testdir

226 Directory send OK.

 

  • 刪除資料夾

 # delete a direcroty in current directory on FTP Server

 

lftp cent@www.server.world:~> rmdir testdir

 

rmdir ok, `testdir' removed

lftp cent@www.server.world:~> ls

 

drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html

-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py

-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt

-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test2.txt

 

 

  • 刪除單一檔案

 # delete a file in current directory on FTP Server

 

lftp cent@www.server.world:~> rm test2.txt

 

rm ok, `test2.txt' removed

lftp cent@www.server.world:~> ls

 

drwxr-xr-x    2 1000     1000           23 Jul 19 01:33 public_html

-rw-r--r--    1 1000     1000          399 Jul 20 16:32 test.py

-rw-r--r--    1 1000     1000           10 Jul 20 17:06 test.txt

 

arrow
arrow
    文章標籤
    Centos Linux FTP
    全站熱搜

    cs60811 發表在 痞客邦 留言(0) 人氣()