My Beloved Father; Moulana Haroon Abasoomar saheb (hafizhahullah) usually offers the following advices for when we hear the sad news of the passing of a fellow Muslim.
These are simple, but effective and do not take much time.
When hearing the news of the death of a fellow Muslim, do the following:
1. Recite: inna lillahi wa inna ilayhi raji’un
إِنَّا لِلَّهِ وَإِنَّا إِلَيْهِ رَاجِعُونَ
2. Make du’a for forgiveness for the deceased.
3. Make du’a for the family to be blessed with patience.
4. Make du’a for a good death for ourselves.
5. Do isal thawab for the deceased. (See here)
6. Whenever you think of the deceased, immediately make du’a for them.
7. Attend the funeral, if it is within reasonable distance.
Click here for: ‘Ten Hadiths on the virtue of attending a funeral’