Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux ncftp command

Linux ncftp command

Linux Command Reference Linux Command Reference

The Linux ncftp command is used to transfer files.

FTP lets users download files stored on a server host and also upload files to a remote host.

Compared with traditional ftp command,ncftp It provides more features and a better user experience, supporting advanced functions such as resumable transfers, automatic reconnection, bookmarks, and recursive directory downloads, making it ideal for users who need to use FTP frequently.

Installation

In most Linux distributions,ncftp It can be easily installed through a package manager.

The following are installation commands for several common distributions:

Debian/Ubuntu:



sudo apt-get install ncftp

CentOS/RHEL:



sudo yum install ncftp

Fedora:



sudo dnf install ncftp

Arch Linux:

sudo pacman -S ncftp

After installation, you can check whether it was installed successfully with the following command:

ncftp --version

Syntax

ncftp [主机或IP地址]

Parameter Description:


Example

1. Connect to an FTP server

To connect to an FTP server, you can use the following command:



ncftp ftp.example.com

where ftp.example.com is the address of the FTP server you want to connect to. After a successful connection, the system will prompt you to enter your user name and password.

2. Anonymous login

If the FTP server you want to connect to supports anonymous login, you can directly use the following command:



ncftp -u anonymous ftp.example.com

You will be prompted for a password; usually you can enter your email address as the password.

3. Download files

To download a file, you can use the get command. For example, to download a file named file.txt :



get file.txt

the file will be downloaded to the current working directory.

4. Upload files

To upload a file, you can use the put command. For example, to upload a file named file.txt :



put file.txt

the file will be uploaded to the current directory of the FTP server.

5. Recursively download directories

ncftp It supports recursively downloading an entire directory and all files in its subdirectories. Use get -R Command:



get -R directory_name

This will download directory_name the directory and all its subdirectories and files.

6. Resumable transfers

ncftp It supports resumable transfers. If the connection is interrupted during a download, you can use the get -C command to continue the download:



get -C file.txt

This will resume downloading the file from where it was last interrupted.

7. Exit ncftp

To exit ncftpinstalled, you can use quit or exit Command:



quit

or:



exit


Advanced features

1. Bookmark feature

ncftp It provides a bookmark feature that allows you to save connection information for frequently used FTP servers for quick access. To add a bookmark, you can use the following command:



bookmark add mybookmark

where mybookmark is the name of the bookmark. You will be prompted to enter the FTP server address, user name, and password.

To connect using a bookmark, you can use the following command:



ncftp mybookmark

2. Automatic reconnection

ncftp It supports automatic reconnection. If the connection is interrupted,ncftp it will automatically try to reconnect. To enable automatic reconnection, you can use -A Option:



ncftp -A ftp.example.com

3. Batch download

ncftp It supports batch downloading. You can use the get command to download multiple files:



get file1.txt file2.txt file3.txt

Or use wildcards to download matching files:



get *.txt

Linux Command Reference Linux Command Reference