1. I don't like some books.

2. I don't like some of the books.

3. I don't eat some food.
4. I don't eat some of the food.

5. I don't buy some items.
6. I don't buy some of the items.

7. I don't know some boys.
8. I don't know some of them.
---------------------------------------
I have listed sentences containing 'some' in a negative sentence. Are they all grammatical? According to some grammar books, it is said that 'some' should not be used in a negative sentence. Is this correct? Can we use 'some' in a negative sentence?

All of these pairs of sentences are fine. They don't mean exactly the same thing, but they are all correct.

Yes, all of the sentences you listed are grammatically correct. Contrary to what some grammar books may say, it is indeed acceptable to use the word "some" in a negative sentence. While it is true that "some" is often associated with positive or affirmative statements, it can also be used in negative contexts.

In each of the sentences you provided, "some" is used to indicate a portion or subset of a larger group. By negating the verb that follows, you are expressing that you do not like/eat/buy/know a certain part of the group being referred to.

For example:
1. "I don't like some books." - This means that there are certain books within a broader category that you do not like.
2. "I don't like some of the books." - This has a similar meaning to the first sentence but specifies "of the books" to emphasize the subset you are referring to.

The same logic applies to the other sentences you listed. So, while it is true that "some" is more commonly used in affirmative statements, there is nothing grammatically incorrect about using it in negative sentences. It is all about conveying the specific meaning or emphasis you intend.