This command is actually a solution for this question about mongodb issue.
But the ichiness of not knowing what exactly it is doing, command by command, is really drive me nut!
If anyone could dissect what this line does to... the /data/db directory, or even any other directory! Will be really appreciated (also those who like me, very noobie in command line)
Thanks!
解决方案
The main command is chown, which itself change the owner of the files.
-R means Recursively, means, its applied to every files in the directory
the command inside ` are execute first and then give the result to previous command
id -u is a single command seperated from chown. You can try it and see the result.
in my computer
id -u
returns
myusername
so in my computer
sudo chown -R `id -u` /data/db
is same as
sudo chown -R myusername /data/db
And now because I own that directory, I can add, edit, delete files within that folders.