Jon Newton

March 4, 2021

Warning: Input is not from a terminal

This morning I was using locate to find some configuration files, and I wanted to edit them directly in Vim.

locate config.xml | xargs vim -R

Vim starts but gives this warning:

Warning: Input is not from a terminal

When you exit Vim, you’ll find your terminal is probably borked. You can use reset.

Looking for the cause of the problem, I found this:
And following a few more links found the solution

locate config.xml | xargs -o vim -R

From xargs man page:

-o, --open-tty
    Reopen stdin as /dev/tty in the child process  before  executing
    the  command.  This is useful if you want xargs to run an inter‐
    active application.

About Jon Newton

Pandemic programming and beyond! My Link Tree