"Command not found" while using sudo with nano
21,872
Is /usr/local/bin
in your $PATH
? Anyway,
sudo /usr/local/bin/nano
should always work, no matter how $PATH
is configured.
Related videos on Youtube
Author by
Einzelkind
Updated on September 18, 2022Comments
-
Einzelkind over 1 year
I got a problem when I want to edit files using
nano
withsudo
. 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:- Download the package with
wget https://nano-editor.org/dist/
- extract the files with
tar -xvJf
./configure --enable-utf8 --enable-nanorc
sudo make
sudo make install
Nano is installed in
/usr/local/bin
.How to solve this problem?
-
ganesh almost 7 yearsAlso see superuser.com/questions/927512/…
- Download the package with
-
Einzelkind almost 7 years
sudo /usr/local/bin/nano
works! thank you! -
Kamil Maciorowski almost 7 yearsYour link is useful but the command
sudo echo $PATH
is not. The shell expands$PATH
first, thensudo
gets its value. -
Votar almost 7 yearsWell, that's good to know. Thanks @KamilMaciorowski. So I guess the way to find the PATH for root would be to
su
first and thenecho $PATH
, hm? Anyway, as @jvb suggested - running with absolute path will suffice.