Search code examples
vifreebsdgnu-screen

Error:'vi: No terminal database found', while running vi from screen session


I am unable to open a file with vi within a screen session. I am getting vi: No terminal database found while trying to open the file with vi.

$ which vi
/usr/bin/vi
$ /usr/bin/vi
vi: No terminal database found

I am able to open file using vi while I am disconnected from screen session.The below commands outside screen session works fine.

$ vi
$ vi a.txt

Tried workaround from here but I am getting No matching processes were found error

killall vi
No matching processes were found

Solution

  • As @nbari mentioned in the comments:

    In the machine that you are sshing from, add this to your shell rc file:

    1. export TERM=xterm.
    2. Do: source ~/.bashrc or whatever shell you are using

    NOTE: These steps are not to be done on the problem machine, but the freebsd you are sshing from.