grep only returns No such file or directory The 2019 Stack Overflow Developer Survey Results...

Python - Fishing Simulator

Loose spokes after only a few rides

My body leaves; my core can stay

Do warforged have souls?

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time?

Windows 10: How to Lock (not sleep) laptop on lid close?

Deal with toxic manager when you can't quit

Using dividends to reduce short term capital gains?

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Word for: a synonym with a positive connotation?

Identify 80s or 90s comics with ripped creatures (not dwarves)

What is the role of 'For' here?

What information about me do stores get via my credit card?

Presidential Pardon

Circular reasoning in L'Hopital's rule

What force causes entropy to increase?

Is 'stolen' appropriate word?

Am I ethically obligated to go into work on an off day if the reason is sudden?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Didn't get enough time to take a Coding Test - what to do now?

Why doesn't a hydraulic lever violate conservation of energy?

Can a flute soloist sit?

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 42 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 42 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 42 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 42 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

                      Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                      Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                      Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...