Only can be an adjective or an adverb.
used as an adjective
You use only in front of a noun or one to say that something is true about one person, thing, or group and not true about anyone or anything else. In front of only you put the or a possessive.
Grace was the only survivor.
I was the only one listening.
‘Have you a spare one?’ – ‘No, it’s my only copy unfortunately.'
When only has this meaning, you must use a noun or one after it. You cannot say, for example, ‘He was the only to escape’. If you don't want to use a more specific noun, you can use person or thing. You can say, for example, ‘He was the only person to escape’.
He was the only person allowed to issue documents of that sort.
It was the only thing they could do.
If you use another adjective or a number, you put only in front of it.
The only English city he enjoyed working in was Manchester.
So I probably have the only three copies of the album in existence.
‘Only’ is not normally used after an. There is one common exception: if you say that someone is an only child, you mean that they have no brothers or sisters.
As an only child she is accustomed to adult company.
used as an adverb
Only is used as an adverb to say that something is the one thing that is done, that happens, or that is relevant in a particular situation, in contrast to all the other things that are not done, do not happen, or are not relevant.
• If only applies to the subject of a clause, you put it in front of the subject.
Only his close friends knew how much he worried about his daughters.
We believe that only a completely different approach will be effective.
There is only one train that goes from Denmark to Sweden by night.
Drivers only find serious traffic jams in the city centre.
We could only choose two of them.
New technology will only be introduced by agreement with the unions.
used for emphasis
However, if you want to be quite clear or emphatic, you put only immediately in front of the word, word phrase, or clause it applies to.
He played only classical music.
You may borrow only one item at a time.
We film only when something interesting is found.
For extra emphasis, you can put only after the word or word phrase that it applies to.
We insisted on being interviewed by women journalists only.
This strategy was used once only.
In writing and formal speech, you can put only at the beginning of a sentence, followed by the word, phrase, or clause it applies to. After this word, phrase, or clause, you put an auxiliary verb or be followed by the subject of the main clause.
Only here was it safe to prepare and handle hot drinks.
Only then did Ginny realize that she still hadn't phoned her mother.
Another way of emphasizing is to start with ‘It is only...’ or ‘It was only...’ and the word or words that you want to emphasize. You put the rest of the sentence in a that-clause.
It was only much later that I realized what had happened.
It was only when he started to take photographs that he was stopped.
You use not only with but or but also as a way of linking words or word groups.
➜ See not only