grep only returns No such file or directory The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraEvery grep command returns “grep: invalid option — '='”How to use grep to search for a file anywheregrep string from a pcap fileGrep : Filtering QuestionUse a list of words to grep in an other listGrep showing file name and string foundWhy is grep only returning one line?How to use grep on all files non-recursively in a directory?Grep to return entire file content“ls | grep zip” vs. “grep zip $(ls)”

Can withdrawing asylum be illegal?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

How to type a long/em dash `—`

Keeping a retro style to sci-fi spaceships?

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

What force causes entropy to increase?

Can each chord in a progression create its own key?

Deal with toxic manager when you can't quit

Why did Peik Lin say, "I'm not an animal"?

Do working physicists consider Newtonian mechanics to be "falsified"?

Would an alien lifeform be able to achieve space travel if lacking in vision?

Student Loan from years ago pops up and is taking my salary

Can the DM override racial traits?

Did the new image of black hole confirm the general theory of relativity?

Homework question about an engine pulling a train

Was credit for the black hole image misappropriated?

Python - Fishing Simulator

Do I have Disadvantage attacking with an off-hand weapon?

Loose spokes after only a few rides

Why can't devices on different VLANs, but on the same subnet, communicate?

Is there a writing software that you can sort scenes like slides in PowerPoint?

What can I do if neighbor is blocking my solar panels intentionally?

Is this wall load bearing? Blueprints and photos attached

Button changing its text & action. Good or terrible?



grep only returns No such file or directory



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraEvery grep command returns “grep: invalid option — '='”How to use grep to search for a file anywheregrep string from a pcap fileGrep : Filtering QuestionUse a list of words to grep in an other listGrep showing file name and string foundWhy is grep only returning one line?How to use grep on all files non-recursively in a directory?Grep to return entire file content“ls | grep zip” vs. “grep zip $(ls)”



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Apparently I've done something that has altered how grep runs on my Ubuntu 16.04 machine. Regardless of what I input to it, it returns "No such file or directory", or something along those lines.



For example, if I create a file and then try and search it with grep, it doesn't work. Entering the two commands below produces the error.



$ echo 'dog eat dog' > dog
$ grep 'd' dog
grep: d: No such file or directory


Perhaps I've done something so that grep is looking in the wrong place?










share|improve this question
















bumped to the homepage by Community 31 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






migrated from stackoverflow.com Apr 10 '18 at 17:59


This question came from our site for professional and enthusiast programmers.













  • 1





    What return alias grep ?

    – Gilles Quenot
    Mar 12 '18 at 0:42











  • alias grep returns bash: alias: grep: not found

    – tylercasablanca
    Mar 13 '18 at 1:35











  • @BagusTesa apologies for posting in the wrong spot.

    – tylercasablanca
    Mar 13 '18 at 1:35











  • Problem solved. I had removed /bin/grep from the path variable by accident. Sorry for the trouble.

    – tylercasablanca
    Mar 13 '18 at 1:42











  • I mis-typed the previous comment. Basically, there is an alias for grep in .bashrc that is commented out, and when it gets un-commented then grep breaks. I will move this to the AskUbuntu as he requested.

    – tylercasablanca
    Mar 13 '18 at 2:00

















1















Apparently I've done something that has altered how grep runs on my Ubuntu 16.04 machine. Regardless of what I input to it, it returns "No such file or directory", or something along those lines.



For example, if I create a file and then try and search it with grep, it doesn't work. Entering the two commands below produces the error.



$ echo 'dog eat dog' > dog
$ grep 'd' dog
grep: d: No such file or directory


Perhaps I've done something so that grep is looking in the wrong place?










share|improve this question
















bumped to the homepage by Community 31 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






migrated from stackoverflow.com Apr 10 '18 at 17:59


This question came from our site for professional and enthusiast programmers.













  • 1





    What return alias grep ?

    – Gilles Quenot
    Mar 12 '18 at 0:42











  • alias grep returns bash: alias: grep: not found

    – tylercasablanca
    Mar 13 '18 at 1:35











  • @BagusTesa apologies for posting in the wrong spot.

    – tylercasablanca
    Mar 13 '18 at 1:35











  • Problem solved. I had removed /bin/grep from the path variable by accident. Sorry for the trouble.

    – tylercasablanca
    Mar 13 '18 at 1:42











  • I mis-typed the previous comment. Basically, there is an alias for grep in .bashrc that is commented out, and when it gets un-commented then grep breaks. I will move this to the AskUbuntu as he requested.

    – tylercasablanca
    Mar 13 '18 at 2:00













