Catalog / ncftp Cheatsheet
ncftp Cheatsheet
A comprehensive cheat sheet for ncftp, a versatile command-line FTP client with features like background processing, progress meters, and command chaining. This guide covers essential commands, usage examples, and tips for efficient file transfer.
Basic Usage
Connecting to Servers
|
Starts ncftp in interactive mode. |
|
Connects to the specified hostname using anonymous login. |
|
Connects to the specified hostname using the provided username. |
|
Connects using both username and password directly (less secure, use with caution). |
|
Connects to the specified hostname within the ncftp interactive mode. |
|
Connects using a specific username within interactive mode, prompting for a password. |
Basic File Operations
|
Lists files in the current remote directory. |
|
Same as |
|
Prints the current remote directory. |
|
Changes the current remote directory. |
|
Changes the current local directory. |
|
Downloads a file from the remote server. Optionally, save it with a different name locally. |
Transferring Files
|
Downloads a file from the remote server. If |
|
Uploads a file to the remote server. If |
|
Downloads multiple files from the remote server using wildcards. |
|
Uploads multiple files to the remote server using wildcards. |
|
Recursively downloads an entire directory from the server specified by a bookmark. |
|
Recursively uploads an entire directory to the server specified by a bookmark. |
Advanced Features
Background Processing
|
Downloads a file in the background. |
|
Uploads a file in the background. |
|
Adds a bookmark for the current connection. |
|
Connects to a bookmarked site. |
|
Lists background jobs. |
|
Kills a background job. |
Bookmarks
|
Connects to a bookmarked server. |
|
Adds a bookmark for the current connection. |
|
Deletes a bookmark. |
|
Lists all bookmarks. |
|
Opens a connection using the specified bookmark. |
|
Bookmarks the current FTP location. |
Resuming Transfers
|
Attempts to resume a download. |
|
Attempts to resume an upload. |
|
Resume transfer based on a bookmark and specific files. |
|
Resume upload, specifying bookmarks and files. |
Command Line Options
General Options
|
Enables debugging mode. |
|
Verbose mode, shows more details. |
|
Sets transfer timeout. |
|
Specifies the username for login. |
|
Specifies the port number to connect to. |
|
Outputs ncftp’s log messages to the specified file. |
Transfer Options
|
Continues or resumes interrupted transfers. |
|
Tries to use the FXP protocol (server-to-server transfer). |
|
Delete the source files after successful transfer. |
|
Force use of extended passive mode (EPSV). |
|
Force use of passive mode (PASV). |
|
Use ASCII transfer mode. |
ncftpget and ncftpput Specific Options
|
Recursive retrieval of directories. |
|
Recursive uploading of directories. |
|
Transfer timeout in seconds. |
|
Script timeout in seconds. |
|
Delete the source file after successfully downloading. |
|
Create missing directories. |
Tips and Tricks
Efficient Transfers
Use bookmarks for frequently accessed servers to save time and avoid retyping credentials.
|
For large directory transfers, use the
|
Leverage background transfers (
|
Utilize the
|
Set transfer and script timeouts (
|
Troubleshooting Common Issues
If experiencing connection problems, ensure the firewall allows FTP traffic on port 21 (control) and ports for data transfer.
|
When transfers fail, verify that the remote directory exists and that you have the necessary permissions.
|
If passive mode is required, use the
|
When encountering timeout issues, increase the transfer timeout using the
|
To resolve issues with ASCII vs. binary transfers, force the transfer mode using
|
Automation with Scripts
ncftp can be used in scripts for automated file transfers. Here’s a basic example:
This script connects to an FTP server, navigates to a remote directory, downloads a file, and then exits. |
For more complex tasks, you can chain commands using the
|
When automating, ensure proper error handling. Use
|