LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-27-2013, 03:30 PM   #1
doug skillmore
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Rep: Reputation: Disabled
SUPER newbie question rel/abs path?


hi all, brand new here and to linux, please be nice!

can someone explain the difference between a relative and absolute path?

please?

i am sorry
 
Old 02-27-2013, 03:37 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Doug:
No need to be 'sorry', at least you're 1 up on some other folks who don't know that they don't know.

A relative path is more relational to the directory you are "in", for example:
if you are in /home/doug (your $HOME directory) a relative path to Documents could be ~/Documents, or $HOME/Documents.
Both of those are relative paths, they "relate" to your /home/doug directory.

an absolute path is /home/doug/Documents

Check out http://rute.2038bug.com/node7.html.g...00000000000000
 
Old 02-27-2013, 04:09 PM   #3
doug skillmore
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
ok sweet.


i like your explantion, it works for me. thank you very much!
 
Old 02-27-2013, 04:10 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
A relative path would be like telling somebody "turn left on Spruce street, right on Walnut Ln, and stop at the 3rd house on your left", while an absolute path would be to tell somebody "go to 1234 Walnut Ln".

Absolute paths can be run from anywhere in the system, they point to a definite place. /home/user is always going to be /home/user no matter where you run that command from.

Relative paths are movements relative to your current location. ../dir1 means "go up one directory, and then into dir1". If your terminal is sitting in /home/user/docs, "../dir1" is going to point to a very different location than if you're sitting in /usr/local/include (the former would point to /home/user/dir1, the latter to /usr/local/dir1).
 
Old 02-27-2013, 04:25 PM   #5
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Habitual View Post
A relative path is more relational to the directory you are "in"
Yes.

Quote:
for example:
if you are in /home/doug (your $HOME directory) a relative path to Documents could be ~/Documents, or $HOME/Documents.
Both of those are relative paths, they "relate" to your /home/doug directory.
Wrong!

~/Documents or $HOME/Documents are still absolute paths.

Documents or ./Documents are relative paths.
 
1 members found this post helpful.
Old 02-27-2013, 04:30 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by suicidaleggroll View Post
A relative path would be like telling somebody "turn left on Spruce street, right on Walnut Ln, and stop at the 3rd house on your left", while an absolute path would be to tell somebody "go to 1234 Walnut Ln".
Misleading analogy.

Your relative path example is great, but for absolute path:
"START out going north on Elm St in Springfield, Iowa (USA) and THEN turn left on Spruce street, right on Walnut Ln, and stop at the 3rd house on your left".

The real difference between absolute and relative is that absolute tells you where to START (but may then give relative directions) while relative assumes the person giving the directions and the person getting the directions both already know the starting point.

BTW, I've never been to Iowa so there is chance the directions I just gave you are wrong.

Last edited by johnsfine; 02-27-2013 at 04:36 PM.
 
Old 02-27-2013, 04:50 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by johnsfine View Post
The real difference between absolute and relative is that absolute tells you where to START (but may then give relative directions) while relative assumes the person giving the directions and the person getting the directions both already know the starting point.
That is true, good catch
 
Old 02-28-2013, 07:26 AM   #8
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by johnsfine View Post
Wrong!
Wouldn't be the first time, I Installed Windows and Ubuntu "once".
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
abs error: core.abs.tar.gz no such file or directory Thaidog Arch 1 06-14-2011 10:20 PM
super-newbie question about Recovery CD Avatar Linux - Newbie 1 04-19-2004 10:14 AM
Newbie question: about Path chinaundead Mandriva 1 03-03-2004 05:23 PM
super newbie question... oulck Linux - Newbie 27 09-19-2002 01:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration