# Midnight Commander - exit in current directory



## Grzegorz (Nov 11, 2015)

Hi,
   iI've searched many pages with some solutions but for me they didn't work.
Is there any option to exit midnight-commander at the directory it was working?
For example, run mc at /root directory and in mc navigate to /usr/share, when exiting mc i wannaI want to be in /usr/share path.

Cheers


----------



## SirDice (Nov 11, 2015)

Have a look at the /usr/local/libexec/mc/mc.{sh,csh} files.


----------



## shepper (Nov 11, 2015)

More on wrapper scripts


----------



## uzsolt (Nov 13, 2015)

You should `source` /usr/local/libexec/mc/mc.{sh,csh} (depends on the used shell) - as SirDice wrote above.
You should add a line to your ~/.profile (if you use `sh`, or ~/.bashrc if you use `bash`):

```
source /usr/local/libexec/mc/mc.sh
```
And if you use `tcsh` you should use ~/.cshrc.


----------



## freethread (Nov 14, 2015)

uzsolt gave you the real solution. This is an alternative using the hot-key `Ctrl+O`, it hides the panels (full screen shell) and the current directory is the one the selected panel. Type `Ctrl+O` again to go back.


----------

