What is the difference between ''find .'' and ''find /'' on linux command

19.4k views Asked by At

I am solving overthewire bandit. I looked solutions but there is no explanation about it. For example when i use find . find it on bandit 5->6

bandit5@bandit:~/inhere$ find . -type f -readable ! -executable -size 1033c
**./maybehere07/.file2**

bandit5@bandit:~/inhere$ cat ./maybehere07/.file2
**DXjZPULLxYr17uwoI01bNLQbtFemEgo7**

I used find . on bandit6->7 i didn't get any output in the solution they solved with find /

bandit6@bandit:~$ find /  -user bandit7 -group bandit6 -size 33c 2>/dev/null
/var/lib/dpkg/info/bandit7.password

both of are ASCII Text so what is the difference

2

There are 2 answers

0
Kent On BEST ANSWER

If you are talking about the linux find command:

find . [other expressions] means you want to find files based on your current directory.

While find / [other expressions] means you want to find files based on the root (/) directory.

0
choroba On

The path parameter tells find where to search. If you use ., it will only search in the subdirectories of the current directory, while / means the root directory, i.e. it will search everywhere. And, indeed, as you can see, /var/lib/dpkg/info/ is not a subdirectory of ~/inhere.