How to perform grep on FTP?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
10
down vote

favorite












I tried searching for similar command in ncftp (actually this is the only terminal ftp client I used) and I didn't find it.



What's the way (if possible at all) to use grep command on remote server, to search for strings in files?










share|improve this question























  • Also related: Search Within Files On Remote FTP Site - Stack Overflow
    – sdaau
    Mar 2 '14 at 18:18














up vote
10
down vote

favorite












I tried searching for similar command in ncftp (actually this is the only terminal ftp client I used) and I didn't find it.



What's the way (if possible at all) to use grep command on remote server, to search for strings in files?










share|improve this question























  • Also related: Search Within Files On Remote FTP Site - Stack Overflow
    – sdaau
    Mar 2 '14 at 18:18












up vote
10
down vote

favorite









up vote
10
down vote

favorite











I tried searching for similar command in ncftp (actually this is the only terminal ftp client I used) and I didn't find it.



What's the way (if possible at all) to use grep command on remote server, to search for strings in files?










share|improve this question















I tried searching for similar command in ncftp (actually this is the only terminal ftp client I used) and I didn't find it.



What's the way (if possible at all) to use grep command on remote server, to search for strings in files?







command-line grep search ftp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 15 '15 at 19:06









cuonglm

101k23195296




101k23195296










asked Apr 2 '12 at 12:02









Bojan Savic

51113




51113











  • Also related: Search Within Files On Remote FTP Site - Stack Overflow
    – sdaau
    Mar 2 '14 at 18:18
















  • Also related: Search Within Files On Remote FTP Site - Stack Overflow
    – sdaau
    Mar 2 '14 at 18:18















Also related: Search Within Files On Remote FTP Site - Stack Overflow
– sdaau
Mar 2 '14 at 18:18




Also related: Search Within Files On Remote FTP Site - Stack Overflow
– sdaau
Mar 2 '14 at 18:18










5 Answers
5






active

oldest

votes

















up vote
5
down vote













The standard ftp protocol does not allow it (You can check the list of commands). So you would have to download everything just to be able to grep on it.






