如何通过 SSH 从终端编辑没有 gedit 的 .conf 文件?

bro*_*oke 2 ssh configuration command-line remote text-processing

我想我的问题更接近于“我将如何通过 ssh 终端从远程连接编辑 .conf 文件?”

我下载了一个 ssh 模拟器到我的 iPhone 上,它运行良好,而且我可以通过 DNS 服务 ssh 到我家里的电脑。现在我正试图惹恼我现在在家的室友,我让我的机器发出哔哔声。

为了做到这一点,我需要编辑/etc/modprobe.d/blacklist.config. 我试过 sudoedit 但我没有收到任何文字。

任何图形都是不可能的,因为我本质上是在一个专用终端中,就像你按下Ctrl+ alt+ 一样F1

Pan*_*her 5

在命令行(通过 ssh 或不使用 X)编辑配置文件我建议:

sudo -e /path/to/config_file
Run Code Online (Sandbox Code Playgroud)

默认情况下 sudo (root) 使用 vi 作为编辑器。我个人更喜欢vim

sudo apt-get install vim-full
Run Code Online (Sandbox Code Playgroud)

要更改您的编辑器,请运行

sudo update-alternatives --config editor
Run Code Online (Sandbox Code Playgroud)

你会看到这样的事情:

There are 3 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/nano            40        manual mode
  2            /usr/bin/vim.basic   30        manual mode
  3            /usr/bin/vim.tiny    10        manual mode
Run Code Online (Sandbox Code Playgroud)

按数字键更改您的首选