Know (something) inside out

To know something thoroughly.

I know the history of our city inside out.