1












1








1








Apparently I've done something that has altered how grep runs on my Ubuntu 16.04 machine. Regardless of what I input to it, it returns "No such file or directory", or something along those lines.



For example, if I create a file and then try and search it with grep, it doesn't work. Entering the two commands below produces the error.



$ echo 'dog eat dog' > dog
$ grep 'd' dog
grep: d: No such file or directory


Perhaps I've done something so that grep is looking in the wrong place?










share|improve this question
















Apparently I've done something that has altered how grep runs on my Ubuntu 16.04 machine. Regardless of what I input to it, it returns "No such file or directory", or something along those lines.



For example, if I create a file and then try and search it with grep, it doesn't work. Entering the two commands below produces the error.



$ echo 'dog eat dog' > dog
$ grep 'd' dog
grep: d: No such file or directory


Perhaps I've done something so that grep is looking in the wrong place?







grep






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 14 at 3:40









Pablo Bianchi

3,12521636




3,12521636










asked Mar 12 '18 at 0:32









tylercasablancatylercasablanca

612




612





bumped to the homepage by Community 31 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 31 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






migrated from stackoverflow.com Apr 10 '18 at 17:59


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Apr 10 '18 at 17:59


This question came from our site for professional and enthusiast programmers.









  • 1





    What return alias grep ?

    – Gilles Quenot
    Mar 12 '18 at 0:42











  • alias grep returns bash: alias: grep: not found

    – tylercasablanca
    Mar 13 '18 at 1:35











  • @BagusTesa apologies for posting in the wrong spot.

    – tylercasablanca
    Mar 13 '18 at 1:35











  • Problem solved. I had removed /bin/grep from the path variable by accident. Sorry for the trouble.

    – tylercasablanca
    Mar 13 '18 at 1:42











  • I mis-typed the previous comment. Basically, there is an alias for grep in .bashrc that is commented out, and when it gets un-commented then grep breaks. I will move this to the AskUbuntu as he requested.

    – tylercasablanca
    Mar 13 '18 at 2:00












  • 1





    What return alias grep ?

    – Gilles Quenot
    Mar 12 '18 at 0:42











  • alias grep returns bash: alias: grep: not found

    – tylercasablanca
    Mar 13 '18 at 1:35











  • @BagusTesa apologies for posting in the wrong spot.

    – tylercasablanca
    Mar 13 '18 at 1:35











  • Problem solved. I had removed /bin/grep from the path variable by accident. Sorry for the trouble.

    – tylercasablanca
    Mar 13 '18 at 1:42











  • I mis-typed the previous comment. Basically, there is an alias for grep in .bashrc that is commented out, and when it gets un-commented then grep breaks. I will move this to the AskUbuntu as he requested.

    – tylercasablanca
    Mar 13 '18 at 2:00







1




1





What return alias grep ?

– Gilles Quenot
Mar 12 '18 at 0:42





What return alias grep ?

– Gilles Quenot
Mar 12 '18 at 0:42













alias grep returns bash: alias: grep: not found

– tylercasablanca
Mar 13 '18 at 1:35





alias grep returns bash: alias: grep: not found

– tylercasablanca
Mar 13 '18 at 1:35













@BagusTesa apologies for posting in the wrong spot.

– tylercasablanca
Mar 13 '18 at 1:35





@BagusTesa apologies for posting in the wrong spot.

– tylercasablanca
Mar 13 '18 at 1:35













Problem solved. I had removed /bin/grep from the path variable by accident. Sorry for the trouble.

– tylercasablanca
Mar 13 '18 at 1:42





Problem solved. I had removed /bin/grep from the path variable by accident. Sorry for the trouble.

– tylercasablanca
Mar 13 '18 at 1:42













I mis-typed the previous comment. Basically, there is an alias for grep in .bashrc that is commented out, and when it gets un-commented then grep breaks. I will move this to the AskUbuntu as he requested.

– tylercasablanca
Mar 13 '18 at 2:00





I mis-typed the previous comment. Basically, there is an alias for grep in .bashrc that is commented out, and when it gets un-commented then grep breaks. I will move this to the AskUbuntu as he requested.

– tylercasablanca
Mar 13 '18 at 2:00










2 Answers
2






active

oldest

votes


















0














Your command is correct - something seems wrong with your environment



$ echo 'dog eat dog' > dog
$ grep 'd' dog
dog eat dog


Your error message suggests that it is considering "grep: d: " as a command and not "grep". The other possibility is that you do not have grep in the path. Try:



which grep


To find out where grep is installed. Also try a non-existing command such as grepx (which does not exist) to check your error message:



$ grepx 'd' dog
-bash: grepx: command not found





share|improve this answer






























    0















    • Did you try it this way



      echo 'dog eat dog' > dog; /bin/grep 'd' ./dog



      If this works, your aliasing or other bashrc settings a wrong



    • Do you have write and read access in the directory where you call the command?






    share|improve this answer























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "89"
      ;
      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',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2faskubuntu.com%2fquestions%2f1023751%2fgrep-only-returns-no-such-file-or-directory%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Your command is correct - something seems wrong with your environment



      $ echo 'dog eat dog' > dog
      $ grep 'd' dog
      dog eat dog


      Your error message suggests that it is considering "grep: d: " as a command and not "grep". The other possibility is that you do not have grep in the path. Try:



      which grep


      To find out where grep is installed. Also try a non-existing command such as grepx (which does not exist) to check your error message:



      $ grepx 'd' dog
      -bash: grepx: command not found





      share|improve this answer



























        0














        Your command is correct - something seems wrong with your environment



        $ echo 'dog eat dog' > dog
        $ grep 'd' dog
        dog eat dog


        Your error message suggests that it is considering "grep: d: " as a command and not "grep". The other possibility is that you do not have grep in the path. Try:



        which grep


        To find out where grep is installed. Also try a non-existing command such as grepx (which does not exist) to check your error message:



        $ grepx 'd' dog
        -bash: grepx: command not found





        share|improve this answer

























          0












          0








          0







          Your command is correct - something seems wrong with your environment



          $ echo 'dog eat dog' > dog
          $ grep 'd' dog
          dog eat dog


          Your error message suggests that it is considering "grep: d: " as a command and not "grep". The other possibility is that you do not have grep in the path. Try:



          which grep


          To find out where grep is installed. Also try a non-existing command such as grepx (which does not exist) to check your error message:



          $ grepx 'd' dog
          -bash: grepx: command not found





          share|improve this answer













          Your command is correct - something seems wrong with your environment



          $ echo 'dog eat dog' > dog
          $ grep 'd' dog
          dog eat dog


          Your error message suggests that it is considering "grep: d: " as a command and not "grep". The other possibility is that you do not have grep in the path. Try:



          which grep


          To find out where grep is installed. Also try a non-existing command such as grepx (which does not exist) to check your error message:



          $ grepx 'd' dog
          -bash: grepx: command not found






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 12 '18 at 0:46







          Ari Singh






























              0















              • Did you try it this way



                echo 'dog eat dog' > dog; /bin/grep 'd' ./dog



                If this works, your aliasing or other bashrc settings a wrong



              • Do you have write and read access in the directory where you call the command?






              share|improve this answer



























                0















                • Did you try it this way



                  echo 'dog eat dog' > dog; /bin/grep 'd' ./dog



                  If this works, your aliasing or other bashrc settings a wrong



                • Do you have write and read access in the directory where you call the command?






                share|improve this answer

























                  0












                  0








                  0








                  • Did you try it this way



                    echo 'dog eat dog' > dog; /bin/grep 'd' ./dog



                    If this works, your aliasing or other bashrc settings a wrong



                  • Do you have write and read access in the directory where you call the command?






                  share|improve this answer














                  • Did you try it this way



                    echo 'dog eat dog' > dog; /bin/grep 'd' ./dog



                    If this works, your aliasing or other bashrc settings a wrong



                  • Do you have write and read access in the directory where you call the command?







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 10 '18 at 18:14









                  abu_buaabu_bua

                  4,18981630




                  4,18981630



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1023751%2fgrep-only-returns-no-such-file-or-directory%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

                      Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                      Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                      Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»