0

I did the following to my mac with the intention to copy the /etc in /tmp to try something:

$cd /tmp    
$cp -a /etc .  
$cd etc  
-bash: cd: etc: No such file or directory  
$ls -all etc  
lrwxr-xr-x@ 1 jim jim 11 Dec 18 17:44 etc -> private/etc    

What happened? I don't understand. What is this etc -> private/etc and why etc is not a directory in /tmp?

5

In mac it seems that /etc is only a symbolic link pointing to /private/etc. You only copied the link not a directory.

You can achieve what you are trying by copying the directory where the link is pointing or specifying -H option for cp.

  • Is it safe to do rm -rf etc inside /tmp? – Jim Dec 18 '16 at 18:15
  • Yes, it should be ok. If it is only a link, then you don't even need -r option. – StefanR Dec 18 '16 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.