0

I am brand new to ubuntu and I am trying to create a new folder inside my / directory.

I have read many posts here that talk about giving myself ownership of files but when I try and do it with /, I get permission denied.

  1. How do I freely create folders/files in root?
  2. Can I make my user the root user?

Question Clarification

My question above is not clear because I didn't understand the scope of the Ubuntu file system.

I didn't want to create folders in root. What I wanted to know is: Where is the best place to put my personal files (like my .dotfiles) in the Ubuntu file system.

For newer Ubuntu/linux users like me, the comments below clarify the thinking with linux fliesystem.

Vinn
  • 123
  • 3
    Can you explain why you want this? It is very, very rarely a good idea to create folders directly under / and an even worse idea to make your user the root user, especially if you are a new user. This feels like an XY problem. If you tell us why you want this, what your final objective is, we should be able to give you a better solution. – terdon May 10 '22 at 11:54
  • Maybe I am mistaken but I am moving from mac Os and I had my .dotfiles folder in the root.

    Maybe there is a better place to put it?

    FYI - I have installed ubuntu on a i7 windows machine (duel boot).

    – Vinn May 10 '22 at 12:04
  • Great insight on the XY problem. Noted for next time. – Vinn May 10 '22 at 12:05
  • Oh wow yes. You absolutely do not want your dotfiles there, they should all be in your home directory. Basically, never touch / unless you really know what you are doing. Everything that is only for your user should be in your $HOME and not in /. – terdon May 10 '22 at 12:08
  • Okay, so where would all my main config files be linked too? For example, I use Kitty terminal and kitty looks for the config file in .config/kitty. ? – Vinn May 10 '22 at 12:19
  • I just realised that on ubuntu its the /home directory. Thanks Terdon – Vinn May 10 '22 at 12:22
  • 1
    No, not the /home directory, it's the /home/vinn (or whatever your user name is) directory. That's where the programs you run will expect to find their configurations for your user. And you're welcome :) – terdon May 10 '22 at 12:23
  • Super helpful, could you add this as the answer? I think this would be helpful for new Ubuntu users :) – Vinn May 10 '22 at 12:25
  • Eh, it isn't what the question is actually asking and we have several posts about the general idea. Have a look at Why is there /etc and ~/.config? Why is the global config called "etc" yet the user's config stuff is called ".config"? and What is .config folder? – terdon May 10 '22 at 12:36
  • I suggest reading the Filesystem Hierarcy Standard at https://refspecs.linuxfoundation.org/fhs.shtml, or read man hier.

    It explains where things go.

    – waltinator May 10 '22 at 12:56
  • @Vinn as it is now, your question is asking something different than what you want, so we can't post what you actually need to hear as an answer. You can edit your question to make it ask what you actually need (where to put config files which were in root in MacOS) – Esther May 10 '22 at 13:03
  • Thank you all. This is helpful. – Vinn May 10 '22 at 14:57

1 Answers1

0

Simply type in the terminal:

sudo mkdir /root/<name_of_directory>

Here the command sudo is telling the system you want root privileges. Then enter your normal password or if you made a specific root password enter it.

The command mkdir will create a directory in the given PATH that is /root/<name_of_directory>

mojito
  • 19
  • 2
    Did you read the comments on the original question? although this is what the question asks, this is not what the user needs, and is a VERY bad idea to do, especially for a new user. – Esther May 10 '22 at 13:03
  • @Esther i simply answered his question. He is free to do whatever he wants with this knowledge. Even though it's a bad idea, his question was clear. So was my answer. – mojito May 10 '22 at 13:08
  • The OP wanted to create the folder from /, not from /root. – raphael75 Mar 05 '24 at 17:13