Trouble with Relative Path + Emacs Editor

Pork Chop

Well-Known Member
Reaction score
400
Location
USA
Need help with my Linux homework, please :)


Using Fedora 12


Being logged into root means I have access to EVERYTHING

--- I need to use relative paths to list 3 directories (not absolute) and I have to do it while in my home directory (logged in as root)


Location of root's home directory: /root
Location of the 3 directories: /bin /sbin /etc

I cannot use relative paths because the 3 directories HAVE to be under my home directory??? and they are NOT....


EXAMPLE: If the bin directory were in /root.... and I was in /root... then I would be able to use the relative path /bin ???




I cannot get the Emacs editor to open in the Terminal
and it is not located in Applications -> Programming -> Emacs Text Editor
(Programming isn't even listed)
 
Last edited:
So, your home dir is "/home" ?

If so then it would be "../bin" , "../sbin", and "../etc"

If your home dir is "/home/name"

Then "../../bin" and so on
You might even be able to do it like: ".../bin"

But if your logged in as root, then your home dir should be "/root" which is not the same thing as "/", so normal "../" should apply.

"/" is the root directory
"/root" is the root user's home directory


Hope this helps some.
 
Last edited:
So, your home dir is "/home" ?

If so then it would be "../bin" , "../sbin", and "../etc"

If your home dir is "/home/name"

Then "../../bin" and so on
You might even be able to do it like: ".../bin"

But if your logged in as root, then your home dir should be "/root" which is not the same thing as "/", so normal "../" should apply.

"/" is the root directory
"/root" is the root user's home directory


Hope this helps some.

My current working directory is: /root

I think using cd ../bin would work

because I'd be going back to my parent directory (cd ..), which is the directory
right above me (/) -> root itself

Then I'd go forward into /bin
 
My current working directory is: /root

I think using cd ../bin would work

because I'd be going back to my parent directory (cd ..), which is the directory
right above me (/) -> root itself

Then I'd go forward into /bin

Yeah. I'm not sure exactly what your working on. The relative path of 'bin' from where you are now is: '../bin/'. If your just trying to get there in the terminal, then your right, 'cd ../bin'. If your trying to access that path via a program your writing, then wouldn't you just point to '/bin'? Isn't 'bin' always in the root dir?

Also, I know in dos you can simply type 'cd \windows' and that automatically jumps back to the root directory and then to the windows folder, no matter how deep you are. Does this not apply in linux as well? (cd /bin)?
 
I'm a linux noob here so I know no more than you lol




[root@localhost ~]# pwd
/root
[root@localhost ~]# cd bin < wont work
-bash: cd: bin: No such file or directory

[root@localhost ~]# cd ../bin < works
[root@localhost bin]#


As you can see, I cannot use the command (cd bin) to access the bin directory
while in my home directory (/root)

I am able to access it using the (cd ..) command - dot dot addressing technique -

It takes me back to my parent directory (in this case I went from /root to root itself /) then I go forward into the bin directory (/bin)

So -> cd ../bin
 
Back
Top