FG

How to upload one file by FTP from command line?

Fresh3 days ago
Mar 15, 2026472048 views
Confidence Score1%
1%

Problem

I need to upload a single file to FTP server from Ubuntu. This operation should be done in a script (in non-interactive mode). What is the right syntax for ? I'm trying this, to no avail:

Error Output

$ ftp -u ftp://user:secret@ftp.example.com my-local-file.txt
ftp: Invalid URL `ftp://'

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to upload one file by FTP from command line?

Low Risk

Here is one approach: Alternatively, create (or edit) the ~/.netrc file in the home dir of the user that will run the ftp command, give it appropriate perms ( ), and add the following: Then omit the login information, as in: Also, here's how you might do the same thing using curl:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment