1

I am just trying to rename a file on a server with Ubuntu 18.04.4 installed, but when I enter this line

sudo mv /path/oldname /path/newname

I get this answer

sudo mv /path/oldname /path/newname: command not found

type -a mv:

 mv is /bin/mv 

type -a sudo:

sudo is /usr/bin/sudo 

echo $PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-11-oracle/bin:/usr/lib/jvm/java-11-oracle/db/bin

I have already tried the simplest things like restarting the server, updating apt and using different users but no result. Do you have an idea why this is happening?

6
  • Is this code inside a script? Apr 22, 2020 at 13:55
  • No this is just a command I am using on the command line. It's not in a script
    – IngoH
    Apr 22, 2020 at 13:59
  • Could you provide the exact command you are using? And you are using it locally or remotely? Apr 22, 2020 at 14:02
  • This is the exact command I am using sudo mv /opt/atlassian/crowd /opt/atlassian/crowd_old Using it remotely.
    – IngoH
    Apr 22, 2020 at 14:03
  • 2
    You would get this error message if the spaces were not regular spaces. So please change your sudo mv /path/oldname /path/newname command (from the shell history) to echo sudo mv /path/oldname /path/newname | od -t c -t x1 Apr 22, 2020 at 14:05

1 Answer 1

4

Somehow (e.g. by accidentally pressing Shift, Control, Alt, AltGr) you typed special spaces instead of regular spaces. Thus the shell does not do word splitting and thus treats sudo mv /path/oldname /path/newname as a single long word. Obviously, such a command cannot be found. As the error message states.

So delete the spaces and carefully type them again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .