2

Can someone in detail explain what exactly the following command that a tutorial has instructed me to issue is doing?

chown -R $USER:$GROUP
user2297683
  • 123
  • 2

2 Answers2

3

From the man page https://linux.die.net/man/1/chown

So it's recursively setting owner and group for any subsequently specified directory, and all below it.

chown [OPTION]... [OWNER][:[GROUP]] FILE..

-R, --recursive
    operate on files and directories recursively
steve
  • 21,582
  • 5
  • 48
  • 75
  • There seems to be more to the $USER:$GROUP then variables. This was from a paid video tutorial on setting up a database and was done during the installation phase. It created a directory for its data files and then the next step was to issue that command exactly as typed (except the path for the directory /var/log/data followed). – user2297683 Jun 24 '17 at 10:10
  • OK. If you're unsure, do a `echo user=$USER group=$GROUP` prior to running the `chown`. That will definitively report to you the values that the variables currently have. – steve Jun 24 '17 at 19:45
0

chown basically means changing the ownership of filesystem object(s) like files,directories and links etc.

chown -R $USER:$GROUP file1 dir1 ...

here we are doing two things

  1. changing the ownership of file1 and dir1 to $USER simultaneously
  2. changing the group of file1 dir1 to $GROUP
Archemar
  • 31,183
  • 18
  • 69
  • 104
Abhishek D K
  • 121
  • 5