I want to install JAVA, but the installation instructions ask me to create a new folder, called /java/, into the standard /usr/ folder.

But this folder is blocked. I mean, I can not to create a new folder on it, with the PCManFM file manager, because that option is grey.

So I guess there should be a command to create it from a Terminal session. (With sudo, maybe?)

How can I get it? Which is the right command to get it?

4 Answers 4


Create the folder from a command line terminal using:

sudo mkdir /usr/java

You need sudo to make changes to /usr because /usr is owned by the root user.

  • Yes, exactly that. Can you elaborate on why sudo , though ? Commented Jan 4, 2016 at 4:27
  • @Serg the folder /usr is owned by root:root, so you need root privileges to modify it Commented Jan 4, 2016 at 4:28
  • 1
    @zwork <.< I know, with 22k rep I already know that. I'm trying to push people to improve their answers here Commented Jan 4, 2016 at 4:30
  • @Serg sorry, didn't check your profile Commented Jan 4, 2016 at 4:39
  • @zwork it's all good ^_^ I probably should have worded differently my first comment Commented Jan 4, 2016 at 4:40

I'm going to address two parts of your question: java installation and folder creation.

Java installation

We already have a question about that: How can I install Sun/Oracle's proprietary Java JDK 6/7/8 or JRE?.All of the necessary commands are there, and I strongly suggest you read their manual pages with man COMMAND in terminal.

There's also open-source version of Java, Open JDK. Installation of that is somewhat simpler

sudo apt-get install openjdk-7-jre openjdk-7-jdk icedtea-7-plugin

That's pretty much it - apt-get will take care of everything. When you install some package with apt-get or dpkg there should be preinstall and postinstall scripts that come along with the package, and run automatically to set up whatever program you're getting.

Folder Creation

Folder ( in linux terminology - directory ) creation, just like file creation, depends on the permissions. If a folder has the following permissions,

drwxr-xr-x 15 testuser  testuser   4096 Nov 22 12:34 testuser/

that means the owner of that folder testuser can read-write-execute stuff there (first rwx), and group testuser can only read and execute stuff there - that's the r-x part, and final r-x part means read execute for any other groups or users.

/usr folder is owned by root user, so only root can write there, that means create files or folder. Hence for that you need sudo to gain root privileges temporarily.


You have a few choices:

  • gksudo pcmanfm will request you enter your password, then open PCManFM as root, which is somewhat dangerous because if you are not careful you may unintentionally modify system files.

  • sudo mkdir /usr/java will create the directory directly.

  • I know what OP uses PCManFM , but this is still Ubuntu and there's still Nautilus, and nautilus has nautilus-admin for right clicking and opening file/directory with admin privileges. You might want to include that into your answer Commented Jan 4, 2016 at 4:26
  • @Serg I've never heard of nautilus-admin and I don't have nautilus on this box to test it so I won't include that because I have no idea what it is.
    – cat
    Commented Jan 4, 2016 at 4:30
  • In my laptop, I use Lubuntu 15.10 and it doesn't have Nautilus. The file manager of Lubuntu is PCManFM. In my desktop PC, I use Ubuntu Studio 15.10 and it doesn't have Nautilus. The File manager of Ubuntu Studio is Thunar.
    – Juan
    Commented Jan 4, 2016 at 12:36
Creates folders and files

mkdir -p ~/example(Folder)/text(Folder)
touch ~/example(folders)/text(Folder)/text{1..420}.txt
chmod -R 757 ~/example (folder with rights)

Move the text to another created folder

mkdir -p /Sturrage/V1Tst/Memes
mv ~/example/text/text{1..125}.txt /Sturrage/V1Tst/Memes

Same thing but with another folder to put all the text files that are left behind and with rights and user.

mkdir -p /V1Tst/Trash
cp ~/example/text/* /V1Tst/Trash
chmod -R 727 /V1Tst
chown -R user:group /V1Tst
  • Welcome to Ask Ubuntu! You might be able to improve this answer with providing the steps needed in more detail to make it a rock solid answer.
    – Videonauth
    Commented Jul 5, 2016 at 0:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .