15
ubuntu64@ubuntu:/$ sudo chown –R hduser:hadoop mongodbdata
chown: invalid user: ‘–R'

When I try to change the ownership of the file, I am just getting invalid user: '-R' error.

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
Christopher Gaspar
  • 155
  • 1
  • 2
  • 6
  • Related: [useradd/usermod not accepting -c](https://askubuntu.com/questions/1170710/useradd-usermod-not-accepting-c) – Eliah Kagan Sep 05 '19 at 19:37

1 Answers1

36

You must have copied the command from a webpage that uses strange formatting. That's not a normal minus, try this instead:

sudo chown -R hduser:hadoop mongodbdata

Specifically, the one I copied from your question is an en dash (U+2013):

$ unicode -s  –
U+2013 EN DASH
UTF-8: e2 80 93  UTF-16BE: 2013  Decimal: –
–
Category: Pd (Punctuation, Dash)
Bidi: ON (Other Neutrals)
terdon
  • 98,183
  • 15
  • 197
  • 293
  • 1
    In this context, it's probably more appropriate to call it a hyphen than a minus. – Alex Apr 04 '15 at 15:39
  • 1
    @Alex I beg to differ. Personally, I prefer _minus_ in this context and _hyphen_ when talking about text. [I am not alone](http://unix.stackexchange.com/q/2212/22222), that is the standard old school UNIX way. Some people do say _dash_ but I've never heard it called a hyphen in this context. – terdon Apr 08 '15 at 21:26
  • @terdon Huh. That seems really odd to me, but tradition does count for something. I've only ever used the word minus in math. – Alex Apr 10 '15 at 10:34
  • 1
    @Alex both _minus_ and _dash_ are used in this context but certainly not [_hyphen_](https://en.wikipedia.org/wiki/Hyphen) which is a different thing altogether. – terdon Apr 10 '15 at 12:03