How to configure mc to remember path

Nothing is more annoying than when you open Midnight Commander (mc), browse through a couple of directories and exit mc that the shell does not return to the directory that you previously opened.

In Debian this feature is disabled by default. Luckily it's easy to enable!

Edit ~/.profile file with vim:

vi ~/.profile

Add the following line to the bottom:

alias mc='source /usr/lib/mc/mc-wrapper.sh'

# In Debian 11 I had to use:
alias mc='. /usr/lib/mc/mc-wrapper.sh'

Refresh changes (or launch a new console):

source ~/.profile