Skip to main content
Post Closed as "Duplicate" by Gilles 'SO- stop being evil' bash
edited title
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k

In bash `command .* equals to upper directories*` acts on the parent directory

edited tags
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k
Tweeted twitter.com/#!/StackUnix/status/581217736635846657
deleted 118 characters in body
Source Link
g000ze
  • 343
  • 1
  • 7

Someone of our team wanted to recursively change the user permissions on all hidden directories in a users home directory. To do so he executed the following command:

cd /home/username
chown -R username:groupname .*

We were pretty surprised when we realized, that he actually recursively changed the permissions of all user directories in /home, because .* equals to .. as well. Would you have expected this behavior in Linux though?

Anyway, the correct command would have been this one:

cd /home/username
chown -R username:groupname ./.*

Someone of our team wanted to recursively change the user permissions on all hidden directories in a users home directory. To do so he executed the following command:

cd /home/username
chown -R username:groupname .*

We were pretty surprised when we realized, that he actually recursively changed the permissions of all user directories in /home, because .* equals to .. as well. Would you have expected this behavior in Linux though?

Anyway, the correct command would have been this one:

cd /home/username
chown -R username:groupname ./.*

Someone of our team wanted to recursively change the user permissions on all hidden directories in a users home directory. To do so he executed the following command:

cd /home/username
chown -R username:groupname .*

We were pretty surprised when we realized, that he actually recursively changed the permissions of all user directories in /home, because .* equals to .. as well. Would you have expected this behavior in Linux though?

added 4 characters in body
Source Link
g000ze
  • 343
  • 1
  • 7
Loading
deleted 73 characters in body
Source Link
John WH Smith
  • 16.5k
  • 6
  • 54
  • 63
Loading
Source Link
g000ze
  • 343
  • 1
  • 7
Loading