File System Exercise - "touch <<path>>/<<file>>" command is confusing[solved]

Learning Challenge

File System Exercise: Trying Out The File System - Step 1

Question

I know how to make the directory and then the file within the directory. For example for the very first set of directories they want us to make a directory labeled “one”. I make the directory “one” by typing “mkdir one”. After that to get the first file “alpha” under directory “one”, I type “touch alpha”. Where I’m stuck is how do I create the empty “secret.txt” file in the “alpha” folder?

What I’ve tried

I tried “code secret.txt” but that makes the empty note under the directory “one” instead of inside the file “alpha”. Where am I going wrong? Thank you in advance.

1 Like

It’ll be the same way as you made the alpha file touch ./alpha/secret.txt though there might be a confusion since alpha isn’t a directory(folder). Hope this guides you in the right direction. You can also get more info on the touch command here.

Thank you so much Rafi!!! That really helped a lot!

1 Like

image

This is what I’m getting when I type in the revised “touch” command you shared with me. As you said, alpha is just a file and not a directory. Is that the problem?

Yes it is a problem since you can’t place a file within a file. alpha is not a directory. You’d have to remove it as a file and make it into a directory(folder).

3 Likes

That did it. Thank you. I guess I get confused because I think of one as a directory and if I just use the command “touch alpha” I’m creating an empty file. So I had to use “mkdir alpha” which essentially makes a sub-directory under directory one, correct?

1 Like

All depends where you’re making the directory. You are correct calling it a subdirectory being that it is inside another directory.