How would I edit a .conf file without gedit from the terminal over SSH?

35,442

Solution 1

On the command line (over ssh or without X) to edit a config file I suggest:

sudo -e /path/to/config_file

By default sudo (root) uses vi as an editor. Personally I prefer vim

sudo apt-get install vim-full

To change your editor, run

sudo update-alternatives --config editor

You will see something like this:

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

hit the number key to change your preferred

Solution 2

Try nano or pico since they are usually on most systems along with vi. Vi would probably be annoying to use on a phone, so I'd go with the former possibilities.

Share:
35,442

Related videos on Youtube

brooke
Author by

brooke

she/her

Updated on September 18, 2022

Comments

  • brooke
    brooke almost 2 years

    I guess my question is closer to "How would I go about editing a .conf file from a remote connection via an ssh terminal?"

    I downloaded an ssh emulator to my iPhone which works fine and dandy, and I can ssh to my computer at home via DNS services. Right now I'm trying to annoy my room mates who are home right now my getting my machine to beep.

    In order to do that I need to edit /etc/modprobe.d/blacklist.config. I tried sudoedit but I got no text.

    Anything graphical is out of the question, because I'm essentially in a dedicated terminal like if you pressed Ctrl+alt+F1.

    • brooke
      brooke over 10 years
      Thanks for both of your help! The comment by bodhi.zazen helped most.
    • Panther
      Panther over 10 years
      @EliahKagan - Alrighty then ;)