CHOWN: What does "id -u" stand for

I am functioning to get Mongodb working on a Ubuntu web server install. In assessing the instructions I required to create a "\ information \ db" directory site in the origin drive. Whereupon I required to modify the proprietor making use of the CHOWN command as adheres to:

sudo chown `id -u` /data/db

When I release that command as it shows up in the fast start overview I receive

chown: invalid user: 'id -u'

I am new to Linux, so what I do not recognize is what the 'id -u' was intended to suggest. When I change with my customer name the command finishes simply great and also mongo runs. Can a person aid me recognize what the brief hand 'id -u' would certainly connect to a specialist Linux customer that it did not to me?

0
2019-05-05 07:13:29
Source Share
Answers: 3

It returns your customer id. Run man id for additional information.

0
2019-05-08 19:54:50
Source

id -u prints your customer id on the system. As a different you can simply run this command :

sudo chown <user> /data/db changing <user> with your username on the system.

0
2019-05-08 19:50:23
Source

The command id -u publishes out your "numerical customer ID" (brief : UID) ; as you currently saw, it coincides as defining your username completely on the chown command line. Without a doubt, the adhering to command conjurations need to all have the very same result :

sudo chown `id -u` /data/db
sudo chown $USER /data/db

The reason that it did not function as anticipated has most likely to do with the quotes : they need to be backquotes (ASCII char 0x60), whereas the chown mistake message recommends that you made use of solitary quotes (ASCII char 0x27).

You can locate a really detailed description of UNIX shell pricing estimate here.

0
2019-05-08 18:25:09
Source