share|improve this answer



























    up vote
    5
    down vote













    You can use curlftpfs to mount remote ftp as local disk and manipulate with files as on your local machine.






    share|improve this answer
















    • 2




      As with everything which is mount based, this implies that you will transfer the whole data to your own host.
      – Stéphane Gimenez
      Apr 2 '12 at 12:27






    • 1




      Yes it will. But it also depends on task you need to perform. When you need grep something in the most cases you can ignore nontext files (and they won't be transfer) and maybe part of text files. So in this case your sum transfer size may be lower than in case you'll transfer the whole data from the remote site.
      – rush
      Apr 2 '12 at 12:45


















    up vote
    4
    down vote













    You should localy mount the remote FTP directory to do this, however, be warned that all the files you grep will need to be downloaded for this operation.



    SSH into the remote machine and run grep through there, if possible, to save bandwidth.






    share|improve this answer



























      up vote
      0
      down vote













      Assuming you are using simple ftp via command line,
      Use dir command with -Rl option to search recursively and copy it to a file and then search the file using grep, find or whatever way is supported on your OS.



      ftp> dir -Rl education.txt
      output to local-file: education.txt? y
      227 Entering Passive Mode (9,62,119,15,138,239)
      150 Opening ASCII mode data connection for file list
      226 Transfer complete





      share|improve this answer





























        up vote
        0
        down vote













        By using lftp



        First grab everything from ftp to file



        $ lftp http://downloads.site.com/sources> find . > sources-list.txt


        Next perform grep on file:



        $ grep FILE sources-list.txt





        share|improve this answer




















          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f35538%2fhow-to-perform-grep-on-ftp%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote













          The standard ftp protocol does not allow it (You can check the list of commands). So you would have to download everything just to be able to grep on it.






          share|improve this answer
























            up vote
            5
            down vote













            The standard ftp protocol does not allow it (You can check the list of commands). So you would have to download everything just to be able to grep on it.






            share|improve this answer






















              up vote
              5
              down vote










              up vote
              5
              down vote









              The standard ftp protocol does not allow it (You can check the list of commands). So you would have to download everything just to be able to grep on it.






              share|improve this answer












              The standard ftp protocol does not allow it (You can check the list of commands). So you would have to download everything just to be able to grep on it.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Apr 2 '12 at 12:19









              Stéphane Gimenez

              19k15074




              19k15074






















                  up vote
                  5
                  down vote













                  You can use curlftpfs to mount remote ftp as local disk and manipulate with files as on your local machine.






                  share|improve this answer
















                  • 2




                    As with everything which is mount based, this implies that you will transfer the whole data to your own host.
                    – Stéphane Gimenez
                    Apr 2 '12 at 12:27






                  • 1




                    Yes it will. But it also depends on task you need to perform. When you need grep something in the most cases you can ignore nontext files (and they won't be transfer) and maybe part of text files. So in this case your sum transfer size may be lower than in case you'll transfer the whole data from the remote site.
                    – rush
                    Apr 2 '12 at 12:45















                  up vote
                  5
                  down vote













                  You can use curlftpfs to mount remote ftp as local disk and manipulate with files as on your local machine.






                  share|improve this answer
















                  • 2




                    As with everything which is mount based, this implies that you will transfer the whole data to your own host.
                    – Stéphane Gimenez
                    Apr 2 '12 at 12:27






                  • 1




                    Yes it will. But it also depends on task you need to perform. When you need grep something in the most cases you can ignore nontext files (and they won't be transfer) and maybe part of text files. So in this case your sum transfer size may be lower than in case you'll transfer the whole data from the remote site.
                    – rush
                    Apr 2 '12 at 12:45













                  up vote
                  5
                  down vote










                  up vote
                  5
                  down vote









                  You can use curlftpfs to mount remote ftp as local disk and manipulate with files as on your local machine.






                  share|improve this answer












                  You can use curlftpfs to mount remote ftp as local disk and manipulate with files as on your local machine.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 2 '12 at 12:24









                  rush

                  19k45994




                  19k45994







                  • 2




                    As with everything which is mount based, this implies that you will transfer the whole data to your own host.
                    – Stéphane Gimenez
                    Apr 2 '12 at 12:27






                  • 1




                    Yes it will. But it also depends on task you need to perform. When you need grep something in the most cases you can ignore nontext files (and they won't be transfer) and maybe part of text files. So in this case your sum transfer size may be lower than in case you'll transfer the whole data from the remote site.
                    – rush
                    Apr 2 '12 at 12:45













                  • 2




                    As with everything which is mount based, this implies that you will transfer the whole data to your own host.
                    – Stéphane Gimenez
                    Apr 2 '12 at 12:27






                  • 1




                    Yes it will. But it also depends on task you need to perform. When you need grep something in the most cases you can ignore nontext files (and they won't be transfer) and maybe part of text files. So in this case your sum transfer size may be lower than in case you'll transfer the whole data from the remote site.
                    – rush
                    Apr 2 '12 at 12:45








                  2




                  2




                  As with everything which is mount based, this implies that you will transfer the whole data to your own host.
                  – Stéphane Gimenez
                  Apr 2 '12 at 12:27




                  As with everything which is mount based, this implies that you will transfer the whole data to your own host.
                  – Stéphane Gimenez
                  Apr 2 '12 at 12:27




                  1




                  1




                  Yes it will. But it also depends on task you need to perform. When you need grep something in the most cases you can ignore nontext files (and they won't be transfer) and maybe part of text files. So in this case your sum transfer size may be lower than in case you'll transfer the whole data from the remote site.
                  – rush
                  Apr 2 '12 at 12:45





                  Yes it will. But it also depends on task you need to perform. When you need grep something in the most cases you can ignore nontext files (and they won't be transfer) and maybe part of text files. So in this case your sum transfer size may be lower than in case you'll transfer the whole data from the remote site.
                  – rush
                  Apr 2 '12 at 12:45











                  up vote
                  4
                  down vote













                  You should localy mount the remote FTP directory to do this, however, be warned that all the files you grep will need to be downloaded for this operation.



                  SSH into the remote machine and run grep through there, if possible, to save bandwidth.






                  share|improve this answer
























                    up vote
                    4
                    down vote













                    You should localy mount the remote FTP directory to do this, however, be warned that all the files you grep will need to be downloaded for this operation.



                    SSH into the remote machine and run grep through there, if possible, to save bandwidth.






                    share|improve this answer






















                      up vote
                      4
                      down vote










                      up vote
                      4
                      down vote









                      You should localy mount the remote FTP directory to do this, however, be warned that all the files you grep will need to be downloaded for this operation.



                      SSH into the remote machine and run grep through there, if possible, to save bandwidth.






                      share|improve this answer












                      You should localy mount the remote FTP directory to do this, however, be warned that all the files you grep will need to be downloaded for this operation.



                      SSH into the remote machine and run grep through there, if possible, to save bandwidth.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Apr 2 '12 at 18:50









                      WhyNotHugo

                      22517




                      22517




















                          up vote
                          0
                          down vote













                          Assuming you are using simple ftp via command line,
                          Use dir command with -Rl option to search recursively and copy it to a file and then search the file using grep, find or whatever way is supported on your OS.



                          ftp> dir -Rl education.txt
                          output to local-file: education.txt? y
                          227 Entering Passive Mode (9,62,119,15,138,239)
                          150 Opening ASCII mode data connection for file list
                          226 Transfer complete





                          share|improve this answer


























                            up vote
                            0
                            down vote













                            Assuming you are using simple ftp via command line,
                            Use dir command with -Rl option to search recursively and copy it to a file and then search the file using grep, find or whatever way is supported on your OS.



                            ftp> dir -Rl education.txt
                            output to local-file: education.txt? y
                            227 Entering Passive Mode (9,62,119,15,138,239)
                            150 Opening ASCII mode data connection for file list
                            226 Transfer complete





                            share|improve this answer
























                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              Assuming you are using simple ftp via command line,
                              Use dir command with -Rl option to search recursively and copy it to a file and then search the file using grep, find or whatever way is supported on your OS.



                              ftp> dir -Rl education.txt
                              output to local-file: education.txt? y
                              227 Entering Passive Mode (9,62,119,15,138,239)
                              150 Opening ASCII mode data connection for file list
                              226 Transfer complete





                              share|improve this answer














                              Assuming you are using simple ftp via command line,
                              Use dir command with -Rl option to search recursively and copy it to a file and then search the file using grep, find or whatever way is supported on your OS.



                              ftp> dir -Rl education.txt
                              output to local-file: education.txt? y
                              227 Entering Passive Mode (9,62,119,15,138,239)
                              150 Opening ASCII mode data connection for file list
                              226 Transfer complete






                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jun 15 '15 at 18:48









                              Anthon

                              59.6k17101162




                              59.6k17101162










                              answered Jun 15 '15 at 18:44









                              SmitaK

                              1




                              1




















                                  up vote
                                  0
                                  down vote













                                  By using lftp



                                  First grab everything from ftp to file



                                  $ lftp http://downloads.site.com/sources> find . > sources-list.txt


                                  Next perform grep on file:



                                  $ grep FILE sources-list.txt





                                  share|improve this answer
























                                    up vote
                                    0
                                    down vote













                                    By using lftp



                                    First grab everything from ftp to file



                                    $ lftp http://downloads.site.com/sources> find . > sources-list.txt


                                    Next perform grep on file:



                                    $ grep FILE sources-list.txt





                                    share|improve this answer






















                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      By using lftp



                                      First grab everything from ftp to file



                                      $ lftp http://downloads.site.com/sources> find . > sources-list.txt


                                      Next perform grep on file:



                                      $ grep FILE sources-list.txt





                                      share|improve this answer












                                      By using lftp



                                      First grab everything from ftp to file



                                      $ lftp http://downloads.site.com/sources> find . > sources-list.txt


                                      Next perform grep on file:



                                      $ grep FILE sources-list.txt






                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered 2 days ago









                                      cy8g3n

                                      216




                                      216



























                                           

                                          draft saved


                                          draft discarded















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f35538%2fhow-to-perform-grep-on-ftp%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown






                                          Popular posts from this blog

                                          How to check contact read email or not when send email to Individual?

                                          Bahrain

                                          Postfix configuration issue with fips on centos 7; mailgun relay