Use grep without -i flag

hello @Mosh and everyoneđź‘‹.
in video 10 of chapter 3 when you use grep command without -i you said that because our search is case sensitive we didn’t see anything return in shell. but i run this command without -i flag and i see hello word returned:

root@cb100d72ce28:~# grep hello file1.txt

my docker version is:

If possible explain to me how I have the output in the console and you didn’t?
Is this because I am using a higher version or is there another reason?


What does file1.txt contain?
What is the expected output?


file1.txt contain this text

how are you?

and i expected to nothing return because i did’t use -i flag but this command return hello in console

So is it so odd that grep hello file1.txt outputs hello ?

What output do you get with this variant ?

grep Hello file1.txt

nothing return in terminal

So to me everything works as it should.

Let’s sum up:

You have a file names file1.txt which content is

how are you?

The command

grep hello file1.txt outputs hello. Indeed there is a line which precisely contains hello hence it outputs.

Now if Hello is written with a capital letter, it does not output anything. Indeed as it is case sensitive it does not match anymore and nothing is output. Now if I add the -i switch I am telling grep to be case-insensitive and hello outputs


I understand now. Thanks for your help​:pray::pray: