How to get all categories?

I am writing custome module in magento2 i need categories filter so i want all categories can any help me

If you need the categories in the hierarchical way, then see how is the backend category tree rendered.
If you need the categories in the plain way, just use the category collection class.