Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running OSX 10.7 and i'm looking for a way to search for a string in the contents of a file on a remote FTP server. I'd like to be able to run the search over ftp rather than having to download all the files, and then search them locally.

Is there an app for that, or a way i can do it from the terminal?

share|improve this question
up vote 1 down vote accepted

This does not work with FTP.

The reason is that FTP is a protocol for listing and transferring files only. Nothing more, nothing less. You can get the name of a file, or list a folder's files, or you can transfer it to your machine. You can't, however, peek into the file.

Searching the contents of the file would be a much more complicated task than just serving it. FTP is not designed to do this and will never allow this.

Do it over SSH if you can.

If you have access over SSH, you can send a remote command that would allow you to search within files. Download and connect to the server.

Then send a command using Option-Cmd-C.

grep -ri "something" /remote/folder

This would search for "something" within /remote/folder and all of its children.

enter image description here

Have a look at some grep examples (here or here) to see how you could use it.

share|improve this answer
Thanks for the clarification, and examples. In this case, the server in question is a shared hosting server, and I don't have SSH access. I was hoping there was a way to do it strictly over FTP instead. – Dan Aug 15 '11 at 17:40

If filezilla is available for osx then you can use it for ftp remote file search.. else run a windows in virtualbox and use filezilla there .

share|improve this answer
Use what? Please complete your answer. – vonbrand Feb 14 '13 at 17:08
@vonbrand Using FileZilla. Granted, using a Windows VM just for an FTP client… but there's an OS X version. – slhck Feb 14 '13 at 17:16
You can't use FTP for remote file searching. You can use FTP for remote file browsing. – Enigma Mar 5 '13 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .