MC (Midnight Commander) is one of the most commonly used console file managers for Linux. One of the disadvantages that most administrators encounter is that mc
sometimes takes a very long time to start up.
After connecting to the host via SSH and running the mc
command, you have to wait 1-3 minutes for it to start. This problem is most often related to DNS settings.
Solution 0: check that DNS servers are configured in the network interface settings and that these servers are available.
There are other ways to fix the mc slow startup problem:
Solution 1:
Add your server name and IP to the /etc/hosts
file. You can use the following command:
sudo echo "127.0.0.2 $(hostname).domain $(hostname)" >> /etc/hosts
Solution 2:
You can disable using name resolution when connecting via SSH. To do this, add the parameter to the sshd configuration file /etc/sshsshd_config
:
UseDNS no
Restart sshd:
systemctl restart sshd || systemctl restart ssh
Solution 3:
Try to disable built-in mc shell support:
alias mc="mc --nosubshell"
After that, mc should open instantly.