Zorin's directory syntax

Please help with a simple issue, the sort of thing that's so basic it's never found on forums: how do you designate a directory location?

I thought it was too easy to mess up, but then I ran into a site that said Ubuntu directories with two-word names must have a backslash-space. That didn't work, maybe it's obsolete information. Then I saw that the directories themselves were separated with backslashes. Only when I try it, say with "cd" I get a "No such file or directory error."

Could I have an example of the correct syntax and how it can be used?

No space.

For example, let's say you want to cd into your home Downloads directory, into the permissions folder of a file you downloaded. The Full Path would look something like;

cd /home/$USER/Downloads/Example/permissions

Shorthand, of course:

~/Downloads/Example/permissions

1 Like

It is recommended to use an underscore if you want to add spaces in a directory name. While you may possible be able to use spaces in the name by placing the desired name in quotes, it is not recommended nor may actually work. Should you feel it necessary to use multiple words to name a directory, use the underscore.

Example:

name_of_a_directory

characters behind \ are interpreted different from other characters when it comes to Files.

in your case, what you seem to be doing is something like this:

/example/file/with/a space/
# this space will be interpreted as a new argument!
# this means programs will think that "space/" and "/example/file/with/a" are seperate files!

when it should be something like this:

/example/file/with/a\ space/
# or alternatively:
"/example/file/with/a space/"

Thank you everyone. That clears it up. And the ~ is an abbreviation for /home/$USER (and $USER abbreviates my account name?

A related question: in a command like cd is it necessary to give the path to the target from the directory currently occupied, or from the root directory to the target directory?

Yes.

I would not call this an abbreviation - rather it represents the users username.
It's a generic stand-in name.

When using something like you want to extract text from a pdf called This stupid.pdf:

ocrmypdf This\ stupid.pdf ouput.pdf

File names that are not joined with an underscore have to be separated with a backslash.

To get to a higher directory than the one you are in, simply

cd ..

continually until you get where you want to be.

So let's say I am in /home/swarfendor437

first 'cd ..' takes us to /home

second 'cd ..' takes us to root directory where all the main directories of the system are - so let's say we now want to go to /etc ...

cd etc

You have now reached the top of the /etc folder - it's pretty much the same as you would using commands in CMD!

you can do both!
there's absolute and relative paths

you can imagine it something like this:
absolute path - path to file, starting from / and aaaaall the way to where your file is

relative path - starts from where you currently are

they are used like this (let's assume you're in your own Home directory and have a file called Test.txt in a folder called test)

Relative
test/test.txt

Absolute
/home/user/test/test.txt

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.