2

how does mkdir work? I've been trying to install java, and when I type:

mkdir -p /usr/local/java

nothing happens except the terminal just writes it down. when I get to later steps, it says that directory /usr/local/java doesn't exist

  • 3
    Are you using sudo if you're non-root user? /usr/local is owned by root, therefore mkdir won't work without the proper privileges. – Matt O. Dec 8 '17 at 19:48
  • 1
    Are these exact steps youre doing ? No error ? mkdir should produce "Permission denied" error because /usr beling to root, yet you said "nothing happens". Can you clarify, please – Sergiy Kolodyazhnyy Dec 8 '17 at 23:47
4

All system folders are owned by root; thus,you need root permissions:

sudo mkdir -p /usr/local/java
  • 3
    Paying attention to this users score, it's advisable to explain why he needs root permissions to prevent repeat questions in the future. – Matt O. Dec 8 '17 at 20:04
  • 1
    sudo is indeed necessary, however note that OP said nothing happens if they do the command as regular user. However, mkdir should produce "Permission denied" error. There's discrepancy – Sergiy Kolodyazhnyy Dec 8 '17 at 23:46

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.