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;
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
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.
add a comment |
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
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 returnalias grep
?
– Gilles Quenot
Mar 12 '18 at 0:42
alias grep
returnsbash: 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 forgrep
in.bashrc
that is commented out, and when it gets un-commented thengrep
breaks. I will move this to the AskUbuntu as he requested.
– tylercasablanca
Mar 13 '18 at 2:00
add a comment |
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
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
grep
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 returnalias grep
?
– Gilles Quenot
Mar 12 '18 at 0:42
alias grep
returnsbash: 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 forgrep
in.bashrc
that is commented out, and when it gets un-commented thengrep
breaks. I will move this to the AskUbuntu as he requested.
– tylercasablanca
Mar 13 '18 at 2:00
add a comment |
1
What returnalias grep
?
– Gilles Quenot
Mar 12 '18 at 0:42
alias grep
returnsbash: 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 forgrep
in.bashrc
that is commented out, and when it gets un-commented thengrep
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
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
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?
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered Mar 12 '18 at 0:46
Ari Singh
add a comment |
add a comment |
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?
add a comment |
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?
add a comment |
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?
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?
answered Apr 10 '18 at 18:14
abu_buaabu_bua
4,18981630
4,18981630
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
What return
alias grep
?– Gilles Quenot
Mar 12 '18 at 0:42
alias grep
returnsbash: 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 thengrep
breaks. I will move this to the AskUbuntu as he requested.– tylercasablanca
Mar 13 '18 at 2:00