Is it possible to find out the file is already uploaded to IPFS?

I have (sample.pdf) PDF and I uploaded it to IPFS and my CID is xaxaxaxaxax****xaxa.

Now, If I upload the same file (sample.pdf) with the same name or a different name to IPFS it will upload, and as result, I get the same CID

But I would like to know before uploading the file
Is there any possible way to find out that sample.pdf is already uploaded?

Here is an example of how to check from the CLI:

> echo "this is a test zzz" | ipfs add -n                
added QmV7MG3Sd654tXKtMNpxFxudgbGFhAuYkaQiyovdx8ZFFn QmV7MG3Sd654tXKtMNpxFxudgbGFhAuYkaQiyovdx8ZFFn
 19 B / 19 B [==========================================================================================] 100.00%
> ipfs cat QmV7MG3Sd654tXKtMNpxFxudgbGFhAuYkaQiyovdx8ZFFn

In this case, it doesn’t find it because it doesn’t already exist.

@ylempereur
ipfs cat CID

the above command is to display the content respective to the CID
But when I’m uploading the duplicate content I won’t be having the CID of the previous one.

So, how can i verify ?

He he, you missed the point entirely. What I was teaching you was how to get the CID of a file you want to add without actually adding it. That’s what the “-n” does when using ipfs add. Once you have the CID, there are many commands that let you test/retrieve it if it exists. The most efficient would be ipfs object stat CID.

@ylempereur
My bad

Anyways lemme try and get back to you if I need any more help.