Linux – “Command not found” while using sudo with nano

linuxnanosudo

I got a problem when I want to edit files using nano with sudo.
When I enter the following command:

sudo nano /etc/exports

I got this error

sudo: nano: command not found

This is the return from echo $PATH:

/home/einzelkind/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/lib/mit/bin:/usr/local/sbin

I installed nano like this:

  1. Download the package with wget https://nano-editor.org/dist/
  2. extract the files with tar -xvJf
  3. ./configure --enable-utf8 --enable-nanorc
  4. sudo make
  5. sudo make install

Nano is installed in /usr/local/bin.

How to solve this problem?

Best Answer

Is /usr/local/bin in your $PATH? Anyway,

sudo /usr/local/bin/nano

should always work, no matter how $PATH is configured.

Related Question