Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is the server version.

When I ssh into it, I encounter the following problems:

Problem 1

tab completion behaves weird to the point of being unusable:

> cd ~/<press TAB>
-sh: <( compgen -d -- '/home/dmitriid/' ): No such file or directory

> vi ~/.<press TAB>
<( compgen -d -- '/home/dmitriid/.' ): No such file or directory
-sh: <( eval compgen -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|
JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' -- 
$(quote_readline $cur) ): No such file or directory

> nano ~/.<press TAB>
./              .bash_logout    .mc/            .viminfo
../             .bashrc         .mysql_history  
.aptitude/      .erlang.cookie  .profile        
.bash_history   .gitconfig      .ssh/

Is there a way to fix that?

Problem 2

I use mc quite a lot. I often do a Ctrl+O to hide panels and work in the shell. In my case:

  1. Ctrl + O hides panels
  2. Any keypress brings the panels back

Is there a way to fix that as well?

Thank you!

share|improve this question
paste the output of "printenv". I have a suspicion that $HOME is wrong. – David Pashley Jul 29 '09 at 13:58
there is also mention of a bug in bash regarding funny characters, so maybe there is home directory with unprintable characters? – Chad Huneycutt Jul 29 '09 at 15:13
Nope, all characters in ~ are ascii Output of printenv is: $ printenv TERM=xterm-color SHELL=/bin/sh SSH_CLIENT= 52846 22 SSH_TTY=/dev/pts/1 USER=dmitriid LS_COLORS=colorlist MAIL=/var/mail/dmitriid PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games PWD=/home/dmitriid LANG=en_CA HISTCONTROL=ignoreboth SHLVL=1 HOME=/home/dmitriid LOGNAME=dmitriid SSH_CONNECTION=connection LESSOPEN=| /usr/bin/lesspipe %s LESSCLOSE=/usr/bin/lesspipe %s %s _=/usr/bin/printenv – Mamut Jul 31 '09 at 10:38
up vote 3 down vote accepted

Ok. It turns out the solution was dumb and simple. The key was — no interactive shell in mc.

The answer lies here:

6.6 When I use Ctrl-O I don't get a subshell. How do I fix this?

Only bash, tcsh and zsh can be used as subshell. Use one of those shells as your default shell, and it will be used as subshell in GNU Midnight Commander.

So I decided to change the shell:

> which bash
> sudo chsh -s /bin/bash my_user_name
> grep ^my_user_name /etc/password

Note /bin/bash at the end of the passwd file. It means the shell is now changed.

After i logged out and then logged back in — voila, everything works!

share|improve this answer

Looks like there's something wrong with your home directory. Can you do a ls ~ and tell us what's up?

share|improve this answer
> ls ~ apache-couchdb-0.9.0 backup Django-1.0.2-final gitrepo sources.list www-libs www-old apache-couchdb-0.9.0.tar.gz data Django-1.0.2-final.tar.gz libs www www-new – Mamut Jul 31 '09 at 10:37

You .bashrc is sourcing /etc/bash_completion who uses compgen go generate completion for several know commands (such as cd and vi) but not to nano.

For some reason compgen has a problem completing files and directories in your home folder. One quick option to fix this is to comment out the following lines in your .bashrc.

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
share|improve this answer
Nope. Didn't work :( Same problem :( – Mamut Jul 31 '09 at 10:36
correct that. doing reinstallation of bash-related commands and commenting out these lines resulted in this: if I log in, the problem persists. If I run bash, the new prompt behaves as expected (except for the mc problem) – Mamut Jul 31 '09 at 11:24

The reason for your first problem is that you use /bin/sh as shell. Even when this is linked to bash, completion doesn't work.

Change your shell to bash: chsh -s /bin/bash and relogin.

share|improve this answer
Yep, that' s what I did in the end (see my answer above) – Mamut Aug 12 '09 at 10:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.