I'm logged into a Linux server and use ftp placeftp.thing.com to connect to a different server.

I receive the message below and now I can transfer files to that server, however a basic Unix command echo $SHELL doesn't work. Is it because I'm in binary transfer mode or simply because of the FTP connection?

Connected to placeftp.thing.com (
220 You are connected to PLACEFTP.THING.COM.
331 User name okay, need password.
230 User logged in, proceed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> echo $SHELL
?Invalid command

I might be asking my question incorrectly, but what am I misunderstanding about FTP connections?

  • Some FTP servers allow logged-in clients to execute commands on the server using the SITE FTP verb. It's unlikely to give you a shell-like environment with variables and so on - it's more likely implemented using a simple exec()/wait(). – Toby Speight Sep 1 '17 at 7:54

FTP is not a remote shell like SSH or telnet. FTP is a protocol with only a few select commands. See the standard RFC 959 for details about the supported commands.

The various terminal interfaces which exist and the various graphical FTP clients essentially just translate some local commands or clicks into a FTP command. For example many terminal clients have ls or dir which will be translated in FTP LIST command, put into STOR, get into RETR etc. But there is no FTP command for an echo functionality you've tried because such functionality does not really make sense when the single goal of the protocol is file transfer.

  • 1
    Note that at an interactive, TUI, FTP client like that, the user is not actually speaking the FTP protocol, and what commands the protocol has is not the same as what commands the client software has. – JdeBP Aug 31 '17 at 19:50
  • @JdeBP: correct. I've extended the answer to make this more clear. – Steffen Ullrich Aug 31 '17 at 19:59

FTP is used to transfer files between computers on a network. When you connect to a FTP server, you are able to run commands that help you transfer, create, and remove files.

It is not a bash shell that you can run bash commands on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.